|
|
本脚本自动下载并编译安装 Apache v2.0.54 + PHP v4.4.0 + MySQL v4.0.25 及相关软件,并自动修改 mysql 最大连接数 100 为 1000,自动加入 Apache 及 MySQL 自动启动。
测试系统:Debian Linux Sarge 3.1r0
作者: keelort
网站: http://www.micronsky.net
- #!/bin/bash
- rm -R bw_mod-0.6 > /dev/null
- rm -R ClibPDF > /dev/null
- rm -R curl-7.14.0 > /dev/null
- rm -R freetype-2.1.10 > /dev/null
- rm -R gd-2.0.33 > /dev/null
- rm -R httpd-2.0.54 > /dev/null
- rm -R jpeg-6b > /dev/null
- rm -R libiconv-1.9.2 > /dev/null
- rm -R libpng-1.2.8 > /dev/null
- rm -R mod_dosevasive > /dev/null
- rm -R mod_limitipconn-0.22 > /dev/null
- rm -R mysql-4.0.25 > /dev/null
- rm -R openssl-0.9.7g > /dev/null
- rm -R php-4.4.0 > /dev/null
- rm -R ZendOptimizer-2.5.10-linux-glibc21-i386 > /dev/null
- rm -R zlib-1.2.2 > /dev/null
- ##### Download #####
- echo "[Downloading...]";echo -e "\a";sleep 6
- echo "[1/16]";wget -N http://www.apache.org/dist/httpd/httpd-2.0.54.tar.gz
- echo "[2/16]";wget -N http://cn.php.net/distributions/php-4.4.0.tar.gz
- echo "[3/16]";wget -N http://download.softagency.net/MySQL/Downloads/MySQL-4.0/mysql-4.0.25.tar.gz
- echo "[4/16]";wget -N http://downloads.zend.com/optimizer/2.5.10/ZendOptimizer-2.5.10-linux-glibc21-i386.tar.gz
- echo "[5/16]";wget -N http://curl.haxx.se/download/curl-7.14.0.tar.gz
- echo "[6/16]";wget -N http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz
- echo "[7/16]";wget -N http://www.openssl.org/source/openssl-0.9.7g.tar.gz
- echo "[8/16]";wget -N http://savannah.nongnu.org/download/freetype/freetype-2.1.10.tar.gz
- echo "[9/16]";wget -N http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
- echo "[10/16]";wget -N http://www.fastio.com/clibpdf202r1.tar.gz
- echo "[11/16]";wget -N http://www.ijg.org/files/jpegsrc.v6b.tar.gz
- echo "[12/16]";wget -N http://switch.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8.tar.gz
- echo "[13/16]";wget -N http://www.zlib.net/zlib-1.2.2.tar.gz
- echo "[14/16]";wget -N http://dominia.org/djao/limit/mod_limitipconn-0.22.tar.gz
- echo "[15/16]";wget -N http://www.ivn.cl/apache/bw_mod-0.6.tgz
- echo "[16/16]";wget -N http://www.nuclearelephant.com/projects/dosevasive/mod_dosevasive_1.10.tar.gz
- ##### Decompression #####
- echo "[Decompressing...]";echo -e "\a";sleep 6
- for i in `ls *.gz`;do tar zxvf $i; done;
- for i in `ls *.tgz`;do tar zxvf $i; done;
- mkdir /data
- mkdir /data/mysql-db
- mkdir /data/vhosts
- mkdir /data/vhosts/0
- mkdir /server
- mkdir /server/conf
- mkdir /server/conf/vhosts
- mkdir /server/conf/vhosts-ssl
- ##### zlib #####
- echo "[Installing zlib...]";echo -e "\a";sleep 6
- cd zlib-1.2.2
- ./configure
- make && make install
- cd ..
- rm -R zlib-1.2.2
- ##### OpenSSL #####
- echo "[Intalling OpenSSL...]";echo -e "\a";sleep 6
- cd openssl-0.9.7g
- ./config --prefix=/usr/local \
- shared \
- zlib
- make && make install
- cd ..
- rm -R openssl-0.9.7g
- ##### MySQL #####
- echo "[Installing MySQL...]";echo -e "\a";sleep 6
- cd mysql-4.0.25
- sed -i 's/\&max_connections, 0, GET_ULONG, REQUIRED_ARG, 100,/\&max_connections, 0, GET_ULONG, REQUIRED_ARG, 1000,/g' ./sql/mysqld.cc
- apt-get install libncurses5-dev
- groupadd mysql
- useradd -g mysql mysql
- ./configure \
- --prefix=/server/mysqld \
- --sysconfdir=/server/conf \
- --without-isam \
- --without-debug \
- --enable-assembler \
- --with-unix-socket-path=/tmp/mysql.sock \
- --with-mysqld-user=mysql \
- --with-extra-charset=all \
- --with-client-ldflags=-all-static \
- --with-mysqld-ldflags=-all-static \
- --localstatedir=/data/mysql-db
- make && make install
- /server/mysqld/bin/mysql_install_db --user=mysql
- chown -R mysql /data/mysql-db
- chgrp -R mysql /data/mysql-db
- chown -R root /server/mysqld
- chgrp -R mysql /server/mysqld
- cp /server/mysqld/share/mysql/my-medium.cnf /server/conf/my.cnf
- /server/mysqld/share/mysql/mysql.server start
- sleep 3
- /server/mysqld/bin/mysqladmin -u root password 1029384756
- cd ..
- rm -R mysql-4.0.25
- ##### Apache2 #####
- echo "[Installing Apache2...]";echo -e "\a";sleep 6
- cd httpd-2.0.54
- ./configure --prefix=/server/httpd \
- --enable-so \
- --with-mysql=/server/mysqld \
- --enable-cgi \
- --enable-cgid \
- --with-config-file-path=/server/conf \
- --enable-track-vars \
- --enable-mods-shared=all \
- --enable-cache \
- --enable-disk-cache \
- --enable-mem-cache \
- --enable-rewrite \
- --with-mpm=worker \
- --enable-mime-magic \
- --enable-static-support \
- --enable-static-htpasswd \
- --enable-static-htdigest \
- --enable-static-rotatelogs \
- --enable-static-logresolve \
- --enable-static-htdbm \
- --enable-static-ab \
- --enable-static-checkgid \
- --with-ssl=/usr/local \
- --enable-ssl
- make && make install
- mkdir /server/conf/vhosts
- mkdir /server/conf/vhosts-ssl
- mkdir /data/vhosts
- mkdir /data/vhosts/localhost
- mv /server/httpd/conf/* /server/conf
- rm -R /server/httpd/conf
- ln -s /server/conf /server/httpd/conf
- cd ..
- ##### FreeType #####
- echo "[Installing FreeType...]";echo -e "\a";sleep 6
- cd freetype-2.1.10
- ./configure --prefix=/usr/local
- make && make install
- cd ..
- rm -R freetype-2.1.10
- ##### LibPNG #####
- echo "[Installing LibPNG...]";echo -e "\a";sleep 6
- cd libpng-1.2.8
- cp scripts/makefile.linux makefile
- make test
- make install
- cd ..
- rm -R libpng-1.2.8
- ##### Jpeg #####
- echo "[Installing Jpeg...]";echo -e "\a";sleep 6
- cd jpeg-6b
- mkdir /usr/local/man/man1
- ./configure --prefix=/usr/local --enable-shared --enable-static
- make && make install
- cd ..
- rm -R jpeg-6b
- ##### GD Library #####
- echo "[Installing GD Library...]";echo -e "\a";sleep 6
- cd gd-2.0.33
- ./configure --prefix=/usr/local \
- --with-jpeg=/usr/local \
- --with-freetype=/usr/local \
- --with-png \
- --with-zlib
- make && make install
- cd ..
- rm -R gd-2.0.33
- ##### ClibPDF #####
- echo "[Installing ClibPDF...]";echo -e "\a";sleep 6
- cd ClibPDF/source
- cp Makefile.Linux makefile
- make && make install
- cd ../../
- rm -R ClibPDF
- ##### LibIconv #####
- echo "[Installing LibIconv...]";echo -e "\a";sleep 6
- cd libiconv-1.9.2
- ./configure --prefix=/usr/local
- make && make install
- cd ..
- rm -R libiconv-1.9.2
- ##### cURL #####
- echo "[Installing cURL...]";echo -e "\a";sleep 6
- cd curl-7.14.0
- ./configure --prefix=/usr/local
- make && make install
- cd ..
- rm -R curl-7.14.0
- ##### PHP #####
- echo "[Installing PHP...]";echo -e "\a";sleep 6
- cd php-4.4.0
- ./configure --prefix=/server/php \
- --with-apxs2=/server/httpd/bin/apxs \
- --with-gd=/usr/local \
- --enable-gd \
- --enable-gd-native-ttf \
- --with-jpeg-dir=/usr/local \
- --with-png \
- --with-ttf \
- --with-zlib \
- --with-zlib-dir \
- --with-freetype-dir=/usr/local \
- --enable-magic-quotes \
- --with-mysql=/server/mysqld \
- --with-mysql-sock=/tmp/mysql.sock \
- --with-iconv=/usr/local \
- --with-curl=/usr/local \
- --with-mbstring \
- --enable-mbstring \
- --enable-track-vars \
- --enable-force-cgi-redirect \
- --enable-ftp \
- --with-config-file-path=/server/conf \
- --with-openssl=/usr/local \
- --with-openssl-dir=/usr/local \
- --with-cpdflib=/usr/local \
- --with-pear=/server/php/pear
- make && make install
- cp php.ini-dist /server/conf/php.ini
- cd ..
- rm -R php-4.4.0
- #########################################################################
- ##### mod_deflate #####
- echo "[Installing mod_deflate...]";echo -e "\a";sleep 6
- /server/httpd/bin/apxs -i -c -a httpd-2.0.54/modules/filters/mod_deflate.c
- rm -R httpd-2.0.54
- ##### mod_limitipconn #####
- echo "[Installing mod_limitipconn...]";echo -e "\a";sleep 6
- /server/httpd/bin/apxs -i -c -a mod_limitipconn-0.22/mod_limitipconn.c
- rm -R mod_limitipconn-0.22
- ##### Bandwidth Module #####
- echo "[Installing Bandwidth Module...]";echo -e "\a";sleep 6
- /server/httpd/bin/apxs -i -c -a bw_mod-0.6/bw_mod-0.6.c
- rm -R bw_mod-0.6
- ##### Apache DoS Evasive Maneuvers Module #####
- echo "[Installing Apache DoS Evasive Maneuvers Module...]";echo -e "\a";sleep 6
- /server/httpd/bin/apxs -i -c -a mod_dosevasive/mod_dosevasive20.c
- rm -R mod_dosevasive
- ##### Configure Install #####
- echo "[Configuring...]";echo -e "\a";sleep 6
- sed -i 's/\#ExtendedStatus On/ExtendedStatus On/g' /server/conf/httpd.conf
- sed -i 's/\#NameVirtualHost \*/NameVirtualHost \*/g' /server/conf/httpd.conf
- cp /server/httpd/bin/apachectl /etc/init.d/httpd
- cp /server/mysqld/share/mysql/mysql.server /etc/init.d/mysqld
- ##### Run Time #####
- cp -R /server/conf /server/conf-bak
- sed -i 's/ServerAdmin you\@example\.com/\#ServerAdmin you\@example\.com/g' /server/conf/httpd.conf
- sed -i 's/\/server\/httpd\/htdocs/\/data\/vhosts\/localhost/g' /server/conf/httpd.conf
- sed -i 's/Options Indexes FollowSymLinks/Options FollowSymLinks/g' /server/conf/httpd.conf
- sed -i 's/DirectoryIndex index.html index.html.var/DirectoryIndex index.html index.htm index.php/g' /server/conf/httpd.conf
- sed -i 's/AddHandler cgi-script \.cgi/AddHandler cgi-script \.cgi \.pl/g' /server/conf/httpd.conf
- sed -i 's/UserDir public_html/\#UserDir public_html/g' /server/conf/httpd.conf
- ln -s /etc/init.d/httpd /etc/rc2.d/S20httpd
- ln -s /etc/init.d/httpd /etc/rc3.d/S20httpd
- ln -s /etc/init.d/httpd /etc/rc4.d/S20httpd
- ln -s /etc/init.d/httpd /etc/rc5.d/S20httpd
- ln -s /etc/init.d/mysqld /etc/rc2.d/S20mysqld
- ln -s /etc/init.d/mysqld /etc/rc3.d/S20mysqld
- ln -s /etc/init.d/mysqld /etc/rc4.d/S20mysqld
- ln -s /etc/init.d/mysqld /etc/rc5.d/S20mysqld
- echo "[Ending...]"
- echo $SECONDS "Seconds"
复制代码
原文: http://bbs.micronsky.net/viewtopic.php?t=390 |
|