티스토리 뷰

Study/System

APM 설치 - CentOS 6.4

pursh 2013. 11. 12. 15:44

CentOS 6.4 버전이 나왔길 래 테스트 겸 APM을 설치해 보았다.

CentOS는 다른 설정을 하지 않고 BasicServer Profile로 설치했다.

그래서인지 무지 고생... 설치 안된 패키지가 많았다.

개인적으로는 소스 설치를 선호하기에 나름 깔끔하기는 했다...^^;;

 

우선 gcc, gcc-c++을 설치한다.

이것두 소스 설치할려고 했지만 시간 관계로 패스~~~

 

[root@boanhack src]# yum install gcc gcc-c++

 

*zlib 설치

 

[root@boanhack src]# tar zxvf zlib-1.2.6.tar.gz
[root@boanhack src]# cd zlib-1.2.6
[root@boanhack zlib-1.2.6]# rpm -e --nodeps zlib-1.2.3-29.el6.i686
[root@boanhack zlib-1.2.6]# ./configure
[root@boanhack zlib-1.2.6]# make && make install
[root@boanhack zlib-1.2.6]# rm -rf /lib/libz.so.1

 

기존에 RPM 설치된 버전을 삭제했기에 설치된 라이브러리를 심볼릭 링크...
[root@boanhack zlib-1.2.6]# ln -s /usr/local/lib/libz.so.1.2.6 /lib/libz.so.1
[root@boanhack zlib-1.2.6]# ln -s /usr/local/lib/libz.so.1.2.6 /usr/lib/libz.so.1

 

 

*libpng 설치

 

[root@boanhack src]# tar zxvf libpng-1.5.9.tar.gz
[root@boanhack src]# cd libpng-1.5.9
[root@boanhack libpng-1.5.9]# cp scripts/makefile.linux Makefile
[root@boanhack libpng-1.5.9]# ./configure
[root@boanhack libpng-1.5.9]# make test
[root@boanhack libpng-1.5.9]# make install

 

 

*freetype 설치


[root@boanhack src]# tar zxvf freetype-2.4.8.tar.gz
[root@boanhack src]# cd freetype-2.4.8
[root@boanhack freetype-2.4.8]# rpm -e --nodeps freetype-2.3.11-6.el6_2.9.i686
[root@boanhack freetype-2.4.8]# ./configure
[root@boanhack freetype-2.4.8]# make && make install

 

 

*jpeg 설치


[root@boanhack src]# tar zxvf jpegsrc.v8d.tar.gz
[root@boanhack src]# cd jpeg-8d/
[root@boanhack jpeg-8d]# ./configure --enable-shared --enable-static
[root@boanhack jpeg-8d]# make && make install

 


*gd 설치

[root@boanhack src]# tar zxvf gd-2.0.35.tar.gz
[root@boanhack src]# cd gd/2.0.35/
[root@boanhack 2.0.35]# make && make install

 


*libxml 설치


[root@boanhack src]# tar zxvf libxml2-2.7.8.tar.gz
[root@boanhack src]# cd libxml2-2.7.8
[root@boanhack libxml2-2.7.8]# rpm -e --nodeps libxml2-2.7.6-8.el6_3.4.i686
[root@boanhack libxml2-2.7.8]# ./configure
[root@boanhack libxml2-2.7.8]# make && make install
[root@boanhack libxml2-2.7.8]# ln -s /usr/local/lib/libxml2.so.2.7.8 /usr/lib/libxml2.so.2

 

 

*cmake 설치
{root@boanhack src]# tar zxvf cmake-2.8.7.tar.gz
[root@boanhack src]# cd cmake-2.8.7
[root@boanhack cmake-2.8.7]# ./bootstrap
[root@boanhack cmake-2.8.7]# make && make install

*libmcrypt 설치
[root@boanhack src]# tar zxvf libmcrypt-2.5.8.tar.gz
[root@boanhack src]# cd libmcrypt-2.5.8
[root@boanhack libmcrypt-2.5.8]# ./configure --prefix=/usr/local

 


*mysql 설치


[root@boanhack src]# tar zxvf mysql-5.5.20.tar.gz
[root@boanhack src]# cd mysql-5.5.20
[root@boanhack mysql-5.5.20]# groupadd mysql
[root@boanhack mysql-5.5.20]# useradd -g mysql -s /bin/false mysql
[root@boanhack mysql-5.5.20]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/server/mysql \
-DMYSQL_DATADIR=/usr/local/server/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DCURSES_LIBRARY=/usr/lib/libncurses.so -DCURSES_INCLUDE_PATH=/usr/include \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT=3306
[root@boanhack mysql-5.5.20]# make && make install
[root@boanhack mysql-5.5.20]# cd /usr/local/server/mysql/
[root@boanhack mysql]# cp support-files/my-medium.cnf /etc/my.cnf
[root@boanhack mysql]# chown -R mysql.mysql /usr/local/server/mysql/data
[root@boanhack mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/server/mysql/data
[root@boanhack mysql]# ln -s /tmp/mysql.sock /usr/local/server/mysql.socket
[root@boanhack mysql]# chown -R mysql:mysql /usr/local/server/mysql/data
[root@boanhack mysql]# /usr/local/server/mysql/bin/mysqld_safe &
[root@boanhack mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@boanhack mysql]# chkconfig --add mysqld
[root@boanhack mysql]# /usr/local/server/mysql/bin/mysqladmin -u root password mysql
[root@boanhack mysql]#  /usr/local/server/mysql/bin/mysql -uroot -pmysql
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

 


*bison (mysql 설치할 때 bison error 발생 시)

 

[root@boanhack src]# tar zxvf bison-3.0.tar.gz
[root@boanhack src]# cd bison-3.0
[root@boanhack bison-3.0]# ./configure
[root@boanhack bison-3.0]# make && make install

 


*apr 설치


[root@boanhack src]# tar zxvf apr-1.4.6.tar.gz
[root@boanhack src]# cd apr-1.4.6
[root@boanhack apr-1.4.6]# ./configure --prefix=/usr/local/server/apr
[root@boanhack apr-1.4.6]# make && make install

 

 

*apr-util


[root@boanhack src]# tar zxvf apr-util-1.4.1.tar.gz
[root@boanhack src]# cd apr-util-1.4.1
[root@boanhack apr-util-1.4.1]# ./configure --prefix=/usr/local/server/apr-util --with-apr=/usr/local/server/apr
[root@boanhack apr-util-1.4.1]# make && make install

 

 

*pcre 설치


[root@boanhack src]# tar zxvf pcre-8.33.tar.gz
[root@boanhack src]# cd pcre-8.33
[root@boanhack pcre-8.33]# rpm -e --nodeps pcre-7.8-6.el6.i686
[root@boanhack pcre-8.33]# ./configure
[root@boanhack pcre-8.33]# make && make install
[root@boanhack pcre-8.33]# ln -s /usr/local/lib/libpcre.so.1.2.1 /lib/libpcre.so.0

 

*openssl 설치


[root@boanhack src]# tar zxvf openssl-1.0.1e.tar.gz
[root@boanhack src]# cd openssl-1.0.1e
[root@boanhack openssl-1.0.1e]# rpm -e --nodeps openssl-1.0.0-27.el6.i686
[root@boanhack openssl-1.0.1e]# patch -Np1 -i openssl-1.0.1e-fix_parallel_build-1.patch
[root@boanhack openssl-1.0.1e]# patch -Np1 -i openssl-1.0.1e-fix_pod_syntax-1.patch
[root@boanhack openssl-1.0.1e]# ./config --prefix=/usr --libdir=lib shared zlib-dynamic
[root@boanhack openssl-1.0.1e]# make && make install
[root@boanhack openssl-1.0.1e]# ln -s /usr/lib/libssl.so.1.0.0 /lib/libssl.so.10
[root@boanhack openssl-1.0.1e]# ln -s /usr/lib/libcrypto.so.1.0.0 /lib/libcrypto.so.10

 

 


*apache 설치


[root@boanhack src]# tar zxvf httpd-2.2.25.tar.gz
[root@boanhack src]# cd httpd-2.2.25
[root@boanhack httpd-2.2.25]# vi server/mpm/prefork/prefork.c
#ifndef MAX_SERVER_LIMIT
#define MAX_SERVER_LIMIT 200000

 

prefork.c를 나중에 MaxClient 값 수정할 때 문제가 되기에 미리 어느 정도 높은 값으로 설정해 주자

MPM worker 모드로 운영하더라고 최대 접속은 이 값을 따르는 것 같다.


[root@boanhack httpd-2.2.25]# ./configure --prefix=/usr/local/server/apache --enable-rule=SHARED_CORE \
--enable-so --enable-rewrite --enable-vhost-alias --enable-ssl --enable-proxy --enable-shared=max \
--enable-modules=shared --enable-mods-shared=all --with-apr=/usr/local/server/apr \
--with-apr-util=/usr/local/server/apr-util --with-mpm=prefork
[root@boanhack httpd-2.2.25]# make && make install
[root@boanhack httpd-2.2.25]# cp /usr/local/server/apache/bin/apachectl /etc/init.d/httpd
[root@boanhack httpd-2.2.25]# vi /etc/init.d/httpd
#chkconfig: 2345 90 20
#description: init file for Apache server daemon
#processname: /usr/local/server/apache/bin/apachectl
#config: /usr/local/server/apache/conf/httpd.conf
#pidfile: /usr/local/server/apache/logs/httpd.pid

[root@boanhack httpd-2.2.25]# chkconfig --add httpd

 


*php 설치


[root@boanhack src]# tar zxvf php-5.3.10.tar.gz
[root@boanhack src]# cd php-5.3.10
[root@boanhack php-5.3.10]# ./configure --with-apxs2=/usr/local/server/apache/bin/apxs \
--with-mysql=/usr/local/server/mysql --with-mysqli=/usr/local/server/mysql/bin/mysql_config \
--enable-sockets --with-zlib=/usr/local --with-gd=/usr/local --with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local --with-freetype-dir=/usr/local --with-mcrypt=/usr/local --enable-mbstring
[root@boanhack php-5.3.10]# make && make install
[root@boanhack php-5.3.10]# vi /usr/local/server/apache/conf/httpd.conf
AddType application/x-httpd-php .php .html
LoadModule php5_module        modules/libphp5.so
[root@boanhack php-5.3.10]# cp php.ini-production /usr/local/lib/php.ini
[root@boanhack php-5.3.10]# vi /usr/local/lib/php.ini
date.timezone = 'Asia/Seoul'

 

 

*php ZendGuardLoader 설치 (php 가속기)


[root@boanhack src]# tar zxvf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
[root@boanhack src]# cd ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x
[root@boanhack php-5.3.x]# cp ZendGuardLoader.so /usr/local/lib/php
[root@boanhack php-5.3.x]# vi /usr/local/lib/php.ini

....
[Zend]
zend_extension=/usr/local/lib/php/ZendGuardLoader.so
zend_loader.enable = 1
zend_loader.disable_licensing = 0
zend_loader.obfuscation_level_support = 3

....

[root@boanhack php-5.3.x]# service httpd restart

[root@boanhack php-5.3.x]# php -i | grep Zend

Zend Extension => 220090626
Zend Extension Build => API220090626,NTS
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
Zend Guard Loader
Zend Guard Loader => enabled

 

 

ZendGuardLoader를 설치하기 위해서는 아파치 MPM이 prefork로 운영되어야 함.(worker 지원 안 함)

php 5.3 이 후 버전부터는 ZendOptimizer을 지원하지 않음

 


*autoconf 설치


[root@boanhack src]# tar zxvf autoconf-2.69.tar.gz
[root@boanhack src]# cd autoconf-2.69
[root@boanhack autoconf-2.69]# ./configure
[root@boanhack autoconf-2.69]# make && make install

 

 


*php screw 설치 (php 소스코드 암호화)

[root@boanhack src]# tar zxvf php_screw-1.5.tar.gz
[root@boanhack src]# cd php_screw-1.5
[root@boanhack php_screw-1.5]# phpize
[root@boanhack php_screw-1.5]# ./configure

[root@boanhack php_screw-1.5]# make
[root@boanhack php_screw-1.5]# cp modules/php_screw.so /usr/local/lib/php
[root@boanhack php_screw-1.5]# vi /usr/local/lib/php.ini

....
extension=/usr/local/lib/php/php_screw.so

....

 

[root@boanhack php_screw-1.5]# service httpd restart

[root@boanhack php_screw-1.5]# php -i | grep screw

php_screw
php_screw support => enabled
PWD => /usr/local/server/src/php_screw-1.5
_SERVER["PWD"] => /usr/local/server/src/php_screw-1.5

 

 

 

 

 


[root@boanhack php_screw-1.5]# cd tools
[root@boanhack tools]# make
[root@boanhack tools]# cp screw /usr/local/bin

[root@boanhack tools]# cd /usr/local/server/apache/htdocs

[root@boanhack htdocs]# screw index.php

 

screw 를 통해 암호화 시 원본은 .screw 확장자로 바뀐다.

서버 이전을 대비해서 암호화 키 값은 저장해 둔다. (복호화하기 힘들다는 말이 있다....)

암호화 키는 소스 폴더 내 my_screw.h 파일에 있다.

 

[root@boanhack php_screw-1.5]# vi my_screw.h
short pm9screw_mycryptkey[] = {
  11152, 368, 192, 1281, 62
};

 

phpize 실행 시 autoconf 관련 메시지 나오면 autoconf 설치하고 그 외에는 무시...

php_screw를 수정해서 올려 놓은 사이트가 있기는 했지만 결과적으로 설치 실채..

그냥 에러 난 거 삭제하고 설치하는게 좋은 듯..

php_screw make 실 에러메시지 발생하면 php_screw.c 파일을 열어서 해당 라인을 삭제한 후 make...

 

 


*mod_url (아파치 한글 파일명 지원)

[root@boanhack src]# tar jxvf mod_url-apache2-1.16.tar.bz2
[root@boanhack src]# cd mod_url-apache2
[root@boanhack mod_url-apache2]# /usr/local/server/apache/bin/apxs -iac mod_url.c
[root@boanhack mod_url-apache2]# vi /usr/local/server/apache/conf/httpd.conf

....
LoadModule redurl_module      modules/mod_url.so

....
<IfModule mod_url.c>
    CheckURL On
</IfModule>
[root@boanhack mod_url-apache2]# service httpd restart

....

 

*mod_security 설치

 

[root@boanhack src]# tar zxvf modsecurity-apache_2.7.5.tar.gz

[root@boanhack src]# tar zxvf lua-5.2.2.tar.gz

 

'Study > System' 카테고리의 다른 글

syslog-ng on Centos 6.4  (0) 2013.11.14
GCC Version Upgrade(v4.8.2)  (0) 2013.11.14
openssh v6.4p1 설치  (0) 2013.11.11
openssl v1.0.1.e 설치  (0) 2013.11.11
xz file extension  (0) 2013.11.11
댓글