You cannot see this page without javascript.

FreeBSD APM Source Compile

Linux 조회 수 2163 추천 수 0 2016.05.20 23:42:20

ip고정


vi /etc/rc.conf:
ifconfig_em0="inet 192.168.0.254 netmask 255.255.255.0"
defaultrouter="192.168.0.1"


echo "nameserver 168.126.63.1" >> /etc/resolv.conf


관련 페키지 설치

portsnap fetch update && portupgrade -a

pkg install -y wget cmake ncurses libtool expat pcre openssl openssl-devel flex gcc patch gettext automake bison libtool autoconf binutils patchutils byacc diffstat cvs rcs subversion ctags cscope fuse openssl lzma doxygen intltool git swig pkgconf rsync gawk mawk gnulib

 

계정 생성

pw groupadd dba
adduser


ID : mysql

Full Name : MySQL

Group : dba

Shell : nologin

Home : /var/mysql

PW : no

 

컴파일러 버전변경

mv /usr/bin/cc /usr/bin/cc34
ln -s /usr/local/bin/gcc48 /usr/local/bin/cc
mv /usr/bin/c++ /usr/bin/c++34
ln -s /usr/local/bin/c++48 /usr/local/bin/c++
mv /usr/bin/CC /usr/bin/CC34
ln -s /usr/local/bin/c++48 /usr/local/bin/CC
mv /usr/bin/cpp /usr/bin/cpp34
ln -s /usr/local/bin/cpp48 /usr/local/bin/cpp

 

라이브러리 링크
ln -s /usr/local/lib /usr/lib


소스 다운로드 및 설치

cd /usr/src
wget http://ftp.kaist.ac.kr/mariadb/mariadb-10.1.14/source/mariadb-10.1.14.tar.gz
tar zxvf mariadb-10.1.14.tar.gz

chmod -R 777 mariadb-10.1.14
cd mariadb-10.1.14

cmake \
-DCMAKE_INSTALL_PREFIX=/apm/server/mariadb \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_DATADIR=/apm/apps/data \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/apm/server/mariadb/mysql.sock \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_ARIA_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_FEDERATEDX_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_ZLIB=system \
-DWITHOUT_TOKUDB=1

make
make install


디렉토리 생성 및 환경 설정
mkdir /apm/apps
cd /apm/server/mariadb
mkdir /apm/server/conf
mv /etc/my.cnf /apm/server/conf/my.cnf
vi /apm/server/conf/my.cnf


[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
datadir=/apm/apps/data
socket=/apm/server/mariadb/mysql.sock
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
 
# Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
# include all files from the config directory
# !includedir /etc/my.cnf.d

 

디렉토리 생성 및 권한 설정

mkdir /var/log/mariadb
mkdir /var/run/mariadb
chown mysql:dba /var/log/mariadb
chown mysql:dba /var/run/mariadb
./scripts/mysql_install_db --user=mysql --datadir=/apm/apps/data  --defaults-file=/apm/server/conf/my.cnf
chown -R mysql:dba /apm/server/mariadb
chown -R mysql:dba /apm/apps/data
ln -s /apm/server/mariadb/bin/mysql /usr/bin/mysql
ln -s /apm/server/mariadb/bin/mysqldump /usr/sbin/mysqldump
ln -s /apm/server/mariadb/bin/mysql_config /usr/sbin/mysql_config
ln -s /apm/server/mariadb/bin/mysqladmin /usr/sbin/mysqladmin
ln -s /apm/server/mariadb/support-files/mysql.server /etc/rc.d/mysql

service mysql start

ln -s /apm/server/mariadb/support-files/mysql.server /usr/local/etc/rc.d/mysql.server.sh


root 비밀번호 설정

mysqladmin -u root password

mysqladmin -u root -p reload


DB 접속 테스트

mysql -u root -p

 

Apache 다운로드 및 설치

cd /usr/src
wget http://mirror.apache-kr.org/httpd/httpd-2.4.20.tar.gz
tar zxvf httpd-2.4.20.tar.gz
cd httpd-2.4.20
./configure \
--prefix=/apm/server/apache/httpd \
--sysconfdir=/apm/server/conf \
--with-apr=/usr/local/bin/apr-1-config \
--with-apr-util=/usr/local/bin/apu-1-config \
--with-libxml2 \
--with-mpm=worker \
--with-pcre \
--with-ssl \
--with-z \
--enable-authn-socache=no \
--enable-authnz-ldap=no \
--enable-cache \
--enable-cgid=no \
--enable-deflate \
--enable-dav \
--enable-dav-fs=no \
--enable-dav-lock=no \
--enable-ext-filter=no \
--enable-expires \
--enable-file-cache \
--enable-headers \
--enable-isapi=no \
--enable-lbmethod-bybusyness=no \
--enable-lbmethod-byrequests=no \
--enable-lbmethod-bytraffic=no \
--enable-lbmethod-heartbeat=no \
--enable-ldap=no \
--enable-mime-magic \
--enable-mods-shared=most \
--enable-modules=most \
--enable-mpms-shared=all \
--enable-proxy \
--enable-proxy-ajp=no \
--enable-proxy-balancer=no \
--enable-proxy-connect=no \
--enable-proxy-express=no \
--enable-proxy-fcgi=no \
--enable-proxy-fdpass=no \
--enable-proxy-ftp=no \
--enable-proxy-http=no \
--enable-proxy-scgi=no \
--enable-rewrite \
--enable-so \
--enable-socache-dbm=no \
--enable-socache-shmcb \
--enable-ssl \
--enable-vhosts-alias
make
make install

 

Apache 환경설정
cd /apm/server/conf
vi httpd.conf

ServerRoot "/apm/server/apache/httpd"
Listen 80
# 사용할 모듈의 주석을 제거하여 활성화한다
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule dav_module modules/mod_dav.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
...
</IfModule>
# 관리자 이메일
ServerAdmin admin@my.domain
# 서버 이름
#ServerName www.my.domain:80
ServerName 127.0.0.1
# 루트 디렉토리
<Directory />
    AllowOverride none
    Require all denied
</Directory>
# 도큐먼트 루트 디렉토리
DocumentRoot "/apm/apps/docs"
<Directory "/apm/apps/docs">
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
# 폴더로 접근할 때 실행하는 인덱스 파일 설정
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php index.php3
</IfModule>
# 개발 환경 설정 참조
<Files ".ht*">
    Require all denied
</Files>
# 설정 파일 import
# Server-pool management (MPM specific)
Include /apm/server/conf/extra/httpd-mpm.conf
# Language settings
Include /apm/server/conf/extra/httpd-languages.conf
 
mkdir /apm/apps/docs

vi extra/httpd-languages.conf
 
DefaultLanguage ko


vi /apm/server/apache/httpd/bin/apachectl

 

#!/bin/sh
#
# Apache This starts and stops Apache.
#
# chkconfig: 35 20 80
# description: Apache Web Service
#
# Licensed to the Apache Software Foundation
...

 

ln -s /apm/server/apache/httpd/bin/apachectl /etc/rc.d/apache
kldload accf_data
kldload accf_http
service apache start
ln -s /apm/server/apache/httpd/bin/apachectl /usr/local/etc/rc.d/apache.sh
echo "/apm/server/apache/httpd/module" >> /etc/ld.so.conf
ldconfig
echo 'accf_data_load="YES"' >> /boot/loader.conf
echo 'accf_http_load="YES"' >> /boot/loader.conf

 

Apache 테스트

실제 브라우저를 이용하여 확인

echo "apache TEST" > /apm/apps/docs/index.html
chmod 755 /apm/apps/docs/index.html

 

php install

 

pkg install libvpx icu openldap-sasl-client mcrypt libxslt cclient
cd /usr/src
wget http://kr1.php.net/distributions/php-5.6.23.tar.gz
tar zxvf php-5.6.23.tar.gz
cd php-5.6.23
./configure \
--prefix=/apm/server/php \
--program-prefix= \
--with-layout=GNU \
--localstatedir=/var \
--with-config-file-path=/apm/server/conf \
--with-config-file-scan-dir=/apm/server/conf \
--disable-all \
--disable-cli \
--disable-cgi \
--with-apxs2=/apm/server/apache/httpd/bin/apxs \
--with-bz2 \
--with-curl \
--with-freetype-dir=/usr/local \
--with-gd \
--with-gdbm \
--with-gettext \
--with-gmp \
--with-iconv-dir=/usr/lib/ \
--with-icu-dir=/usr/local \
--with-imap \
--with-imap-ssl \
--with-jpeg-dir=/usr/local \
--with-kerberos \
--with-ldap \
--with-ldap-sasl \
--with-libdir=lib \
--with-libedit \
--with-libexpat-dir=/usr/local \
--with-libmbfl \
--with-libxml-dir=/usr/local \
--with-mcrypt \
--with-mhash \
--with-mysql-sock=/apm/server/mariadb/mysql.sock \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-onig \
--with-openssl \
--with-openssl-dir=/usr/local \
--with-pcre-dir=/usr/local \
--with-pcre-regex=/usr/local \
--with-pdo-mysql=mysqlnd \
--with-pear \
--with-pic \
--with-png-dir=/usr/local \
--with-readline \
--with-regex=php \
--with-t1lib=/usr/local \
--with-vpx-dir=/usr/local \
--with-xmlrpc \
--with-xpm-dir=/usr/local \
--with-xsl \
--with-zend-vm=CALL \
--with-zlib \
--with-zlib-dir=/usr \
--enable-bcmath \
--enable-calendar \
--enable-dba=shared \
--enable-dom \
--enable-exif \
--enable-ftp \
--enable-gd-jis-conv \
--enable-gd-native-ttf \
--enable-inline-optimization \
--enable-intl \
--enable-json \
--enable-libxml \
--enable-maintainer-zts \
--enable-mbregex \
--enable-mbstring \
--enable-mod-charset \
--enable-mysqlnd \
--enable-opcache \
--enable-pcntl \
--enable-pdo \
--enable-session \
--enable-shmop \
--enable-sigchild \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--enable-xml \
--enable-zip
make
make install

 

환경 설정

cp php.ini-production /apm/server/conf/php.ini
vi /apm/server/conf/php.ini

short_open_tag = On
asp_tags = On
date.timezone = "Asia/Seoul"
 
vi /apm/server/conf/httpd.conf

# PHP 모듈이 정상적으로 추가되었는지 확인
LoadModule php5_module modules/libphp5.so
<IfModule mime_module>
    ... 중략 ...
    AddType application/x-httpd-php .php .html
    AddType application/x-httpd-php-source .phps
</IfModule>
 

service apache stop
service apache start
ln -s /apm/server/php/bin/php /bin/php
ln -s /apm/server/php/bin/php-config /usr/local/bin/php-config
ln -s /apm/server/php/bin/phpize /usr/local/bin/phpize
echo "<?php phpinfo() ?>" > /apm/apps/docs/phpinfo.php


cd /apm/apps/docs
wget https://files.phpmyadmin.net/phpMyAdmin/4.6.2/phpMyAdmin-4.6.2-all-languages.tar.gz
tar zxvf phpMyAdmin-4.6.2-all-languages.tar.gz
mv phpMyAdmin-4.6.2-all-languages phpmyadmin

엮인글 :
List of Articles
번호 제목 글쓴이 날짜 조회 수

XE Login