#!/bin/bash # httpd22_install.sh # Created by wdlinux QQ:12571192 # url:http://www.wdlinux.cn # 2010.04.08 IN_SRC=$(pwd)/soft IN_LOG=${IN_SRC}/httpd22_install.log IN_DIR="/home/servers" if [[ ! -d $IN_SRC ]];then mkdir $IN_SRC fi if [[ ! -d $IN_DIR ]];then mkdir -p $IN_DIR fi ### yum install #soft down cd $IN_SRC wget http://www.eu.httpd22.org/dist/httpd/httpd-2.2.15.tar.gz wget http://www.php.net/get/php-5.2.13.tar.gz/from/this/mirror wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.45.tar.gz wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6.tar.bz2 # install echo "installing mysql..." cd $IN_SRC useradd mysql tar zxvf mysql-5.1.45.tar.gz >> $IN_LOG 2>&1 cd mysql-5.1.45/ ./configure --prefix=$IN_DIR/mysql --enable-assembler --enable-thread-safe-client --with-extra-charsets=complex --with-ssl --with-embedded-server >> $IN_LOG 2>&1 make >> $IN_LOG 2>&1 make install >> $IN_LOG 2>&1 cp /etc/my.cnf /etc/my.cnf.bk >> $IN_LOG 2>&1 cp support-files/my-large.cnf /etc/my.cnf $IN_DIR/mysql/bin/mysql_install_db >> $IN_LOG 2>&1 chown -R mysql.mysql $IN_DIR/mysql/var cp support-files/mysql.server /etc/rc.d/init.d/mysqld chmod 755 /etc/rc.d/init.d/mysqld /etc/rc.d/init.d/mysqld start PATH=$PATH:$IN_DIR/mysql/bin $IN_DIR/mysql/bin/mysql_secure_installation echo "installing httpd..." cd $IN_SRC tar zxvf httpd-2.2.15.tar.gz >> $IN_LOG 2>&1 cd httpd-2.2.15 ./configure --prefix=$IN_DIR/httpd22 --with-mpm=worker --enable-rewrite --enable-deflate --disable-userdir --enable-so >> $IN_LOG 2>&1 make >> $IN_LOG 2>&1 make install >> $IN_LOG 2>&1 cd $IN_DIR/httpd22/conf/extra mv httpd-vhost.conf httpd-vhost.conf.bk >> $IN_LOG 2>&1 wget http://www.wdlinux.cn/conf/httpd22/httpd-wdl.conf >> $IN_LOG 2>&1 wget http://www.wdlinux.cn/conf/httpd22/httpd-vhosts.conf >> $IN_LOG 2>&1 sed -i 's|#Include conf/extra/httpd-vhosts.conf|Include conf/extra/httpd-vhosts.conf|g' $IN_DIR/httpd22/conf/httpd.conf echo "Include conf/extra/httpd-wdl.conf" >> $IN_DIR/httpd22/conf/httpd.conf echo "installing php..." cd $IN_SRC tar zxvf php-5.2.13.tar.gz >> $IN_LOG 2>&1 cd php-5.2.13/ ./configure --prefix=$IN_DIR/php --with-apxs2=$IN_DIR/httpd22/bin/apxs --with-mysql=$IN_DIR/mysql --with-iconv-dir=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash >> $IN_LOG 2>&1 make >> $IN_LOG 2>&1 make install >> $IN_LOG 2>&1 cp php.ini-dist $IN_DIR/php/lib/php.ini echo "installing eaccelerator..." cd $IN_SRC tar jxvf eaccelerator-0.9.6.tar.bz2 >> $IN_LOG 2>&1 cd eaccelerator-0.9.6/ $IN_DIR/php/bin/phpize >> $IN_LOG 2>&1 ./configure --enable-eaccelerator=shared --with-php-config=$IN_DIR/php/bin/php-config >> $IN_LOG 2>&1 make >> $IN_LOG 2>&1 make install >> $IN_LOG 2>&1 mkdir $IN_DIR/eaccelerator_cache echo '[eaccelerator] zend_extension="'$IN_DIR'/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so" eaccelerator.shm_size="64" eaccelerator.cache_dir="'$IN_DIR'/eaccelerator_cache" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="3600" eaccelerator.shm_prune_period="3600" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9"' >> $IN_DIR/php/lib/php.ini echo "config..." echo "" > $IN_DIR/httpd22/htdocs/phpinfo.php echo "$IN_DIR/httpd22/bin/apachectl start" >> /etc/rc.d/rc.local echo "start service..." $IN_DIR/httpd22/bin/apachectl start