APM 구축(RHEL 4 환경, 소스 컴파일)
1. 다운로드 사이트
Apache – http://httpd.apache.org
Php – http://www.php.net/
Mysql – http://dev.mysql.com/downloads/mysql/
Zend : http://www.zend.com/en/products/guard/downloads
2. 필요 라이브러리 확인
# rpm -qa libjpeg* libpng* freetype* gd-*
libpng10-1.0.16-1
freetype-devel-2.1.9-1
libpng10-devel-1.0.16-1
libjpeg-6b-33
libpng-devel-1.2.7-1.el4.2
libpng-1.2.7-1.el4.2
libjpeg-devel-6b-33
gd-devel-2.0.28-4.4E.1
freetype-2.1.9-1
대부분 설치되어 있을 거지만, 만일 위 라이브러리가 설치 되어있지 않다면 별도로 설치한다.libpng10-1.0.16-1
freetype-devel-2.1.9-1
libpng10-devel-1.0.16-1
libjpeg-6b-33
libpng-devel-1.2.7-1.el4.2
libpng-1.2.7-1.el4.2
libjpeg-devel-6b-33
gd-devel-2.0.28-4.4E.1
freetype-2.1.9-1
위 라이브러리는 php가 이미지를 처리할 때 사용하는 라이브러리들이다.
3.mysql 설치 (mysql-5.1.60)
# cd /usr/local/src
# wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.60.tar.gz/from/http://mirror.khlug.org/mysql/
파일 다운로드
# tar xvfz mysql-5.1.60.tar.gz
압축풀기
# cd mysql-5.1.60
# ./configure –prefix=/usr/local/mysql –localstatedir=/var/mysql –with-charset=utf8
설치디렉토리 지정, DB data 파일 위치 지정, 문자세트 지정
# make && make install
컴파일 및 설치
# wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.60.tar.gz/from/http://mirror.khlug.org/mysql/
파일 다운로드
# tar xvfz mysql-5.1.60.tar.gz
압축풀기
# cd mysql-5.1.60
# ./configure –prefix=/usr/local/mysql –localstatedir=/var/mysql –with-charset=utf8
설치디렉토리 지정, DB data 파일 위치 지정, 문자세트 지정
# make && make install
컴파일 및 설치
# cp /usr/local/src/mysql-5.1.60/support-files/my-large.cnf /etc/my.cnf
환경설정 파일 복사
# /usr/local/mysql/bin/mysql_install_db
초기 데이터베이스 생성(mysql, test)
# groupadd mysql
mysql 그룹생성
# useradd -M -d /usr/local/mysql -g mysql -s /bin/false -r mysql
mysql 사용자 생성, 로그인 불가, 홈디렉토리 없음, 쉘 없음
# chown -R mysql.mysql /var/mysql
DB data 디렉토리 소유권 변경
# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
# chkconfig –add mysqld
# chkconfig –list | grep mysqld
자동 실행 서비스 등록 및 등록여부 확인
환경설정 파일 복사
# /usr/local/mysql/bin/mysql_install_db
초기 데이터베이스 생성(mysql, test)
# groupadd mysql
mysql 그룹생성
# useradd -M -d /usr/local/mysql -g mysql -s /bin/false -r mysql
mysql 사용자 생성, 로그인 불가, 홈디렉토리 없음, 쉘 없음
# chown -R mysql.mysql /var/mysql
DB data 디렉토리 소유권 변경
# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
# chkconfig –add mysqld
# chkconfig –list | grep mysqld
자동 실행 서비스 등록 및 등록여부 확인
root의 환경설정 파일에 mysql 경로를 등록해 준다
# vi /root/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
mysql 을 시작하고 root 패스워드를 입력한다.
# /etc/init.d/mysqld start
# mysqladmin -u root password 패스워드
# mysqladmin -u root password 패스워드
4. apache 설치
# cd /usr/local/src
# wget http://apache.mirror.cdnetworks.com//httpd/httpd-2.2.21.tar.gz
파일 다운로드
# tar xvfz httpd-2.2.21.tar.gz
압축 풀기
# cd httpd-2.2.21.tar.gz
# ./configure –prefix=/usr/local/httpd –enable-mods-shared=all –enable-so –enable-rewrite
아파치의 설치 경로 지정, 공유모듈 모두 활성화
# make && make install
# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
자동실행 서비스가 가능하도록 파일 복사
# wget http://apache.mirror.cdnetworks.com//httpd/httpd-2.2.21.tar.gz
파일 다운로드
# tar xvfz httpd-2.2.21.tar.gz
압축 풀기
# cd httpd-2.2.21.tar.gz
# ./configure –prefix=/usr/local/httpd –enable-mods-shared=all –enable-so –enable-rewrite
아파치의 설치 경로 지정, 공유모듈 모두 활성화
# make && make install
# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
자동실행 서비스가 가능하도록 파일 복사
방금 복사한 /etc/init.d/httpd 파일의 맨 아래에 아래 내용 입력
# vi /etc/init.d/httpd
# chkconfig: 2345 90 90
# description: init file for Apache server
# processname: /usr/local/httpd/bin/apachectl
# config: /usr/local/httpd/conf/httpd.conf
# pidfile: /usr/local/httpd/logs/httpd.pid
※ 주의 : # 표시도 입력하며, 공백에 유의한다# description: init file for Apache server
# processname: /usr/local/httpd/bin/apachectl
# config: /usr/local/httpd/conf/httpd.conf
# pidfile: /usr/local/httpd/logs/httpd.pid
# chkconfig –add httpd
# chkconfig –list | grep httpd
자동실행 서비스에 등록하고 등록여부를 확인
# chkconfig –list | grep httpd
자동실행 서비스에 등록하고 등록여부를 확인
아래와 같이 환경을 설정한다.
# vi /usr/local/httpd/conf/httpd.conf
User nobody
Group nobody
daemon 으로 되었는 소유권을 nobody 로 변경한다Group nobody
정상적으로 작동하는 지 테스트 해본다
# /etc/init.d/httpd start
5. php 설치
# cd /usr/local/src
# wget http://kr.php.net/get/php-5.3.8.tar.bz2/from/this/mirror
파일 다운로드
# tar xvfj php-5.3.8.tar.bz2
압축풀기
# cd php-5.3.8
# ./configure \
–prefix=/usr/local/php \
–with-apxs2=/usr/local/httpd/bin/apxs \
–with-mysql=/usr/local/mysql \
–with-config-file-path=/usr/local/httpd/conf \
–disable-debug \
–with-iconv \
–with-gd \
–with-jpeg-dir \
–with-png-dir \
–with-libxml-dir \
–with-zlib \
–with-freetype-dir \
–with-gettext \
–with-openssl
php 설치 경로, 아파치 apxs 경로, mysql 경로, 아파치 conf 경로, 라이브러리 활성화 등의 설치 옵션을 결정한다# wget http://kr.php.net/get/php-5.3.8.tar.bz2/from/this/mirror
파일 다운로드
# tar xvfj php-5.3.8.tar.bz2
압축풀기
# cd php-5.3.8
# ./configure \
–prefix=/usr/local/php \
–with-apxs2=/usr/local/httpd/bin/apxs \
–with-mysql=/usr/local/mysql \
–with-config-file-path=/usr/local/httpd/conf \
–disable-debug \
–with-iconv \
–with-gd \
–with-jpeg-dir \
–with-png-dir \
–with-libxml-dir \
–with-zlib \
–with-freetype-dir \
–with-gettext \
–with-openssl
php.ini 파일을 복사한다.
# cp php.ini-production /usr/local/httpd/conf/php.ini
php.ini 파일을 아래처럼 수정한다
# vi /usr/local/httpd/conf/php.ini
short_open_tag = On
<? 를 사용 가능하게 해준다.(디폴트 설정은 <?php 만 가능하다)아파치의 httpd.conf 파일을 아래와 같이 수정한다
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
DirectoryIndex index.html index.htm index.php
</IfModule>
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
밑에 아래 2줄 추가
AddType application/x-httpd-php .php .htm .html .inc .php3 .php4 .php5
AddType application/x-httpd-php-source .phps
AddType application/x-gzip .gz .tgz
밑에 아래 2줄 추가
AddType application/x-httpd-php .php .htm .html .inc .php3 .php4 .php5
AddType application/x-httpd-php-source .phps
아파치를 재시동한다
# /etc/init.d/httpd restart
6. zend optimizer(zend guard loader) 설치
php 5.3.x 상위 버전에서는 zend optimizer 대신 zend guard loader 를 설치한다
zend optimizer 또는 zend guard loader는 사이트에 가입해서 다운받아야 한다.
[#M_파일받기|less..|8748829600.gz_M#]압축을 풀고 ZendGuardLoader.so 파일을 원하는 곳으로 복사 한후 php.ini 파일에 아래내용을 덧붙여 넣는다.
zend_extension= ZendGuardLoader.so 파일의 절대 경로
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
참고 : 위 내용을 덧붙일 때에는 아래와 같은 위치에 넣는다
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll
zend_extension=/usr/local/httpd/modules/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
아파치를 재시작하고, 아래처럼 index.php 파일을 만든다.
# /etc/init.d/httpd restart
# cd /usr/local/httpd/htdocs
# vi index.php
# cd /usr/local/httpd/htdocs
# vi index.php
index.php
<? phpinfo(); ?>
웹브라우저에 서버의 도메인명 또는 아이피주소를 입력 후에
아래와 같이 “with Zend Guard Loader v3.3” 라는 문구가 보이면 정상적으로 설치가 된 것이다.

최신 댓글