안녕들하세요~ 두번째로 제가 작성하는 글이네요~^^
원래 제 블로그의 목적은 좋은글 가져와 퍼넣기인데~ 이번은 제가 글을 쓰니~~ ㅋㅋ 암튼, 모든분들에게 조금이나마 도움이 되셨으면 합니다.

# 설치 대상 서버 및 OS
# Model : HP DL320 G5 [제온듀얼코어,SATA]
# CPU : Dual Core Xeon 3050 [2M] X 1
# RAM : HP DDR2 ECC 1G X 1
# O S : CentOS 5.0

# PHP 설치전 설치해야 할 Library
1. zlib 설치하기
 download :
http://www.gzip.org/zlib/

 [root@path]# tar -xvzf zlib-x.x.x.tar.gz
 [root@path]# cd zlib-x.x.x
 [root@path]# ./configure -s
 [root@path]# make

 [root@path]# ./configure
 [root@path]# make test
 [root@path]# make install

 [root@path]# cp libz.so* /usr/local/lib

 [root@path]# cd /usr/local/lib
 [root@path]# rm -rf libz.so
 [root@path]# rm -rf libz.so.1
 [root@path]# ln -s libz.so.1.2.1libz.so
 [root@path]# ln -s libz.so.1.2.1libz.so.1

 [root@path]# vi /etc/ld.so.conf
 #[추가]
 /usr/local/lib
 [root@path]# ldconfig

2. curl 설치하기
 download :
http://curl.haxx.se/download.html

 [root@path]# tar -xvzf curl-x.x.x.tar.gz
 [root@path]# cd curl-x.x.x
 [root@path]# ./configure
 [root@path]# make
 [root@path]# make install

3. mhash 설치하기
 download :
http://mhash.sourceforge.net/dl

 [root@path]# tar -xvzf mhash-x.x.x.tar.gz
 [root@path]# cd mhash-x.x.x
 [root@path]# ./configure
 [root@path]# make
 [root@path]# make install

4. libmcrypt 설치하기
 download :
ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/
 
 [root@path]# tar -xvzf libmcrypt-x.x.x.tar.gz
 [root@path]# cd libmcrypt-x.x.x
 [root@path]# ./configure
 [root@path]# make
 [root@path]# make install

5. freetype 설치하기
 download :
http://freetype.sourceforge.net/
 
 [root@path]# tar -xvzf freetype-x.x.x.tar.gz
 [root@path]# cd freetype-x.x.x
 [root@path]# ./configure
 [root@path]# make
 [root@path]# make install

6. ming 설치하기
 download :
http://www.opaque.net/ming/
 
 [root@path]# tar -xvzf ming-x.xa.tgz
 [root@path]# cd ming-x.xa
 [root@path]# ./configure
 [root@path]# make
 [root@path]# make install

7. pdflib 설치하기
 download :
http://www.pdflib.com
 
 [root@path]# tar -xvzf PDFlib-x.x.xp1-Linux.tar.gz
 [root@path]# cd PDFlib-x.x.xp1-Linux
 [root@path]# cd bind/php5/php-520
 [root@path]# mkdir /usr/local/apache/php_module
 [root@path]# cp libpdf_php.so /usr/local/apache/php_module
 
 PHP설치 이후에 설정할 내용
 [root@path]# vi /usr/local/apache/conf/php.ini

 #[추가]
 extension_dir="/usr/local/apache/php_module"
 extension=libpdf_php.so

8. swf 설치하기
 download :
ftp://ftp.sgi.com/sgi/graphics/grafica/flash

 [root@path]# tar -xvzf dist.xx.linux.tar.Z
 [root@path]# mkdir /usr/local/swf
 [root@path]# cd dist
 [root@path]# mkdir /usr/local/swf/include
 [root@path]# mkdir /usr/local/swf/lib
 [root@path]# mkdir /usr/local/swf/fonts
 [root@path]# mkdir /usr/local/swf/psfonts
 [root@path]# mkdir /usr/local/swf/bin
 [root@path]# cp swf.h /usr/local/swf/include
 [root@path]# cp libswf.a /usr/local/swf/lib
 [root@path]# cp bin/* /usr/local/swf/bin
 [root@path]# cp fonts/* /usr/local/swf/fonts
 [root@path]# cp psfonts/* /usr/local/swf/psfonts

9. mm 설치하기
 download :
http://www.engelschall.com/sw/mm/

 [root@path]# tar -xvzf mm-x.x.x.tar.gz
 [root@path]# cd mm-x.x.x
 [root@path]# ./configure --disable-shared
 [root@path]# make
 [root@path]# make install

10. libpng 설치하기
 download :
http://www.libpng.org/pub/png/libpng.html

 [root@path]# tar -xvzf libpng-x.x.x.tar.gz
 [root@path]# cd libpng-x.x.x
 [root@path]# cp scripts/makefile.linux Makefile
 [root@path]# make test
 [root@path]# make install

11. jpeg 설치하기
 download :
ftp://ftp.uu.net/graphics/jpeg/

 [root@path]# tar -xvzf jpegsrc.v6b.tar.gz
 [root@path]# cd jpeg-6b
 [root@path]# ./configure --enable-shared --enable-static
 [root@path]# make
 [root@path]# make test
 [root@path]# make install

12. libungif 설치하기
 download :
ftp://sunsite.unc.edu/pub/Linux/libs/graphics/

 [root@path]# tar -xvzf libungif-x.x.x.tar.gz
 [root@path]# cd libungif-x.x.x
 [root@path]# ./configure
 [root@path]# make
 [root@path]# make install

13. libtiff 설치하기
 download :
ftp://ftp.remotesensing.org/pub/libtiff/

 [root@path]# tar -xvzf tiff-vx.x.x.tar.gz
 [root@path]# cd tiff-vx.x.x
 [root@path]# ./configure
 [root@path]# make
 [root@path]# make install

14. t1lib 설치하기
 download :
ftp://sunsite.unc.edu/pub/Linux/libs/graphics/

 [root@path]# tar -xvzf t1lib-x.x.x.tar.gz
 [root@path]# cd t1lib-x.x.x
 [root@path]# ./configure
 [root@path]# make without_doc
 [root@path]# make install

15. gd 설치하기
 download :
http://www.boutell.com/gd/http/

 [root@path]# tar xvzf gd-x.x.x.tar.gz
 [root@path]# cd gd-x.x.x
 [root@path]# ./configure -prefix=/usr/local/gd
 [root@path]# make
 [root@path]# make install

16. OpenSSL 설치하기
 download : http://www.openssl.org

 [root@path]# tar xvzf openssl-x.x.x.tar.gz
 [root@path]# cd openssl-x.x.x
 [root@path]# ./configure -prefix=/usr/local --openssldir=/usr/local/openssl
 [root@path]# make
 [root@path]# make test
 [root@path]# make install


# MySQL 설치하기 [v5.1.23]
 download :
http://dev.mysql.com/downloads/mysql/5.1.html

 [root@path]# yum -y install ncurses-devel

 [root@path]# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --localstatedir=/home/mysql/data --with-mysqld-user=mysql --with-plugins=innobase
 [root@path]# make
 [root@path]# make install
 [root@path]# groupadd mysql
 [root@path]# useradd -g mysql mysql
 [root@path]# chown -R root.mysql /usr/local/mysql
 [root@path]# chown -R mysql.mysql /home/mysql/data

 [root@path]# /usr/local/mysql/bin/mysql_install_db

 [root@path]# vi /etc/profile

 #[추가]
 MYSQL_HOME=/usr/local/mysql
 PATH=$PATH:$MYSQL_HOME/bin
 export PATH

 [root@path]# cd /usr/local/mysql/bin
 [root@path]# ln -s /usr/local/mysql/share/mysql/mysql.server ./mysqlctl
 [root@path]# mysqlctl start


# APACHE 설치하기 [v1.3.41]
 download :
http://httpd.apache.org/download.cgi

 [root@path]# tar -xvzf apache_1.3.41.tar.gz
 [root@path]# cd apache_1.3.41
 [root@path]# ./configure --prefix=/usr/local/apache --enable-module=so --enable-module=rewrite --enable-shared=rewrite
 [root@path]# make
 [root@path]# make install

[
httpd-2.2.10일 경우
[root@path]# ./configure --prefix=/usr/local/apache2 --enable-modules=all --enable-mods-shared=all --enable-rewrite --enable-so --with-ssl=/usr/local/openssl
 [root@path]# make
 [root@path]# make install

]

# PHP 설치하기 [v5.2.5]
 download :
http://www.php.net/downloads.php#v5

 [root@path]# yum install libxml2-devel
 [root@path]# yum install libtool*

 [root@path]# tar -xvf php-5.2.5.tar
 [root@path]# cd php-5.2.5

 [root@path]# ./configure --with-apxs=/usr/local/apache/bin/apxs \
   --with-mysql=/usr/local/mysql \
   --with-config-file-path=/usr/local/apache/conf \
   --with-exec-dir=/usr/local/apache/bin \
   --with-zlib \  
   --with-jpeg-dir=/usr/local/lib \
   --with-png-dir=/usr/local/lib \
   --with-gif-dir=/usr/local/lib \
   --with-zlib-dir=/usr/local/lib \
   --with-gd=/usr/local/gd \
   --with-freetype-dir=/usr/local/include/freetype2 \
   --with-tiff-dir=/usr/local/lib \
   --with-gettext \
   --with-kerberos \
   --with-swf=/usr/local/swf \
   --with-mm \
   --with-mhash=/usr/local/lib \
   --with-mcrypt=/usr/local/lib \
   --with-regex=php \
   --with-curl \
   --with-xmlrpc \
   --with-openssl \
   --with-openssl-dir=/usr/local/openssl \
   --enable-gd-native-ttf \
   --enable-ftp \
   --enable-sockets \
   --enable-sysvsem \
   --enable-sysvshm \
   --enable-shmop \
   --enable-calendar \
   --enable-sigchild \
   --enable-magic-quotes \   
   --enable-inline-optimization \
   --enable-bcmath

[
httpd-2.2.10일 경우
[root@path]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs \
   --with-mysql \
   --with-config-file-path=/usr/local/apache/conf \
   --with-exec-dir=/usr/local/apache2/bin \
   --with-zlib \  
   --with-jpeg-dir=/usr/local/lib \
   --with-png-dir=/usr/local/lib \
   --with-zlib-dir=/usr/local/lib \
   --with-gd=/usr/local/gd \
   --with-freetype-dir=/usr/local/include/freetype2 \
   --with-gettext \
   --with-kerberos \
   --with-mm \
   --with-mhash=/usr/local/lib \
   --with-mcrypt=/usr/local/lib \
   --with-regex=php \
   --with-curl \
   --with-xmlrpc \
   --with-openssl \
   --with-openssl-dir=/usr/local/openssl \
   --enable-gd-native-ttf \
   --enable-ftp \
   --enable-sockets \
   --enable-sysvsem \
   --enable-sysvshm \
   --enable-shmop \
   --enable-zip \
   --enable-calendar \
   --enable-sigchild \
   --enable-magic-quotes \   
   --enable-inline-optimization \
   --enable-bcmath

]

 [root@path]# make
 [root@path]# make test
 [root@path]# make install

 [root@path]# cp php.ini-dist /usr/local/apache/conf/php.ini

# apache+php 설정 & 시작하기

 [root@path]# vi /usr/local/apache/conf/httpd.conf
 
 #[추가&변경]
 LoadModule php5_module libexec/libphp5.so
 LoadModule rewrite_module       libexec/mod_rewrite.so

 AddType application/x-httpd-php .php .phtml
 AddType application/x-httpd-php-source .phps

[
httpd-2.2.10일 경우
 #[추가&변경]
 LoadModule php5_module libexec/libphp5.so
 LoadModule rewrite_module       libexec/mod_rewrite.so

 <FilesMatch "\.ph(p[2-6]?|tml)$">
         SetHandler application/x-httpd-php
 </FilesMatch>
    
 <FilesMatch "\.phps$">
         SetHandler application/x-httpd-php-source
 </FilesMatch>
]


 [root@path]# /usr/local/apache/bin/apachectl start

# proftpd 설치하기
 download :
http://proftpd.org/

 [root@path]# tar -xvzf proftpd-x.x.x.tar.gz
 [root@path]# cd proftpd-x.x.x
 [root@path]# ./configure --prefix=/usr/local/proftp --enable-auto-shadow
 [root@path]# make
 [root@path]# make install

 [root@path]# vi /usr/local/proftp/etc/proftpd.conf

 #[변경]
 Group nobody
 DefaultRoot ~
 
 [root@path]# /usr/local/proftp/sbin/proftpd -c /usr/local/proftp/etc/proftpd.conf

# mod_gzip 설치하기
 description :
http://schroepl.net/projekte/mod_gzip/install.htm
 download : http://sourceforge.net/project/showfiles.php?group_id=54975

 [root@path]# tar -xvzf mod_gzip-1.3.26.1a.gz
 [root@path]# cd mod_gzip-1.3.26.1a

 [root@path]# make

 Error 발생~
 
 [root@path]# vi Makefile

 #[변경]
 APXS?=/usr/local/sbin/apxs -> apxs 위치 지정
 APXS?=/usr/local/apache/bin/apxs

       $(APXS) -Wc,-Wall,-O3,-fomit-frame-pointer,-pipe -c mod_gzip.c mod_gzip_debug.c mod_gzip_compress.c -o mod_gzip.so -> 옵션 제거
       $(APXS) -Wc -c mod_gzip.c mod_gzip_debug.c mod_gzip_compress.c -o mod_gzip.so

       [root@path]# make
       [root@path]# make install
       [root@path]# vi /usr/local/apache/conf/httpd.conf
      
       #[변경]
       #LoadModule gzip_module        libexec/mod_gzip.so -> #제거
       LoadModule gzip_module        libexec/mod_gzip.so

       #[추가]
 <IfModule mod_gzip.c>
  mod_gzip_on   Yes
  mod_gzip_can_negotiate  Yes
  mod_gzip_static_suffix  .gz
  AddEncoding   gzip .gz
  mod_gzip_update_static  No
  mod_gzip_command_version '/mod_gzip_status'
  mod_gzip_keep_workfiles  No
  mod_gzip_minimum_file_size 500
  mod_gzip_maximum_file_size 500000
  mod_gzip_maximum_inmem_size 60000
  mod_gzip_min_http  1000
  mod_gzip_handle_methods  GET POST
  mod_gzip_item_exclude  reqheader  "User-agent: Mozilla/4.0[678]"
  mod_gzip_item_include  file      \.html$
  mod_gzip_item_exclude  file      \.js$
  mod_gzip_item_exclude  file      \.css$
  mod_gzip_item_include  file      \.pl$
  mod_gzip_item_include  handler    ^cgi-script$
  mod_gzip_item_include  mime      ^text/html$
  mod_gzip_item_include  mime      ^text/plain$
  mod_gzip_item_include  mime      ^httpd/unix-directory$
  mod_gzip_dechunk  Yes
  LogFormat   "%h %l %u %t \"%V %r\" %<s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n -< Out:%{mod_gzip_output_size}n = %{mod_gzip_compression_ratio}n pct." common_with_mod_gzip_info2
  CustomLog   logs/mod_gzip.log common_with_mod_gzip_info2
  mod_gzip_add_header_count Yes
  mod_gzip_send_vary  On
 </IfModule>

       [root@path]# /usr/local/apache/bin/apachectl restart
       [root@path]# gzip 테스트
http://www.whatsmyip.org/mod_gzip_test/에서 그리고 gzip설정시 페이지에서 ob_start("ob_gzhandler");이 설정되어 있어야만 압축되어 전송된다. 또는  header("Content-Encoding: gzip"); 이것과 같이 전송 header 변경으로도 가능하다.


[
httpd-2.2.10일 경우
Apache2 이상에서는 mod_gzip대신에 mod_deflate에서 압축을 담당한다.

-- 아래의 모듈이 올라가 있는지 확인하자
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so

-- 일부 type만 압축설정하자

AddOutputFilterByType DEFLATE text/html text/plain text/xml


-- 이미지를 제외한 모든 것을 압축하자
<Location />

# 필터를 추가한다
SetOutputFilter DEFLATE

# Netscape 4.x에 문제가 있다...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08에 더 문제가 있다
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE은 Netscape라고 자신을 알리지만, 문제가 없다
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# 주의: 아파치 2.0.48까지 mod_setenvif의 버그때문에
# 위의 정규표현식은 동작하지 않는다. 원하는 효과를
# 얻기위해 다음과 같이 수정하여 사용한다:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# 이미지를 압축하지 않는다
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary

# 프록시가 잘못된 내용을 전달하지않도록 한다
Header append Vary User-Agent env=!dont-vary
</Location>

-- /가 아니라 도메인별로 적용할 경우에는 각 디렉토리에 위 내용을 설정한다.
<Directory path~~~>

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript  application/x-javascript

# 필터를 추가한다
SetOutputFilter DEFLATE

# Netscape 4.x에 문제가 있다...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08에 더 문제가 있다
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE은 Netscape라고 자신을 알리지만, 문제가 없다
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# 주의: 아파치 2.0.48까지 mod_setenvif의 버그때문에
# 위의 정규표현식은 동작하지 않는다. 원하는 효과를
# 얻기위해 다음과 같이 수정하여 사용한다:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# 이미지를 압축하지 않는다
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary

# 프록시가 잘못된 내용을 전달하지않도록 한다
Header append Vary User-Agent env=!dont-vary


</Directory>
]

 

저작자 표시 비영리 변경 금지
이올린에 북마크하기(0) 이올린에 추천하기(0)
Posted by 백성용 헬로우보이