'APM 설치'에 해당되는 글 1건

  1. 2012.06.19 CentOS 6.4에서 APM 소스 설치 6

 

 

 

## 설치 환경

 

- CentOS 6.4

- Apache 2.4.6

- PHP 5.5.5

- MySQL ver 5.6.14

- 설치 위치 : /usr/local/httpd-2.4.6

- 데이타 위치 /Web

 

 

1. 다운로드

 

1) 아파치 : http://httpd.apache.org/download.cgi

2) PHP : http://www.php.net/downloads.php

3) OpenSSL : http://www.openssl.org

 - [LASTEST] 가 붙어 있는 버전을 다운받습니다


 

 

2. 소스 압축 풀기

 

# cd /usr/local/src

 

# tar -xvzf httpd-2.4.6.tar.gz

# tar -xvzf php-5.5.5.tar.gz

# tar -xvzf mysql-5.6.14.tar.gz

 

 

3. APM 설치를 위한 사전 요구 사항

 - 본 패키지 설치 과정은 OS 설치 사항에 따라 변경될 수 있다.

 - 소스 설치가 아닌 것들은 yum으로 설치

 

1) APR ( for Apache )


최신 버전은 http://mirror.apache-kr.org/apr/ 에서 다운받으시길 바랍니다.


2013년 11월 7일 현재 최신 버전


APR : 1.4.8

APR-ICONV : 1.2.1

APR-UTIL : 1.5.2


 

** Apache 2.4.X 는 APR 1.4 이상을 필요로 한다. 현재 필자가 설치하는 CentOS 6.2 에서는 1.3.9 패키지를 사용하므로 소스 컴파일해서 설치하였다.

 

# cd /usr/local/src

 

# wget http://mirror.apache-kr.org//apr/apr-1.4.8.tar.gz

# tar -xvzf apr-1.4.8.tar.gz

# cd apr-1.4.8

# ./configure --prefix=/usr/local/apr-1.4.8

# make ; make install

 


# wget http://mirror.apache-kr.org//apr/apr-util-1.5.2.tar.gz

# tar -xvzf apr-util-1.5.2.tar.gz

# cd apr-util-1.5.2

# ./configure --prefix=/usr/local/apr-util-1.5.2 --with-apr=/usr/local/apr-1.4.8

# make ; make install



# wget http://apache.mirror.cdnetworks.com/apr/apr-iconv-1.2.1.tar.gz

# tar -xvzf apr-iconv-1.2.1.tar.gz

# cd apr-iconv-1.2.1

./configure --prefix=/usr/local/apr-iconv-1.2.1 --with-apr=/usr/local/apr-1.4.8


 

2) PCRE ( for Apache )

# yum install pcre-devel.x86_64

 

3) LUA ( for Apache )

# yum install lua-devel.x86_64

 

4) XML2 Library ( for Apache )

# yum install libxml2-devel.x86_64

 

5) libncurses5-dev ( for MySQL )

# yum install ncurses-devel.x86_64

 

6) 그래픽 관련 라이브러리 ( for PHP )

# yum install zlib-devel.x86_64   

# yum install libjpeg-devel.x86_64

# yum install libpng-devel.x86_64

# yum install libjpeg-turbo-devel.x86_64 (CentOS 6.4로 업데이트되면서 패키지명이 바뀐 듯 합니다)

# yum install gd-devel.x86_64

# yum install php-mbstring.x86_64

# yum install libexif-devel.x86_64

 

7) mcrypt 라이브러리 설치

# yum install libmcrypt-devel.x86_64


8) curl 라이브러리 설치

 # yum instalcurl.x86_64

 # yum install libcurl-devel.x86_64


9) icu 설치

 #  yum install icu libicu libicu-devel




4. MySQL 설치 : http://calflove.tistory.com/334 참고



 

5. OpenSSL 설치


1) YUM을 통한 설치

 # yum install openssl openssl-devel


2) 소스를 통한 설치 ( 여기서는 이 방법을 기준으로 한다 )

# cd /usr/local/src/openssl-1.0.0f

./config --prefix=/usr/local/openssl-1.0.1f --openssldir=/usr/local/openssl shared threads zlib

# make; make install


- prefix 뒤 디렉토리에는 라이브러리가,  openssldir 뒤 디렉토리에는  인증서 관련 파일들이 설치됩니다. 


# echo /usr/local/openssl/lib >> /etc/ld.so.conf
# /sbin/ldconfig


- 동적 라이브러리를 설정안하면 Apache 컴파일 과정에서 에러가 발생한다.




6. Apache 설치

 

# cd /usr/local/src/httpd-2.4.6

# ./configure --prefix=/usr/local/httpd-2.4.6 --enable-so --enable-mods-shared --enable-ssl  --with-ssl=/usr/local/openssl --enable-modules=ssl --with-mpm=worker --enable-cache --with-apr=/usr/local/apr-1.4.8 --with-apr-util=/usr/local/apr-util-1.5.2 

 


- apache 2.x에는  mod_ssl이 포함되어 있기 때문에 옵션만 주면 된다.

- 여기 사용된 옵션은 아파치 웹 서버의 성능을 높히기 위한 것으로써 아래 문서를 참고하기 바람

    http://httpd.apache.org/docs/2.4/mod/worker.html

    http://httpd.apache.org/docs/2.4/mod/mod_cache.html



# make; make install



참고 > make 실행시 아래와 같은 에러가 발생하면 apr 버전이 낮아서 생기는 문제임

 

exports.c:1778: error: redefinition of 'ap_hack_apr_gid_get'

exports.c:778: note: previous definition of 'ap_hack_apr_gid_get' was here

exports.c:1796: error: redefinition of 'ap_hack_apr_version'

exports.c:789: note: previous definition of 'ap_hack_apr_version' was here

exports.c:1797: error: redefinition of 'ap_hack_apr_version_string'

exports.c:790: note: previous definition of 'ap_hack_apr_version_string' was here

make[2]: *** [exports.lo] 오류 1

make[2]: Leaving directory `/usr/local/src/httpd-2.4.6/server'

make[1]: *** [all-recursive] 오류 1

make[1]: Leaving directory `/usr/local/src/httpd-2.4.6/server'

make: *** [all-recursive] 오류 1


혹시 서버에 APR 패키지가 설치되어 있다면 지우고 소스로 설치한다.


# yum remove APR


 


7. PHP 설치

 

# cd /usr/local/src/php-5.5.5

# ./configure --prefix=/usr/local/php-5.5.5 --with-config-file-path=/usr/local/httpd-2.4.6/conf --with-apxs2=/usr/local/httpd-2.4.6/bin/apxs --with-mysql=/usr/local/mysql-5.6.14 --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql --with-mysql-sock=/tmp/mysql.sock  --with-jpeg-dir=/usr --with-mcrypt=/usr --with-png-dir=/usr --with-zlib=/usr --enable-mbstring --enable-exif --enable-zip --enable-ftp --enable-sockets  --enable-pcntl --enable-sigchild --enable-mbstring --with-gd  --enable-bcmath --with-iconv  --with-freetype-dir --with-libxml-dir --with-gettext --with-pcre-dir --with-curl --with-openssl-dir --enable-intl 


# make ; make install

 

 


8. Apache Config

 

# cd /usr/local/httpd-2.4.6/conf

 

# vi httpd.conf

 

- 아래 부분 삽입

 

<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php
</IfModule>

 

- 아래 주석 해제 및 삽입

 

<IfModule mime_module>

    AddType application/x-httpd-php .php .htm .html .inc .php4 .php3
    AddType application/x-httpd-php-source .phps

</IfModule>

 


* 참고 : 로그 분할


# vi httpd.conf 또는 httpd-vhosts.conf


- 아래 로그 부분 부분에 로그 분할 관련 설정 (1일 단위로 로그 분할)


    ErrorLog "|/usr/local/httpd/bin/rotatelogs error_log.%Y%m%d 86400"

    CustomLog "|/usr/local/httpd/bin/rotatelogs access_log.%Y%m%d 86400" common




9. PHP Config

 

# cd /usr/local/src/php-5.5.5

# cp php.ini-production /usr/local/httpd-2.4.6/conf/php.ini

 

# cd /usr/local/httpd-2.4.6/conf

# vi php.ini 

 

아래 항목을 아래와 같이 바꾸어준다


short_open_tag = On 


 


10. Apache 구동 스크립트 복사 및 구동

 

 # cd /usr/local/httpd-2.4.6/bin

 # cp apachectl /etc/rc.d/init.d/httpd

 

- Apache Config test

# /etc/rc.d/init.d/httpd configtest

 

- Apache Start

# /etc/rc.d/init.d/httpd start

 

 


11. 방화벽 오픈 및 테스트 


# lokkit --service http


# telnet lcoalhost 80


 

참고 문헌

 - http://httpd.apache.org/docs/2.4/programs/configure.html (Apache Config)

 - http://byseob.blogspot.kr/2010/08/centos-5455-updatede-apm-%EC%84%A4%EC%B9%98-%EB%B0%A9%EB%B2%95-%ED%99%95%EC%9D%B8.html (APM 설치)

 - http://absorbed.tistory.com/27 ( 아파치 설치 오류 관련 )

 - http://legend.anycert.co.kr/support/openssl_install.html (OpenSSL 설치)

 - http://legend.anycert.co.kr/support/httpd_ssl_install.html (mod-ssl 설치)

 


 

Posted by 카프러브