kkamagi's story

IT, 정보보안, 포렌식, 일상 공유

OS

APM 설치 ( apache 2.2.21 / php 5.2.5 / mysql 5.0 / zend 3.3 )

까마기 2014. 12. 27. 03:39
728x90
반응형
yum -y remove http* php* mysql*


yum -y install gd-*  freetype-*  libpng*  libmng*  libtiff*  libungif*  libjpeg*  libc-client* libc-client-devel  imap* libmcrypt* mhash* mhash-devel  libtool-ltdl-devel* pcre* apr* openssl* dialog cc* gcc* cmake vsftpd net-snmp* ncurses* gmp* expat* libxml2* pspell* libxml* gdbm* ntp mhash* cyrus-imapd* sendmail* libXaw* fontconfig* libtermcap* krb5* libcurl* curl curl-devel ncurse* libxml*

yum -y install wget sysstat
yum groupinstall "Development Tools"
yum groupinstall "Development Libraries"
yum install rdate
yum install rsync -y
yum install yum-fastestmirror -y
yum install gcc gcc-c++ make automake autoconf -y





cd /usr/local/src
wget http://123.214.170.59/thd/httpd-2.2.21.tar.gz
wget http://123.214.170.59/thd/mysql-5.0.27.tar.gz
wget http://123.214.170.59/thd/php-5.2.5.tar.gz
wget http://123.214.170.59/thd/ZendOptimizer-3.3.3-linux-glibc23-x86_64.tar.gz
wget http://123.214.170.59/thd/mhash-0.9.9.tar.gz
wget http://123.214.170.59/thd/libmcrypt-2.5.7.tar.gz

cd /usr/local/src
wget 1.224.163.21/libmcrypt-2.5.7.tar.gz
tar zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure && make && make install

cd /usr/local/src
wget 1.224.163.21/mhash-0.9.9.tar.gz
tar zxvf mhash-0.9.9.tar.gz
cd mhash-0.9.9
./configure && make && make install

cd /usr/local/src



####### apache 2.2.21 설치 #########

tar xvfz httpd-2.2.21.tar.gz
cd httpd-2.2.21
sed -i 's/256/4096/g' server/mpm/prefork/prefork.c

* 서버가 64비트일 경우 apache 컴파일 시 기존에 /usr/lib/ 에 있는 모듈때문에 에러가 날 수 있다.
이 때문에 아래와 같은 작업을 수행한다.

rm -f /usr/lib/libaprutil-1.so
ln -s  /usr/lib64/libaprutil-1.so.0.2.7 /usr/lib/libaprutil-1.so
rm -f /usr/lib/libdb-4.3.so
ln -s /usr/lib64/libdb-4.3.so /usr/lib/libdb-4.3.so
rm -f /usr/lib/libapr-1.so
ln -s  /usr/lib64/libapr-1.so.0.2.7  /usr/lib/libapr-1.so
mv /usr/lib/libltdl.so /usr/lib/libltdl.so_32orgln -s /usr/lib64/libltdl.so /usr/lib/libltdl.so
rm -f /usr/lib/libexpat.soln -s /usr/lib64/libexpat.so /usr/lib/libexpat.so
ln -sf /usr/lib64/libgssapi_krb5.so.2.2 /usr/lib/libgssapi_krb5.so
ln -sf /usr/lib64/libkrb5.so.3.3 /usr/lib/libkrb5.so
ln -sf /usr/lib64/libk5crypto.so.3.1 /usr/lib/libk5crypto.so
ln -sf /lib64/libcom_err.so.2 /usr/lib/libcom_err.so
ln -sf /usr/lib64/libgcrypt.so.11 /usr/lib/libgcrypt.so
ln -sf /usr/lib64/libgpg-error.so.0 /usr/lib/libgpg-error.so
ln -sf /usr/lib64/libexpat.so /usr/lib/libexpat.so
ln -sf /usr/lib64/libm.so /usr/lib/libm.so
ln -sf /usr/lib64/libssl.so /usr/lib/libssl.so
ln -s /usr/lib64 /usr/kerberos/lib
rsync -az /lib64/ /lib/
rsync -az /usr/lib64/ /usr/lib/


./configure --prefix=/usr/local/apache --enable-modules=so --enable-mods-shared=all --enable-modules=shared --enable-ssl --with-ssl=/usr --enable-rewrite  --with-mpm=prefork;
make;
make install;

* ssl 설치 되어 있지 않으면 openssl 소스 컴파일 후 해당 경로를 지정한다. ( --enable-modules=ssl --with-ssl=/usr/local/openssl 과 같은 식으로.)

--> 

 ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-so  --enable-module=ssl --with-ssl=/usr/local/openssl --with-mpm=prefork --enable-rewrite

-> 설치 후 데몬 등록하기

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" >> /usr/local/apache/bin/apachectl;
cp -f /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apachectl;
chkconfig --add apachectl;
chkconfig --level 345 apachectl on;





####### mysql 5.0.27 설치 #########


cd /usr/local/src
tar xvfz mysql-5.0.27.tar.gz
cd mysql-5.0.27

./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-charset=utf8  --enable-thread-safe-client --with-extra-charsets=all --with-plugins=innobase --with-plugins=max;




make
make install


ln -s /usr/local/mysql/lib/mysql /usr/lib64/mysql;
ln -s /usr/lib64/mysql /usr/lib/mysql;
groupadd -g 400 mysql;
useradd -u400 -g400 -d /usr/local/mysql -s /sbin/nologin mysql;

mkdir /usr/local/mysql/data;
chgrp -R mysql /usr/local/mysql;
chgrp -R mysql /usr/local/mysql/data;
cp -f support-files/my-huge.cnf /etc/my.cnf;

cp -f support-files/mysql.server /etc/init.d/mysqld;
chmod 755 /etc/init.d/mysqld;
cd /usr/local/mysql/bin;
./mysql_install_db;
rm -rf /usr/bin/mysql;
cp -arp /usr/local/mysql/bin/mysql /usr/bin/mysql;
cd /usr/local/mysql
chown -R mysql.mysql /usr/local/mysql/
chown -R mysql.mysql /usr/local/mysql/data;
chkconfig --level 3 mysqld on;
/etc/init.d/mysqld start





###### php 5.2.5 설치 ########



cd /usr/local/src
tar xvfz php-5.2.5.tar.gz
cd php-5.2.5

* 아래 컴파일 옵션 대로 컴파일 하기 전에 각각 경로 확인 하기.

./configure  --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-language=korean --with-libxml-dir=/usr --disable-debug --with-zend-multibyte --with-regex=php --with-mod_charset --with-iconv --with-dbx --with-gdbm --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --with-zlib --enable-mbstring  --enable-mbregex --enable-sigchild --enable-ftp --enable-dba --enable-sockets --enable-saft-mode --enable-inline-optimization --enable-magic-quotes --enable-track-vars --enable-debugger --enable-sysvsem --enable-sysvshm=yes --enable-wddx  --enable-bcmath --enable-mbregex --enable-exif --enable-gd-native-ttf --with-xmlrpc  --enable-calendar --with-imap --with-imap-ssl --with-kerberos --with-mcrypt=/usr/local --with-curl --with-mhash=/usr/local  --with-ttf --with-mysqli=/usr/local/mysql/bin/mysql_config   --with-openssl=/usr/ --enable-zip  --with-zlib-dir --enable-soap --with-xml --with-gettext


==============================================================================

./configure  --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/home/mysql --with-language=korean --with-libxml-dir=/usr --disable-debug --with-zend-multibyte --with-regex=php --with-mod_charset --with-iconv --with-dbx --with-gdbm --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --with-zlib --enable-mbstring  --enable-mbregex --enable-sigchild --enable-ftp --enable-dba --enable-sockets --enable-saft-mode --enable-inline-optimization --enable-magic-quotes --enable-track-vars --enable-debugger --enable-sysvsem --enable-sysvshm=yes --enable-wddx  --enable-bcmath --enable-mbregex --enable-exif --enable-gd-native-ttf --with-xmlrpc  --enable-calendar --with-imap --with-imap-ssl --with-kerberos --with-mcrypt=/usr/local --with-curl --with-mhash=/usr/local  --with-ttf --with-mysqli=/home/mysql/bin/mysql_config   --with-openssl=/usr/ --enable-zip  --with-zlib-dir --enable-soap --with-xml --with-gettext




make;
make install;

cp php.ini-dist /usr/local/apache/conf/php.ini;

vi /usr/local/apache/conf/php.ini +"/register_globals =" +"s/Off/On/g" +wq;


-> 설치 후 httpd.conf 에 php 모듈 및 설정 확인하기



######## Zend 3.3.3 설치 #############

cd /usr/local/src

tar xvfz ZendOptimizer-3.3.3-linux-glibc23-x86_64.tar.gz

cd ZendOptimizer-3.3.3-linux-glibc23-x86_64
./install




####### 기타 설정 튜닝 ###########

cd /usr/local/php/lib; ln -sf /usr/local/apache/conf/php.ini php.ini;
sed -i "s/`grep "^User " /usr/local/apache/conf/httpd.conf`/User nobody/g" /usr/local/apache/conf/httpd.conf
sed -i "s/`grep "^Group " /usr/local/apache/conf/httpd.conf`/Group nobody/g" /usr/local/apache/conf/httpd.conf
sed -i "s/UseCanonicalName On/UseCanonicalName Off/g" /usr/local/apache/conf/httpd.conf
sed -i "s/MinSpareServers 5/MinSpareServers 20/g" /usr/local/apache/conf/httpd.conf
sed -i "s/MaxSpareServers 10/MaxSpareServers 100/g" /usr/local/apache/conf/httpd.conf
sed -i "s/StartServers 5/StartServers 30/g" /usr/local/apache/conf/httpd.conf
sed -i "s/MaxKeepAliveRequests 100/MaxKeepAliveRequests 10000/g" /usr/local/apache/conf/httpd.conf
sed -i "s/MaxClients 150/MaxClients 512/g" /usr/local/apache/conf/httpd.conf
sed -i "/MaxClients 512/i ## [? MaxClients Limit : 4096 " /usr/local/apache/conf/httpd.conf
rm -rf /usr/local/apache/htdocs/index.html*;
cp -arp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.save;
sed -i 's/#AddHandler cgi-script .cgi/AddHandler cgi-script .cgi/g' /usr/local/apache/conf/httpd.conf
echo "AddType application/x-httpd-php .php .php3 .htm .html .phtml .cgi .inc .jsp .do" >> /usr/local/apache/conf/httpd.conf
echo "AddType application/x-httpd-php-source .phps" >> /usr/local/apache/conf/httpd.conf


echo "
<Directory "/home/*">
    AllowOverride All
    Options +ExecCGI
    Order allow,deny
    Allow from all
</Directory>" >> /usr/local/apache/conf/httpd.conf


chmod +x /etc/init.d/apachectl;


/etc/init.d/apachectl restart;

echo "/usr/local/apache/logs/*_log {" > /etc/logrotate.d/apache
echo "weekly" >> /etc/logrotate.d/apache
echo "rotate 8" >> /etc/logrotate.d/apache
echo "missingok" >> /etc/logrotate.d/apache
echo "create 0600 root root" >> /etc/logrotate.d/apache
echo "postrotate" >> /etc/logrotate.d/apache
echo "/bin/kill -HUP \`cat /usr/local/apache/logs/httpd.pid 2>/dev/null\` 2> /dev/null || true" >> /etc/logrotate.d/apache
echo "endscript" >> /etc/logrotate.d/apache
echo "}" >> /etc/logrotate.d/apache


반응형

'OS' 카테고리의 다른 글

centos vim 설치  (0) 2015.01.09
my.cnf 위치 확인  (0) 2015.01.02
php json 모듈 설치  (0) 2014.12.27
php 5.3.x configure 옵션  (0) 2014.12.27
[ IIS ] - FTP 가상 디렉터리 추가  (0) 2014.12.27