설치Apache 1.3.29 + PHP 4.3.4 + MySQL + GD + IMAP 등등 설치

  • authorbibaram
  • 07 November 2005, 14:11:33
아파치를 DSO 형태로 설치했습니다. 각각의 버전을 다운로드 받기 귀찮으신 분들을 위해 자료실에 모든 자료를 한곳에 모아놨습니다. 혹은 설치가 잘 안되시는 분들도 자료실의 자료를 참고하시기 바랍니다. 제 리눅스 배포판은 레드햇 9 입니다.

설치 하고자 하는 APM 버전은 apache_1.3.29, php_4.3.4, mysql-standard-4.0.17 입니다. 단, MySQL 설치는 별도의 강좌를 참고하기 바랍니다. 아파치 2.x 버전도 거의 동일한 방식으로 설치가 가능하니 참고 바랍니다.

편의상 경어는 생략하겠습니다.

1. RPM을 지운다  (다음중 자신에게 설치된 항목만 지우면 된다. )
우선 apache, mysql, php 관련 RPM을 모두 삭제한후.. 다음 항목을 참고하여.. 삭제한다.


shell>rpm -qa|grep apache 또는  rpm -qa|grep httpd
shell>rpm -qa|grep mysql 또는 rpm -qa|grep MySQL
shell>rpm -qa|grep php

rpm -e --nodeps zlib
rpm -e --nodeps zlib-devel
rpm -e --nodeps curl
rpm -e --nodeps curl-devel
rpm -e --nodeps freetype
rpm -e --nodeps freetype-devel
rpm -e --nodeps freetype-utils
rpm -e --nodeps gd
rpm -e --nodeps gd-devel
rpm -e --nodeps libjpeg
rpm -e --nodeps libjpeg-devel
rpm -e --nodeps mm
rpm -e --nodeps mm-devel
rpm -e --nodeps libpng
rpm -e --nodeps libpng-devel
rpm -e --nodeps libungif
rpm -e --nodeps libungif-devel
rpm -e --nodeps libtiff
rpm -e --nodeps libtiff-devel
rpm -e --nodeps imap


2. http://www.gzip.org/zlib/ 에서 zlib 을 다운 받는다.

3. zlib 설치


shell>tar -xvzf zlib-1.1.4.tar.gz
shell>cd zlib-1.1.4
shell>./configure -s // libz.so 동적모듈생성
shell>make
shell>./configure // libz.a 정적모듈생성
shell>make test
shell>make install

shell>cp libz.so* /usr/local/lib

shell>cd /usr/local/lib
shell>rm -rf libz.so
shell>rm -rf libz.so.1
shell>ln -s libz.so.1.1.4 libz.so
shell>ln -s libz.so.1.1.4 libz.so.1

shell>vi /etc/ld.so.conf
/usr/local/lib추가 // 라이브러리 경로 추가

shell>ldconfig // 라이브러리 경로 적용명령


4. http://curl.haxx.se/download.html 에서 curl 을 다운 받는다.

5. curl 설치


shell>tar -xvzf curl-7.11.0.tar.gz
shell>cd curl-7.11.0
shell>./configure
shell>make
shell>make install


6. http://sourceforge.net/project/showfiles.php?group_id=4286 에서 mhash의 최신 버전을 다운 받는다.

7. mhash 설치


shell>tar -xvzf mhash-0.8.18.tar.gz
shell>cd mhash-0.8.18
shell>./configure
shell>make
shell>make install


8. ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/  에서 libmcrypt의 최신 버전을 다운 받는다.

9. libmcrpyt 설치


shell>tar -xvzf libmcrypt-2.5.7.tar.gz
shell>cd libmcrypt-2.5.7
shell>./configure
shell>make
shell>make install


10. http://www.fastio.com 에서 clibpdf의 최신 버전을 다운 받는다.

11. clibpdf 설치


shell>tar xvzf clibpdf202r1.tar.gz
shell>cd ClibPDF
shell>cd source
shell>cp Makefile Makefile.orig
shell>cp Makefile.Linux Makefile
shell>make lib
shell>make install


12. ftp://ftp.sgi.com/sgi/graphics/grafica/flash 에서 swf의 최신 버전을 다운 받는다.

13. swf 설치


shell>tar -xvzf dist.99.linux.tar.Z
shell>mv dist /usr/local/swf
shell>cd /usr/local/swf
shell>cp swf.h include
shell>cp libswf.a lib


14. http://www.engelschall.com/sw/mm/ 에서 mm의 최신 버전을 다운 받는다.

15. mm 설치


shell>tar -xvzf mm-1.3.0.tar.gz
shell>cd mm-1.3.0
shell>./configure
shell>make
shell>make test
shell>make install


16. ftp://swrinde.nde.swri.edu/pub/png/src 에서 libpng의 최신 버전을 다운 받는다.

17. libpng 설치


shell>tar -xvzf libpng-1.2.5.tar.gz
shell>cd libpng-1.2.5
shell>cp scripts/makefile.linux Makefile
shell>make
shell>make test
shell>make install


18. http://prdownloads.sourceforge.net/freetype/freetype-2.1.5.tar.gz?download 에서 freetype 의 최신 버전을 다운 받는다.

19. freetype 설치


shell>tar -xvzf freetype-2.1.5.tar.gz
shell>cd freetype-2.1.5
shell>./configure
shell>make
shell>make install


20. ftp://ftp.uu.net/graphics/jpeg/ 에서 jpeg의 최신 버전을 다운 받는다.

21. jpeg 설치


shell>tar -xvzf jpegsrc.v6b.tar.gz
shell>cd jpeg-6b
shell>./configure --enable-shared --enable-static
shell>make
shell>make test
shell>make install


22. ftp://sunsite.unc.edu/pub/Linux/libs/graphics/ 에서 libungif를 다운 받는다

23. libungif 설치


shell>tar -xvzf libungif-4.1.0.tar.gz
shell>cd libungif-4.1.0
shell>./configure
shell>make
shell>make install


24. ftp://ftp.remotesensing.org/pub/libtiff/ 에서 libtiff의 최신 버전을 다운 받는다.

25. libtiff 설치


shell>tar -xvzf tiff-v3.6.1.tar.gz
shell>cd tiff-v3.6.1
shell>./configure

...중간에 설치하다 물어보면
yes한다
...

shell>make
shell>make install


26. ftp://sunsite.unc.edu/pub/Linux/libs/graphics/ 에서 t1lib을 다운 받는다.

27. t1lib 설치


shell>tar -xvzf t1lib-5.0.0.tar.gz
shell>cd t1lib-5.0.0
shell>./configure

configure finished!
Do:  'make'               to compile the t1lib-package.
Do:  'make without_doc'   to compile if you do not have LaTeX.
Do:  'make install'       to install the t1lib-package.


shell>make without_doc // 위의 내용그대로 필자는 LaTeX가 없기때문에 make하지 않고 make without_doc로 했습니다.
shell>make install


28. http://prdownloads.sourceforge.net/ming/ming-0.2a.tgz 에서 ming-0.2a 를받는다. 이후의 최신버전은 설치상 제약이 많아 필자는 이 버전을 애용한다.

29. ming 설치


shell>tar -xvzf ming-0.2a.tgz
shell>cd ming-0.2a
shell>make
shell>make install


30. http://www.boutell.com/gd/http/ 에서 gd 최신 버전을 다운 받는다.

31. gd 설치


shell>tar xvzf gd-2.0.9.tar.gz
shell>cd gd-2.0.9
shell>./configure
shell>make
shell>make install


32. ftp://ftp.cac.washington.edu/imap/ 에서 imap 최신 버전을 다운받는다. imap 설치시 갖가지 소스를 수정하는등 필자도 애로사항이 많았는데, 얼마전에 나온 imap-2004.RC6.tar.Z 를 다운받아 한번에 해결했다.

33. imap 설치


shell>tar -xvzf imap-2004.RC6.tar.Z
shell>cd imap-2004.RC6
shell>make lrh (레드햇 7.3 이상 버전) // 구 버전일시 make slx (다른 배포판등은 configure 문서를 참고)

shell>cp ipopd/ipop3d /usr/sbin/ipop3d
shell>cp imapd/imapd /usr/sbin/imapd

shell>cp c-client/c-client.a /usr/lib/c-client.a
shell>cp c-client/mail.h  /usr/local/include/mail.h
shell>cp c-client/rfc822.h /usr/local/include/rfc822.h
shell>cp c-client/linkage.h /usr/local/include/linkage.h // 더 필요한 헤더가 있을경우 같은방법으로 /usr/local/include 로 복사한다.


◈ /etc/xinetd.d/ipop3d 를 다음 내용으로 만들어서 pop3가 되게끔 한다.


# default: on
# description: This is pop3 service.
service pop3
{
        disable = no
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/sbin/ipop3d
        log_on_success += HOST DURATION
        log_on_failure  += HOST
}


◈ /etc/xinetd.d/imapd 를 다음 내용으로 만들어서 imap이 되게끔 한다.


# default: on
# description: This is imap service.
service imap
{
        disable = no
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/sbin/imapd
        log_on_success += HOST DURATION
        log_on_failure  += HOST
}


◈ shell>/etc/rc.d/init.d/xinetd restart //xinetd 데몬 재가동

◈ shell>telnet localhost 110


Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK POP3 localhost 2003.85 server ready // 이런 문자가 나오면 정상


◈ shell>telnet localhost 143


Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4REV1 LITERAL+ SASL-IR LOGIN-REFERRALS STARTTLS LOGINDISABLED] localhost IMAP4rev1 2003.346 at Sun, 1 Feb 2004 22:19:00 +0900 (KST) // 이런 문자가 나오면 정상


34. http://ftp.apache-kr.org/httpd/ 에서 아파치 최신 버전을 다운 받는다.

35. Apache를 설치한다


shell> tar -xvzf apache_1.3.29.tar.gz
shell> cd apache_1.3.29
shell>./configure
--prefix=/usr/local/apache
--enable-shared=max
--enable-rule=SHARED_CORE
--enable-module=so

shell>make
shell>make install


36. /usr/local/apache/conf/httpd.conf 파일을 다음과 같이 편집한다.


37. /usr/local/apache/bin/apachectl 을 시작하여 웹에서 확인한다.




38. http://www.php.net/downloads.php 에서 php 최신 버전을 다운받는다.

39. php 설치 // 나중에 모듈 설치가 가능하므로 자신에게 필요한 부분만 설치 한다. 강좌이기 때문에 전체 설치함


./configure
--with-apxs=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/apache/conf
--with-mysql=/usr/local/mysqll
--with-zlib-dir=/usr/local
--with-jpeg-dir=/usr/local
--with-png-dir=/usr/local
--with-gif-dir=/usr/local
--with-tiff-dir=/usr/local
--with-gd
--with-freetype
--with-ming
--with-cpdflib
--with-openssl
--with-gettext
--with-kerberos
--with-swf-dir=/usr/local/swf
--with-mm
--with-mhash
--with-mcrypt
--with-mod_charset
--with-language=korean
--with-charset=euc_kr
--with-regex=php
--with-dbm
--with-gdbm
--with-curl
--with-ldap
--with-xml
--with-imap
--with-imap-ssl
--with-ttf
--with-t1lib
--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

shell>make
shell>make install

shell>cp php.ini-dist /usr/local/apache/conf


40. Zend Optimizer 설치
과거에는 php.ini 파일을 수정했으나 현재는 압축을 푼후 설치 스크립트를 이용해 바로 설치가 가능하다. 압축 푼 디렉토리로 이동하여 ./install 하면된다.

설치후 아래와 같이 phpinfo() 함수로 확인해본다.


php가 제대로 설치됐다면 아래와 같이 나온다. 두번째 그림은 Zend Optimizer 설치시




41. http://www.pdflib.com/products/pdflib/download/index.html  에서 pdflib의 최신 바이너리 파일을 다운 받는다.

42. pdflib 설치

shell>tar -xvzf PDFlib-5.0.3-Linux.tar.gz
shell>cd PDFlib-5.0.3-Linux
shell>cd bind
shell>cd php
shell>cd php-4.2.1 // php 4.2.0 이하 버전 사용자는 php-4.1.0을 사용한다.
shell>mkdir /usr/local/apache/php_module // php 동적 모듈이 들어갈 디렉토리 생성
shell>cp libpdf_php.so /usr/local/apache/php_module


여기서부터가 중요하다. 필자의 경우 php_module 이라는 곳에 동적 모듈이 들어가게 세팅해놨는데, 이는 php.ini 파일 안에서 설정하면 된다.

shell>vi /usr/local/apache/conf/php.ini
extension_dir="/usr/local/apache/php_module" // 자신이 원하는 디렉토리로 설정하면 된다.
extension=libpdf_php.so // 복사했던 모듈을 추가 시키는 부분


이상의 설정이 잘못되면 pdf 라이브러리를 사용할 수 없게 된다. 확인은 압축푼 디렉토리의 bind/php 안의 hello.php등으로 하면 된다. 아니면 아래 소스를 복사하여 /usr/local/apache/htdocs/hello.php 를 생성한후 웹에서 확인해보기 바란다. 이때 Adobe Acrobat Reader 등 pdf 뷰어가 있어야 된다. 이상없이 pdf 파일이 화면에 출력되면 제대로 설치 된 것이다.

# $Id: hello.php,v 1.9.2.2 2003/12/17 15:38:01 tm Exp $

/* create a new PDFlib object */
$p = PDF_new();

/*  open new PDF file; insert a file name to create the PDF on disk */
if (PDF_open_file($p, "") == 0) {
    die("Error: " . PDF_get_errmsg($p));
}

/* This line is required to avoid problems on Japanese systems */
PDF_set_parameter($p, "hypertextencoding", "winansi");

PDF_set_info($p, "Creator", "hello.php");
PDF_set_info($p, "Author", "Rainer Schaaf");
PDF_set_info($p, "Title", "Hello world (PHP)!");

PDF_begin_page($p, 595, 842);           /* start a new page     */

$font = PDF_load_font($p, "Helvetica-Bold", "winansi", "");

PDF_setfont($p, $font, 24.0);
PDF_set_text_pos($p, 50, 700);
PDF_show($p, "Hello world!");
PDF_continue_text($p, "(says PHP)");
PDF_end_page($p);                       /* close page           */

PDF_close($p);                          /* close PDF document   */

$buf = PDF_get_buffer($p);
$len = strlen($buf);

header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=hello.pdf");
print $buf;

PDF_delete($p);                         /* delete the PDFlib object */
?>

다음은 실행화면이다.


만일 이 부분이 제대로 되지 않는다면 필자의 과거 문서나 다른 문서를 참고하여 pdflib 소스를 가져와 컴파일 하도록 한다.

43. 모든것이 완벽히 설치 됐다면 부팅시 실행되게 설정한다.

shell>cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
shell>ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc0.d/K21httpd
shell>ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S89httpd
shell>ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S89httpd


출처 : 럭스테크(http://lux.soo.to/bbs/view.php?id=linux_lecture&page=1&sn1=&divpage=1&sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=11)

Press ESC to close