Programming & Tools/Linux2009. 8. 5. 13:44

1. 설치 Software.
Aphache, PHP, MySQL

2. 구버전 제거.

RPM을 통해 이미 설치가 되어 있다면 삭제한다.
$> rpm -qa httpd php mysql   // 설치가 되어 있는지 확인
httpd-2.2.3-11.el5_1.centos.3
mysql-5.0.45-7.el5
php-5.1.6-20.el5_2.1

$> yum remove httpd php mysql –y  // RPM으로 설치된 APM 삭제

3. Service Daemon 중지.

httpd, mysqld 가 실행 중이라면, 중지 시킨다.
$> service httpd stop
$> service mysqld stop

4. 기타 라이브러리 설치.

APM을 설치하기 전에 APM설치에 필요한 기타 라이브러리를 설치한다.
$> yum install zlib libxml2 curl libjpeg libpng freetype gd gcc flex -y

5. APM Source를 다운로드.

각각의 소스를 다운 받는다. (httpd-2.2.9.tar.gz, mysql-5.0.67.tar.gz, php-5.3.0.tar.gz, php-5.2.10.tar.gz)
$> mkdir /usr/local/src/APM
$> cd /usr/local/src/APM
$> tar -xzvf httpd-2.2.9.tar.gz
$> tar -xzvf mysql-5.0.67.tar.gz
$> tar -xzvf php-5.3.0.tar.gz  // 5.3.0은 ZeroboardXe XpressEngine 1.2.4 설치 후 FTP설정에서 Error가 난다.
$> tar -xzvf php-5.2.10.tar.gz


6. 설치 할 디렉토리 생성.

$ mkdir /usr/local/APM
$ mkdir /usr/local/APM/mysql
$ mkdir /usr/local/APM/apache
$ mkdir /usr/local/APM/php

7. MySQL 설치.

가. Install
$> cd /usr/local/src/APM/mysql-5.0.67
$> ./configure --prefix=/usr/local/APM/mysql --with-client-Idflags=-all-static --with-mysqld-Idflags=-all-static --with-charset=euckr --without-debug --enable-assembler --with-mysqld-user=mysql --enable-thread-safe-client --with-extra-charsets=all
 * --enable-thread-safe-client 옵션은 PHP와 같아야 한다.
$> make
$> make install

나. 환경 설정

MySQL의 환경 설정은 /etc/my.cnf 에 설정이 되어 있다. MySQL에서는 컴퓨터의 사양에 따라 설정해놓은 예제파일이 /usr/local/src/APM/mysql-5.0.67/support-files 에 있다.

$> cp /usr/local/src/APM/mysql-5.0.67/support-files/my-medium.cnf /etc/my.cnf  //컴퓨터 사양이 괜찮다면, my-huge.cnf를 복사한다. 
$> /usr/local/APM/mysql/bin/mysql_install_db --user=mysql

a) 권한 설정.
$> chown -R root /usr/local/APM/mysql   // 권한을 바꿔 줘야 한다.
$> chown -R mysql /usr/local/APM/mysql/var
$> chgrp -R mysql /usr/local/APM/mysql

b) 라이브러리 설정.
$> vi /etc/ld.so.conf.d/mysql.conf  // MySQL Shared Library를 사용하기 위해서 생성.
   /usr/local/APM/mysql/lib/mysql  // 설치된 디렉토리위치를 입력.
        :wq
 
$> ldconfig // Shared Library를 다시 로딩한다.
$> cp /usr/local/APM/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
$> cd /etc/rc.d/init.d
$> chmod 755 mysqld
$> /etc/rc.d/init.d/mysqld start  // MySQL Daemon을 실행한다.
#####] starting MySQL        [OK]

c) 런 레벨 설정.
$> chkconfig --level 2345 mysqld on  //실행 옵션 및 런 레벨을 설정한다.
$> chkconfig --list | grep mysqld  // 2.3.4.5 레벨이 활성화 되었는지 확인한다.
$> ./mysqld restart // MySQL Daemon을 다시 실행한다.

d) DB 생성.
$> cd /usr/local/APM/mysql/bin
$> ./mysqladmin -u root password 패스워드  // 패스워드자리에 원하는 패스워드 설정.
$> mysql -u root –p
Enter password: ****
mysql> CREATE DATABASE DB명 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; // DB명에 원하는 데이터 베이스 이름을 입력한다.
mysql> GRANT ALL PRIVILEGES ON DB명.* TO root@localhost  IDENTIFIED BY '패스워드'; // DB 명에 위에서 생성한 DB명을 입력하고 패스워드자리에 설정할 패스워드를 입력한다.

8. Apache 설치.

가. Install
$> cd /usr/local/src/APM/httpd-2.2.9
$> ./configure --prefix=/usr/local/APM/apache --enable-proxy --enable-rewrite --enable-so --enable-speling --enable-ssl --enable-vhost-alias --with-mpm=worker --enable-mods-shared=all --enable-deflate

$> make
$> make install

a) configure file 수정
$> cd /usr/local/APM/apache/conf
$> vi httpd.conf

  DirectoryIndex index.html index.php index.htm //  index.php index.htm 추가

  AddType application/x-compress .Z // 없으면 추가
  AddType application/x-gzip .gz .tgz // 없으면 추가

  AddType application/x-httpd-php .htm .html .php .ph php3 .php4 .phtml .inc  //추가
  AddType application/x-httpd-php-source .phps //추가

나. 자동 실행 런 레벨 설정.
$> /etc/rc.d/init.d/httpd start  // Apache Daemon을 실행한다.
$> chkconfig --level 2345 httpd on  //실행 옵션 및 런 레벨을 설정한다.
$> chkconfig --list | grep httpd  // 2.3.4.5 레벨이 활성화 되었는지 확인한다.
$> ./httpd restart // Apache Daemon을 다시 실행한다.

9. PHP 설치.

가. Install
$> cd /usr/local/src/APM/php-5.2.10
$> ./configure --prefix=/usr/local/APM/php --with-apxs2=/usr/local/APM/apache/bin/apxs --with-zlib-dir --with-gd --with-png-dir --with-gmp --with-libxml-dir=/usr/lib --with-xsl  --disable-debug --disable-rpath --with-iconv --enable-magic-quotes --enable-bcmath --enable-gd-native-ttf --enable-sysvsem --enable-sysvshm --enable-wddx --with-pic --enable-inline-optimization --enable-mbstring --enable-ftp --disable-debug --with-jpeg-dir --with-freetype-dir --enable-gd-native-ttf --enable-exif --with-mysql=/usr/local/APM/mysql --with-mysqli=/usr/local/APM/mysql/bin/mysql_config --enable-sockets --enable-sigchild --without-pear

* --without-pear 옵션을 주지 않으면, 특정 라인을 처리 할 수 없다고 나온다. PHP Bug

$> make
$> make install
$> cp /usr/local/APM/php/bin/php /usr/bin
$> php -v //  버전 확인

10. Trouble Shooting
가. Q : 제로보드 XE설치시 FTP정보 입력에서 더이상 진행이 안될때.
     A : PHP 라이브러리 컴파일 시 --enable-safe-mode 옵션을 주지 않고 컴파일 한다.

Posted by 다크쌍피