♧ 버전 정보
- os : centOS 5.3
- Apache 2.2.3
- Php 5.2.1
- Mysql 5.0.33
- ZendOptimizer 3.3.3
♧ APM이란?
- Apache + php + Mysql
Apache : 정적 파일의 웹 서비스를 담당하는 웹 서비스
Php : 웹 스크립트 언어
Mysql : 데이터베이스
[설치 전 작업]
OS 설치 이후 rpm으로 설치된 mysql 및 httpd을 검색
root@localhost# rpm –qa mysql
mysql-5.0.45-7.el5
root@localhost# rpm –qa httpd
httpd-2.2.3-22.el5.centos
검색된 mysql 및 httpd 삭제
root@localhost# rpm –e –-nodeps mysql-5.0.45
root@localhost# rpm –e –-nodeps httpd-2.2.3
삭제 후 위의 명령어(rpm -qa)를 이용하여 삭제여부를 확인
root@localhost# vi /etc/selinux/config
SELINUX=disabled 으로 수정
필요한 라이브러리 설치
root@localhost# yum –y install freetype* libjpeg* libpng* gd* libmcrypt*
root@localhost# yum –y install lrzsz*
[APM 설치 작업]
1. 설치 전 아래 경로로 이동하여 다운
root@localhost# cd /usr/local/src
root@src# ls –l
2. Tar 명령어를 이용하여 압축 해제
root@src# tar xvfz httpd-2.2.3.tar.gz
root@src# tar xvfz mysql-5.0.33.tar.gz
root@src# tar xvfz php-5.2.1.tar.gz
root@src# tar xvfz Zendoptimizer-3.3.3-linux-glibc23-i386.tar.gz
3. mysql부터 설치
root@src# cd mysql
root@mysql# ./configure --prefix=/usr/local/mysql-5.0.33 --localstatedir=/usr/local/mysql/var --with-charset=euckr
root@mysql# make && make install
root@mysql# ln –s /usr/local/mysql-5.0.33 /usr/local/mysql
root@mysql# useradd mysql –g daemon –u 60 –M –s /bin/false –c “mysql server user” –d /usr/local/mysql
root@mysql# /usr/local/mysql/bin/mysql_install_db
root@mysql# chown –R mysql.root /usr/local/mysql/var
root@mysql# /usr/local/mysql/bin/mysqld_safe &
4. Apache(httpd) 설치
root@src# cd apache
root@apache# vi server/mpm/prefork/prefork.c
#define DEFAULT_SERVER_LIMIT 2048 ← 여기를 수정
root@apache# vi server/mpm/worker/worker.c
#define DEFAULT_SERVER_LIMIT 128 ← 여기를 수정
root@apache# ./configure --prefix=/usr/local/httpd-2.2.3 --with-charset=euckr --enable-so --enable-ssl --with-ssl
root@apache# vi /usr/local/src/httpd-2.2.3/docs/conf/extra/httpd-mpm.conf
MaxClient 2048 ← 여기를 수정
root@apache# make && make install
root@apache# ln -s /usr/local/httpd-2.2.3 /usr/local/apache;
5. Php 설치
root@src# cd php
root@php# ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --with-mysql=/usr/local/mysql --with-zlib-dir=/usr/lib --with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-gif-dir=/usr/lib --with-gd --with-freetype --with-openssl --with-gettext --with-kerberos --with-mod_charset --with-language=korean --with-charset=euc_kr --with-regex=php --with-dbm --with-gdbm --with-ldap --with-xml --with-ttf --enable-module=so --enable-gd-native-ttf --enable-ftp --enable-sockets --disable-debug --enable-sysvsem --enable-sysvshm --enable-shmop --enable-track-vars --enable-freetype-4bit-antialias-hack --enable-calendar --enable-sigchild --enable-magic-quotes --enable-trans-sid --enable-inline-optimization --enable-bcmath --enable-mbstring=kr --enable-mbstr-enc-trans --enable-force-cgi-redirect
root@php# make && make install
root@php# cp php.ini-dist /usr/local/apache/conf/php.ini
root@localhost# vi /usr/local/apache/htdocs/info.php
<? Infophp(); ?>
6. Zend 설치
root@src# cd Zend
root@Zend# ./install
7. Httpd.conf 환경 설정
root@localhost# vi /usr/local/apache/conf/httpd.conf
ServerName localhost:80 또는 127.0.0.1:80 으로 수정
DocumentRoot "/usr/local/httpd-2.2.x/htdocs"
DirectoryIndex index.html index.htm index.php main.html 을 추가
LoadModule php5_module modules/libphp5.so 없으면 추가
AddType application/x-httpd-php .php .php4 .php5 .html .htm .inc
AddType application/x-httpd-php-source .phps
【추가사항】
가상 호스트를 추가하는 방법입니다.
root@localhost# vi /usr/local/apache/conf/httpd.conf
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
root@localhost# vi /usr/local/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin www@ksidc.net 설명
DocumentRoot /home/www 도메인의 홈디렉토리
ServerName ksidc.net 사용하는 도메인
ServerAlias www.ksidc.net 도메인 별칭
ErrorLog logs/dummy-host2.example.com-error_log 로그파일이 생성
CustomLog logs/dummy-host2.example.com-access_log common 로그파일이 생성
</VirtualHost>
8. 자동 실행 설정
root@localhost# vi /etc/rc.d/rc.local
/usr/local/apache/bin/apachectl start >&/dev/null
/usr/local/mysql/bin/mysqld_safe --user=mysql & >&/dev/null
9. PATH 설정
root@localhost# echo "/usr/local/apache/lib" >> /etc/ld.so.conf
root@localhost# echo "/usr/local/apache/modules" >> /etc/ld.so.conf
root@localhost# ldconfig
root@localhost# echo 'PATH=$PATH:/usr/local/php/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/apache/bin:/usr/local/mysql/bin' >> /etc/profile;
root@localhost# echo 'export PATH' >> /etc/profile;
【그 외 버전에 따른 컴파일 정보】
① Mysql
- 4.0 버전
./configure --prefix=/usr/local/mysql-4.0.x --localstatedir=/usr/local/mysql-4.0.x/var --with-charset=euc_kr --enable-assembler --without-readline
- 4.1 버전
./configure --prefix=/usr/local/mysql-4.1.x --localstatedir=/usr/local/mysql-4.1.x/var --with-charset=euckr –enable-assembler --without-readline
② Apache
- 1.3 버전
./configure --prefix=/usr/local/apache --enable-rule=SHARED_CORE --enable-module=so --enable-shared=max
- 2.0 버전
./configure --prefix=/usr/local/httpd-2.0.x --enable-ssl=static --with-ssl --with-mpm=prefork --enable-so --disable-ext-filter --enable-mods-shared=all
③ Php
- Php의 경우 apahce 버전에 따라 컴파일 옵션이 다릅니다.
- Apache 1.x.x 버전일 경우 --with-apxs
- Apache 2.x.x 버전일 경우 --with-apxs2