ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • APM 소스 컴파일 설치
    컴퓨터 2008. 12. 21. 20:46
    다음 본문은 디지문닷넷 블로그 (http://www.digimoon.net/blog/257) 에서 퍼온 것임을 밝힙니다.


    OS : Fedora Core 4, CentOS 5.0
    MySql 4.1.18  http://ftp.superuser.co.kr/pub/mysql/mysql-4.1.18.tar.gz
    Apache 2.0.55  http://ftp.superuser.co.kr/pub/apache/httpd-2.0.55.tar.gz
    PHP 4.4.2  http://ftp.superuser.co.kr/pub/php/php-4.4.2.tar.gz
    Zend-Optimizer 3.0.1 http://ftp.superuser.co.kr/pub/ZendOptimizer/ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz

    Zend Optimizer의 경우는 php 버전에 따라 설치해야 할 버전도 달라진다. Zend 홈페이지에서 상황에 맞게 알맞은 버전을 받아 설치한다. 홈페이지 가입부터 먼저 해야 한다. 참고로 php 5.x 버전 이상이면 Zend는 3.2.x 이상 버전으로 설치한다. 그냥 최신 버전으로 받아 설치하면 될 것이다.
    http://www.zend.com/en/products/guard/downloads



    어떤 패키지든지 소스컴파일 설치에 들어가기에 전에 서버 시간을 타임서버와 필히 동기화해둔다. 안 그러면 컴파일을 하고 난 뒤 끝에 아래와 같은 에러메시지를 띄우며
    make: warning:  Clock skew detected.  Your build may be incomplete.

    make install 명령어를 내리면 컴파일 과정이 계속 무한 반복되는 등의 오류를 낸다. 다른 종류의 오류가 더 있는지는 잘 모르겠다.
    타임서버와 동기화하는 명령어는 아래와 같다. 타임서버 주소는 다른 걸로 해도 상관 없다.
    # /usr/bin/rdate -s time.bora.net

    VMWare에서 가상 리눅스를 구동해서 실습할 경우엔 저렇게 동기화를 해 두어도 시간이 지날수록 타임서버의 시간과 점점 어긋나는 현상이 생긴다. cron 설정으로 수시로 타임서버와 동기화할 수 있도록 설정해 두는 것이 여러모로 속 편하다.

    /etc/crontab 파일에 아래 행을 하나 추가해 주도록 한다. 5분 간격으로 매번 동기화하도록 하는 것이다.
    */5 * * * * root /usr/sbin/rdate -s time.bora.net

    고쳤으면 crond 데몬을 재시작하는 것도 잊지 말자.
    # /etc/init.d/crond restart

    아예 시스템이 처음 시작될 때부터 타임서버와 시간을 동기화시키도록 하는 것도 좋다.
    /etc/rc.d/rc.local 파일을 편집기로 열어서 아래의 내용을 한 줄 추가한다.
    /usr/bin/rdate -s time.bora.net

    APM 설치에 들어가기에 앞서 잔존하는 APM 관련 패키지들부터 말끔하게 지우고 시작하자.
    # yum -y remove http* mysql* php*



    1. MySQL 설치

    # ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-charset=euckr --with-mysql-user=mysql --with-extra-charsets=all --enable-thread-safe-client


    아래와 같은 에러메시지가 나오는 경우가 있다.

    1. checking for termcap functions library... configure: error: No curses/termcap library found

    이는 아래 명령어로 해결된다.
    # yum -y install ncurses-devel


    2. configure: error: C++ preprocessor "/lib/cpp" fails sanity check

    그 이유는

    gcc-c++
    glibdc-devel
    위 두 개의 패키지가 없어서 그런 것이므로

    # yum -y install gcc-c++
     (의존성으로 인해 알아서 glibdc-devel 도 설치된다. 안되면 따로 설치)

    그리고 --with-charset=euckr 옵션의 경우 MySQL 4.0.x 이하 버전의 경우는 euc_kr, 그 이상은 euckr로 한다. 이거 중요함. utf-8로 설치시엔 --with-charset=utf8 로 한다.
    MySQL has a Web site at http://www.mysql.com/ which carries details on the
    latest release, upcoming features, and other information to make your
    work or play with MySQL more productive. There you can also find
    information about mailing lists for MySQL discussion. Remember to check the platform specific part of the reference manual for
    hints about installing MySQL on your platform. Also have a look at the
    files in the Docs directory. Thank you for choosing MySQL!


    위와 같은 메시지가 마지막에 나오면 이제 컴파일하면 된다.
    # make
    # make install
    # cp /usr/local/mysql/share/mysql/my-large.cnf /etc/my.cnf   -> 덮어 씌우겠냐는 물음이 나오면 'y'
    # /usr/local/mysql/bin/mysql_install_db
    # groupadd -g 27 mysql
    # useradd -u 27 -g 27 -M mysql
    # chown -R mysql.mysql /usr/local/mysql/data
    # /usr/local/mysql/bin/mysqld_safe &
    # /usr/local/mysql/bin/mysqladmin -u root password [비밀번호] <- root 비밀번호 설정

    mysql_install_db 명령어를 실행할 때 에러가 발생한다면 아래 링크를 참고한다.
    http://www.digimoon.net/blog/302



    시스템을 시작할 때마다 mysqld 데몬을 자동으로 올라오게 하려면 아래와 같이 작업해 준다.
    # cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
    # chkconfig --add mysqld
    # chkconfig --level 3 mysqld on

     
     

    2. Apache 설치


    64비트 버전에서 아파치를 설치하기 전에 먼저 해 주어야 할 작업이 있다.
    make 명령어로 컴파일 시 아래와 같은 에러 메시지를 내기 때문에 해주어야 하는 작업이다.
     /usr/lib/libdb-4.3.so: could not read symbols: File in wrong format

    /usr/lib/libexpat.so: could not read symbols: File in wrong format

    에러의 원인은 64비트 환경에서 32비트용 소스를 가져다가 설치하기 때문이다. 컴파일 도구와 관련된 심볼릭 링크 파일을 찾지 못한다고 나오고 있다. 아래와 같이 해결한다.
    # mv /usr/lib/libexpat.so /usr/lib/libexpat.so.bak
    # ln -s /lib64/libexpat.so.0.5.0 /usr/lib/libexpat.so 
    # mv /usr/lib/libdb-4.3.so /usr/lib/libdb-4.3.so.bak
    # ln -s /lib64/libdb-4.3.so /usr/lib/libdb-4.3.so

    위 작업의 내역은 간단하다. 소스 설치 시 컴파일 개발 도구로 /usr/lib/libexpat.so, /usr/lib/libdb-4.3.so 이 두 파일을 이용하는데 이들을 없애고 /lib64 디렉토리에 있는 동일한 이름의 개발도구 파일들을 /usr/lib 디렉토리로 심볼릭링크로 땡겨와서 사용하기 위해 하는 작업이다.



    이렇게 사전 작업이 끝났으면 이제 본격적으로 아파치 설치에 들어가면 된다. 32비트에서는 위 작업 필요없이 바로 설치에 들어간다.
    # ./configure --prefix=/usr/local/apache --enable-modules=so --enable-ssl --with-mpm=worker
    # make
    # make install

     
    시스템을 시작할 떄마다 apache 데몬이 자동으로 올라오게 하려면 아래와 같이 작업해 준다.
    # echo "--- /etc/rc.d/init.d/apachectl ---" >> /usr/local/apache/bin/apachectl
    # echo "# chkconfig: - 92 92 " >> /usr/local/apache/bin/apachectl
    # echo "# description: Apache Web Server Version : 2.0.55 " >> /usr/local/apache/bin/apachectl
    # cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/
    # chkconfig --add apachectl
    # chkconfig --level 3 apachectl on




    3. PHP 설치

    컴파일 환경설정을 하기 전에 에러메시지에 대비해서 미리 깔아두어야 할 라이브러리부터 깔아 놓자. PHP의 경우는 아래와 같이 선행되어 깔려 있어야 할 라이브러리가 여럿 된다.

    zlib, libpng, freetype, jpeg, gd, libxml2

    # yum -y install flex*


    zlib 추가 - zlib은 yum 업데이트로 쉽게 해결된다.
    # yum -y install zlib-devel*


    나머지 패키지들도 같은 방법으로 yum 업데이트 설치를 해도 된다.
    안 될 경우에는 아래의 소스 설치법을 따라 하도록 한다.

    libpng 추가
    # wget http://ftp.superuser.co.kr/pub/tools/libpng-1.0.8.tar.gz
    # tar xvfz libpng-1.0.8.tar.gz
    # cd libpng-1.0.8
    # cp scripts/makefile.linux makefile
    # make test
    # make install


    freetype 추가
    # wget http://download.savannah.gnu.org/releases/freetype/freetype-2.2.1.tar.gz
    # tar xvfz freetype-2.2.1.tar.gz
    # cd freetype-2.2.1
    # ./configure && make && make install


    jpeg 추가
    # wget http://graphics.cs.uni-sb.de/NMM/Download/external/jpegsrc.v6b.tar.gz
    # tar xvfz jpegsrc.v6b.tar.gz
    # cd jpeg-6b
    # ./configure --enable-shared --enable-static
    # make
    # mkdir -p /usr/local/man/man1
    # make install

    64비트에서 jpegsrc를 설치하다 보면 make 시 에러가 난다. 해결법은 아래 링크 참고 바람.
    http://blog.naver.com/uzoogom?Redirect=Log&logNo=130028904929


    gd 추가
    # yum -y install gd*


    libxml2 추가
    # yum -y install libxml2*


    OS가 CentOS 5.x 이상 버전이라면 일일이 소스를 받아 설치할 필요 없이 아래 커맨드로 php 설치에 필요한 라이브러리를 간편하게 설치하도록 한다. yum 으로 한꺼번에 설치하는 방법이다.
    # yum -y install openssl openssl-devel mhash mhash-devel libtool libtool-ltdl libtool-ltdl-devel imap-devel imap zlib-devel zlib freetype-devel freetype libpng-devel libpng libjpeg-devel libjpeg libtiff-devel libtiff gd-devel gd pcre-devel pcre libxml-devel libxml libxml2-devel libxml2 gdbm-devel gdbm ncurses-devel ncurses curl-devel curl expat-devel expat bzip2-devel bzip2-libs bzip2 uw-imap-devel libc-client libc-client-devel libmcrypt libmcrypt-devel


    이제 본격적으로 설치 작업에 들어가면 된다.
    # ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-mod-charset --enable-safe-mode --enable-sigchild --enable-magic-quotes --with-libxml-dir --with-openssl --with-zlib --with-zlib-dir --with-bz2 --enable-calendar --with-curl --enable-dba --with-gdbm --enable-exif --enable-ftp --with-gd --with-jpeg-dir --with-png-dir  --with-ttf --with-freetype-dir --enable-gd-native-ttf --with-gettext --with-imap --with-imap-ssl --with-kerberos --enable-mbstring --with-mhash --with-mcrypt --with-mysql=/usr/local/mysql --enable-sockets --with-regex=php --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-zend-multibyte


    아래와 같은 에러메시지가 나오는 경우가 있다.
    configure: error: Unable to locate gmp.h

    gmp 관련 패키지를 설치해주면 해결된다. yum 으로 쉽게 해결한다.
    # yum -y install gmp*

    아래와 같은 에러메시지는 expat 관련 패키지를 설치해주면 해결된다.
    configure: error: not found. Please reinstall the expat distribution.

    # yum -y install expat*


    아래와 같은 메시지가 나오면 컴파일할 준비가 완료된 상태임을 뜻한다.
    +--------------------------------------------------------------------+
    |                          *** NOTE ***                              |
    |            The default for register_globals is now OFF!            |
    |                                                                    |
    | If your application relies on register_globals being ON, you       |
    | should explicitly set it to on in your php.ini file.               |
    | Note that you are strongly encouraged to read                      |
    | http://www.php.net/manual/en/security.globals.php                  |
    | about the implications of having register_globals set to on, and   |
    | avoid using it if possible.                                        |
    +--------------------------------------------------------------------+

    # make
    # make install
    # cp php.ini-dist /usr/local/lib/php.ini
    # ln -s /usr/local/lib/php.ini /usr/local/php/lib/php.ini


    그 다음 웹페이지 상에서 php코드를 해석할 수 있게 /usr/local/apache/conf/httpd.conf 파일을 수정해 주어야 한다.
    837, 838행을 보면 아래와 같이 되어 있다.
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    아래와 같이 내용을 추가/수정해 준다.
    AddType application/x-compress .Z
    AddType application/x-httpd-php .htm .html .php .ph php3 .php4 .phtml .inc
    AddType application/x-httpd-php-source .phps
    AddType application/x-gzip .gz .tgz



    4. Zend Optimizer

    ./install.sh


Designed by Tistory.