CentOs___Apache___Php___Mysql

Document Sample
CentOs___Apache___Php___Mysql Powered By Docstoc
					       CENTOS 5 + APACHE + PHP + MYSQL INSTALL

APM 이 설치 되어 있는 확인
# rpm -qa httpd php mysql


기존에 설치 되어 있는 Apache(httpd), php, mysql 를 제거
# yum remove -y httpd php mysql


라이브러리 및 컴파일 확인
# rpm -qa gcc* cpp* compat-gcc* flex*
# rpm -qa libjpeg* libpng* freetype* gd-*


소스 컴파일을 위한 패키지 설치
# yum -y install gcc cpp gcc-c++ compat-gcc32-g77 flex ---- 1 번
# yum -y install gcc gcc-c++ compat-gcc-34-g77 automake autoconf libtool flex ---2 번 설치


관련 라이브러리 설치

# yum -y install libjpeg-devel libpng-devel freetype-devel gd-devel
# yum -y install zlib-devel libpng-devel freetype-devel libjpeg-devel libxml2-devel gd-devel
libXpm-devel
Yum install gcc gcc-c++ cpp-c++ compat-gcc-32-g77 flex libjpeg-devel libpng-devel
freetype-devel gd-devel libmcrypt php-ncurses.x86_64 glibc-utils,x86_64 libtiff-devel curl
libtermcap-devel


관련 라이브러리 소스 컴파일 시

Zlib
cd /usr/local/src
wget http://www.zlib.net/zlib-1.2.3.tar.bz2
tar xvfj zlib-1.2.3.tar.bz2
cd zlib-1.2.3
./configure          // 64bit 에서는 -s 옵션을 추가하세요.
make && make install
libpng
cd /usr/local/src
wget http://prdownloads.sourceforge.net/libpng/libpng-1.2.42.tar.gz?download
tar xvfz libpng-1.2.42.tar.gz
cd libpng-1.2.42
cp scripts/makefile.linux makefile
make test
make install


freetype
cd /usr/local/src
wget                            http://sourceforge.net/projects/freetype/files/freetype2/2.3.11/freetype-
2.3.11.tar.bz2/download
tar xvfzfreetype-2.3.11.tar.bz2
cd freetype-2.3.11
./configure
make && make install


jpeg
cd /usr/local/src
wget http://www.ijg.org/files/jpegsrc.v8.tar.gz
tar xvfz jpegsrc.v8.tar.gz
cd jpeg-8
./configure --enable-shared --enable-static
make && make install


libxml2
cd /usr/local/src
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
tar xvfz libxml2-2.7.6.tar.gz
cd libxml2-2.7.6
./configure
make && make install


gd
cd /usr/local/src
wget http://www.libgd.org/releases/gd-2.0.35.tar.bz2
tar xvfj gd-2.0.35.tar.bz2
cd gd-2.0.35
./configure
make && make install




MySQL
# yum -y install ncurses-devel zlib-devel
# useradd -M -s /bin/false mysql
# cd /usr/local/src
# wget http://ftp.neowiz.com/pub/mysql/Downloads/MySQL-5.1/mysql-5.1.44.tar.gz
# wget http://ftp.superuser.co.kr/pub/mysql/mysql-5.0.37.tar.gz
# wget http://ftp.linux.co.kr/pub/mysql/mysql-5.1.32.tar.gz
# tar xvfz mysql-5.1.32.tar.gz
# cd mysql-5.1.32
# ./configure --prefix=/usr/local/mysql \
--with-charset=utf8 \
--with-extra-charsets=all
아래는 선택사항
--localstatedir=/usr/local/mysql/var \
--enable-shared --enable-assembler \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--with-mysqld-user="mysql" \
--with-readline --without-debug \
--without-docs \
또는
./configure --prefix=/usr/local/mysql --with-charset=euckr --with-extra-charsets=all --with-readline
--localstatedir=/usr/local/mysql/data
* configure 시 아래와 같이 오류가 발생될 경우
checking for termcap functions library... configure: error: No curses/termcap library found
# yum -y install libtermcap-devel ncurses-devel


# make && make install


환경 설정 복사
# cp /usr/local/src/mysql-5.1.32/support-files/my-large.cnf /etc/my.cnf
기본 DB 생성
# /usr/local/mysql/bin/mysql_install_db --user=mysql


디렉토리 권한 설정
# chown mysql.mysql /usr/local/mysql -R
# chown -R root.mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql/var


환경 변수 등록
# vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
# source ~/.bash_profile


자동실행 설정
# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
# cp /usr/local/src/mysql-5.1.32/support-files/mysql.server /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --list|grep mysqld


# ln -sf /var/lib/mysql/mysql.sock /tmp/mysql.sock


# /etc/init.d/mysqld start
Starting MySQL.Manager of pid-file quit without updating fi[실패]
DB 가 시작되지 않는 문제.
/etc/my.cnf
skip-federated 주석처리
# /usr/local/mysql/bin/mysql_install_db --user=mysql(데이타베이스 다시 생성)
# /etc/init.d/mysqld start




root 암호 등록 및 테스트
mysql root 계정에는 기본적으로 암호가 없으므로 암호설정
# /etc/init.d/mysql start
# Start MySQL                [ OK ]
# mysqladmin -u root password 사용할 암호입력
# mysql -u root –p
# cp /usr/local/mysql/share/mysql/my-huge.cnf /etc/my.cnf
# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --list | grep mysqld
# /etc/init.d/mysqld start
# mysqladmin -u root password ****




Apache
# cd /usr/local/src
# wget http://mirror.apache-kr.org/httpd/httpd-2.2.15.tar.gz
# wget http://ftp.superuser.co.kr/pub/apache/httpd-2.2.2.tar.gz
# wget http://mirror.khlug.org/apache/httpd/httpd-2.2.14.tar.gz
# tar xvfz httpd-2.2.15.tar.gz
# cd httpd-2.2.15


# vi server/mpm/prefork/prefork.c
#define DEFAULT_SERVER_LIMIT 1024
#define MAX_SERVER_LIMIT 200000


# vi server/mpm/worker/worker.c
#define DEFAULT_SERVER_LIMIT 16
#define MAX_SERVER_LIMIT 20000
#define DEFAULT_THREAD_LIMIT 64


# ./configure --prefix=/usr/local/apache2 --enable-so --enable-module=so --enable-shared=max
--enable-module=rewrite      --enable-shared=rewrite
# ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all -enable-so --enable-rewrite
# ./configure --prefix=/usr/local/apache2 --enable-module=so
--activate-module=src/modules/php5/libphp5.a
--enable-rule=SHARED_CORE --enable-shared=max
--enable-shared=rewrite
# ./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --enable-rewrite
# ./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --with-ssl=/usr --enable-
modsecurity --enable-rewrite




# make && make install
서버 재부팅시 apache 데몬이 자동실행 설정

# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
# vi /etc/init.d/httpd
# vi /etc/init.d/httpd <- vi 로 httpd 파일을 열고 아래내용을 맨 밑에 추가한다.
# chkconfig: 2345 90 90
# description: init file for Apache server daemon
# processname: /usr/local/server/apache/bin/apachectl
# config: /usr/local/server/apache/conf/httpd.conf
# pidfile: /usr/local/server/apache/logs/httpd.pid
# service httpd start
# chkconfig --add httpd
# chkconfig --list|grep httpd



# vi /usr/local/apache2/conf/httpd.conf
DirectoryIndex index.html index.htm index.php index.php3


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


User nobody
Group nobody


# /etc/init.d/httpd start


PHP
# cd /usr/local/src
# wget http://kr2.php.net/get/php-5.2.12.tar.bz2/from/this/mirror

# wget http://www.php.net/get/php-5.2.9.tar.gz/from/kr2.php.net/mirror
# wget http://ftp.superuser.co.kr/pub/php/php-5.2.0.tar.gz


    # tar xvfz php-5.2.12.tar.bz2
    # cd php-5.2.12
    # ./configure --prefix=/usr/local/php \
    --with-apxs2=/usr/local/apache2/bin/apxs \
    --with-config-file-path=/usr/local/apache2/conf \
    --with-mysql=/usr/local/mysql \
    --enable-safe-mode \
    --enable-sockets \
    --enable-sigchild \
    --enable-magic-quotes \
    --with-libxml-dir \
    --with-zlib \
    --enable-bcmath \
    --enable-calendar \
    --enable-exif \
    --enable-ftp \
    --with-gd \
    --with-jpeg-dir \
    --with-png-dir \
    --with-iconv \
    --with-ttf \
    --with-freetype-dir \
    --with-xpm-dir \
    --enable-gd-native-ttf \
    --with-gettext \
    --enable-sysvsem \
    --enable-sysvshm \
    --enable-mbstring


    ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-
    file-path=/usr/local/apache2/conf --with-mysql=/usr/local/mysql --with-mod-charset --with-
    xml --with-track-debug --enable-track-vars --enable-calendar --enable-shmop --enable-ftp --
    enable-sockets --enable-mailparse --enable-magic-quotes --enable-track-vars=yes --with-
    language=korean --enable-module=so --with-charset=euc_kr --enable-cgi --with-gd --with-
    png-dir=/usr/lib    --with-libpng-dir=/usr/lib   --with-zlib-dir   --with-jpeg-dir=/usr/lib   --with-
    freetype-dir=/usr/lib --with-charset=utf8 --with-iconv


컴파일 시 error: mcrypt.h not found
libmcrypt 가 정상적으로 설치되지 않은 것이다. libmcrypt.tar.gz 파일을 다운 받아
./configure && make && make install 로 설치
컴파일 시 configure: error: xml2-config not found. Please check your libxml2 installation.
yum install *-devel 이것도 안되면 아래와 같이 수행
libxml2 설치 - XML C 파서(Parser)
다운로드 : ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
tar xvfz libxml2-2.6.16.tar.gz
cd libxml2-2.6.16
# ./configure && make && make install


# make && make install
# cp php.ini-dist /usr/local/apache2/conf/php.ini


# vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/php/bin
# vi /etc/skel/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/php/bin
# source ~/.bash_profile


# /etc/init.d/httpd restart


# cat <<EOF >> /usr/local/apache/htdocs/phpinfo.php
> <? phpinfo(); ?>
> EOF
# vi /usr/local/apache2/conf/httpd.conf 추가
 AddType application/x-httpd-php .php .phtml
 AddType application/x-httpd-source .phps


 Zend Optimizer
# mkdir /usr/local/Zend


32bit
# cd /usr/local/src
# wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
# tar xvfz ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
# cp ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer.so /usr/local/Zend/




64bit
# cd /usr/local/src
# wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
# tar xvfz ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
#         cp           ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so
/usr/local/Zend/


eAccelerator
# mkdir /var/cache/eaccelerator
# chown nobody:nobody /var/cache/eaccelerator
# chmod 644 /var/cache/eaccelerator


# cd /usr/local/src
# wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
# tar xvfj eaccelerator-0.9.5.3.tar.bz2
# cd eaccelerator-0.9.5.3
# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
# make && make install
# vi /usr/local/apache2/conf/php.ini


[Zend]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
zend_optimizer.version=3.3.9
zend_extension=/usr/local/Zend/ZendOptimizer.so


# /etc/init.d/httpd restart




PHPMYADMIN 설치
wget http://prdownloads.sourceforge.net/phpmyadmin/phpMyAdmin-2.11.4-all-languages.tar.gz
wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.3.0/phpMyAdmin-3.3.0-all-
languages.tar.gz/download
tar zxvf phpMyAdmin-2.11.4-all-languages.tar.gz     압축풀기
mv phpMyAdmin-2.11.4-all-languages phpmyadmin 이름바꾸기
cd phpmyadmin
vi libraries/config.default.php

				
DOCUMENT INFO
Categories:
Tags:
Stats:
views:10
posted:3/29/2012
language:
pages:10