10># cat nginx_web_new.sh
#!/bin/bash
echo "get some sources"
LANG=C
#yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel freetype freetype-devel libjpeg-devel libtool-ltdl libtool-ltdl-devel libjpeg-devel libpng-devel libevent.x86_64 libevent-devel.x86_64
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel freetype freetype-devel libjpeg-devel libtool-ltdl libtool-ltdl-devel libjpeg-devel libpng-devel libevent.x86_64 libevent-devel.x86_64
cat >>/etc/security/limits.conf<
* soft nofile 51200
* hard nofile 51200
EOF
echo "start install PHP 5.2.14 lib"
tar zxvf libiconv-1.12.tar.gz
cd libiconv-1.12/
./configure --prefix=/usr/local
make
make install && echo "libiconv Installation is complete!!! " >lnmp_install_log
cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install && echo "libmcrypt Installation is complete!!! " >>lnmp_install_log
cd ../
cd ../
#tar zxvf mhash-0.9.9.tar.gz
tar zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9/
cd mhash-0.9.9.9/
./configure
make
make install && echo "mhash Installation is complete!!! " >>lnmp_install_log
cd ../
echo "start install GeoIP 1.4.6 lib"
tar zxvf GeoIP.tar.gz
cd GeoIP-1.4.6
./configure && make && make install && echo "GeoIP Installation is complete!!! " >>lnmp_install_log
cd ../
ln -s /usr/local/lib/libGeoIP.so.1 /usr/lib/libGeoIP.so.1
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
####for X86*64
ln -s /usr/local/lib/libGeoIP.so.1 /usr/lib64/libGeoIP.so.1
ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
tar zxvf mcrypt-2.6.7.tar.gz
cd mcrypt-2.6.7/
/sbin/ldconfig
./configure
make
make install && echo "mcrypt Installation is complete!!! " >>lnmp_install_log
cd ../
#ln -sv /usr/lib64/mysql/libmysqlclient.so /usr/lib/libmysqlclient.so
echo "start install MySQL 5.1.48"
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar zxvf mysql-5.1.48.tar.gz
#tar zxvf mysql-5.1.30.tar.gz
cd mysql-5.1.48/
./configure --prefix=/usr/local/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-innodb
make
make install && echo "mysql-5.1.48 Installation is complete!!! " >>lnmp_install_log
mkdir -p /var/lib/mysql
chmod +w /usr/local/mysql
chmod +w /usr/local/mysql
chown -R mysql:mysql /var/lib/mysql
cd ../
rm -f /etc/my.cnf
cp my-bak.cnf /usr/local/mysql/my.cnf
echo "install mysql-lib"
rpm -ivh MySQL-shared-community-5.1.31-0.rhel5.i386.rpm
cp pureftpd-mysql-bak.conf /etc/pureftpd-mysql.conf
/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
/bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf &
ln -s /usr/local/mysql/bin/* /usr/bin/
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
cp mysql /etc/init.d/mysql
ln -sv /usr/lib64/mysql/libmysqlclient.so /usr/lib/libmysqlclient.so
echo "start install PHP"
#tar zxvf php-5.2.8.tar.gz
tar zxvf php-5.2.14.tar.gz
#gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1
gzip -cd php-5.2.14-fpm-0.5.14.diff.gz| patch -d php-5.2.14 -p1
#cd php-5.2.8/
cd php-5.2.14/
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --enable-zip
make ZEND_EXTRA_LIBS='-liconv'
make install && echo "php-5.2.14 Installation is complete!!! " >>lnmp_install_log
cd ../
rm -f /etc/php.ini
cp php-bak.ini /usr/local/php/etc/php.ini
echo "start install PHP extra"
#tar zxvf memcache-2.2.4.tgz
tar xzvf memcache-2.2.6.tgz
#cd memcache-2.2.4/
cd memcache-2.2.6
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install && echo "memcache-2.2.6 Installation is complete!!! " >>lnmp_install_log
cd ../
#tar jxvf eaccelerator-0.9.5.3.tar.bz2
tar jxvf eaccelerator-0.9.6.1.tar.bz2
#cd eaccelerator-0.9.5.3/
cd eaccelerator-0.9.6.1
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make
make install && echo "eaccelerator Installation is complete!!! " >>lnmp_install_log
cd ../
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make
make install && echo "PDO_MYSQL Installation is complete!!! " >>lnmp_install_log
cd ../
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install && echo "ImageMagick Installation is complete!!! " >>lnmp_install_log
cd ../
tar zxvf imagick-2.3.0.tgz
cd imagick-2.3.0/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install && echo "imagick Installation is complete!!! " >>lnmp_install_log
cd ../
tar zxvf APC-3.1.6.tgz
cd APC-3.1.6/
/usr/local/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/usr/local/php/bin/php-config
make
make install && echo "APC Installation is complete!!! " >>lnmp_install_log
cd ../
tar zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
mkdir -p /usr/local/Zend/lib
cp /data0/software/centos/ZendOptimizer-3.3.3-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer.so /usr/local/Zend/lib/
echo "config eAccelerator"
mkdir -p /usr/local/eaccelerator_cache
cat >>/etc/sysctl.conf<
kernel.shmmax = 134217728
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 5000 65000
EOF
/sbin/sysctl -p
echo "add www:www"
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
echo "config php-fpm"
rm -f /usr/local/php/etc/php-fpm.conf
cp php-fpm-bak.conf /usr/local/php/etc/php-fpm.conf
echo "start php-cgi"
ulimit -SHn 51200
/usr/local/php/sbin/php-fpm start
#tar zxvf pcre-7.8.tar.gz
tar xzvf pcre-8.12.tar.gz
#cd pcre-7.8/
cd pcre-8.12
./configure
make && make install && echo "pcre-8.12 Installation is complete!!! " >>lnmp_install_log
cd ../
echo "install Nginx 1.0.4"
#tar -zxvf nginx-0.8.34.tar.gz
tar -xzvf nginx-1.0.4.tar.gz
tar -zxvf ngx_cache_purge-1.0.tar.gz
cp -rf ngx_cache_purge-1.0 /usr/local
#cd nginx-0.8.34
cd nginx-1.0.4
./configure --user=www --group=www --add-module=/usr/local/ngx_cache_purge-1.0 --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_geoip_module
make && make install && echo "nginx-1.0.4 Installation is complete!!! " >>lnmp_install_log
cd ../
echo "start install GeoIP country and city DATABASES lib"
gzip -d GeoLiteCity.dat.gz
mv GeoLiteCity.dat /usr/local/nginx/conf/GeoLiteCity.dat
gzip -d GeoIP.dat.gz
mv GeoIP.dat /usr/local/nginx/conf/GeoIP.dat
rm -f /usr/local/nginx/conf/nginx.conf
cp nginx-bak.conf /usr/local/nginx/conf/nginx.conf
cp fcgi-bak.conf /usr/local/nginx/conf/fcgi.conf
cat >>/etc/rc.local<
ulimit -SHn 51200
/usr/local/php/sbin/php-fpm start
/usr/local/nginx/sbin/nginx
/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
EOF
echo "config Nginx log"
cp cut_nginx_log-bak.sh /usr/local/nginx/sbin/cut_nginx_log.sh
cp ngx-bak.sh /usr/local/nginx/sbin/ngx.sh
cp rewrite-bak.conf /usr/local/nginx/conf/rewrite.conf
cp proxy-bak.conf /usr/local/nginx/conf/proxy.conf
#yum -y install vixie-cron
cp root-bak /var/spool/cron/root
service crond restart
echo "install pure-ftpd"
tar zxvf pure-ftpd-1.0.21.tar.gz
cd pure-ftpd-1.0.21
./configure -prefix=/usr/local/pureftpd -with-mysql=/usr/local/mysql -with-paranoidmsg -with-welcomemsg -with-uploadscript -with-cookie -with-virtualchroot -with-virtualhosts -with-virtualroot -with-diraliases -with-quotas -with-sysquotas -with-ratios -with-ftpwho -with-throttling
make
make check
make install
cd configuration-file
chmod u+x pure-config.pl
cp pure-config.pl /usr/local/sbin/pure-config.pl
cd ../
cd ../
cp pure-ftpd-bak.conf /usr/local/etc/pure-ftpd.conf
echo "make dir"
mkdir -p /data1/logs
mkdir -p /data0/account
mkdir -p /data0/htdocs
chmod +w /data0
chmod +w /data1
chown -R www:www /data0
chown -R www:www /data1
chown www:www /usr/local/nginx/conf/nginx.conf
chmod -R 777 /usr/local/nginx/conf
echo "start Nginx"
ulimit -SHn 51200
/usr/local/nginx/sbin/nginx
echo "start pure-ftpd"
/usr/local/sbin/pure-config.pl /usr/local/etc/pure-ftpd.conf
service crond restart
service iptables restart
yum -y install ntp*
server ntpd start
/usr/sbin/groupadd products
/usr/sbin/useradd -s /sbin/nologin -g products products
mkdir -p /data0/products
chown -R products:products /data0/products
#tar -zxf ocaml-3.10.2.tar.gz
#cd ocaml-3.10.2
#./configure
#make world opt
#make install
#cd ../
#tar -zxf unison-2.27.57.tar.gz
#cd unison-2.27.57
#make UISTYLE=text
#make install
#cp ./unison /usr/local/bin
#cd ../
tar xzvf libpcap-0.9.4.tar.gz
cd libpcap-0.9.4
./configure && make && make install
cd ../
tar xzvf iftop-0.9.tar.gz
cd iftop-0.9
make && make install
cd ../
#yum -y install sendmail mailx
#/etc/rc.d/init.d/sendmail start
mkdir -p /data0/www
chown -R www:www /data0/www
rm -rf /etc/init.d/mysqld
cp mysqld /etc/init.d/
rm -rf /usr/local/nginx/conf/nginx.php
cp nginx.php /usr/local/nginx/conf/
rm -rf /usr/local/nginx/sbin/ngx.sh
cp ngx.sh /usr/local/nginx/sbin/
chmod +x mysqld
echo "configure iptables and start install SNMP"
chmod +x prelinux-11.5.bin
./prelinux-11.5.bin
echo "start phpmyadmin"
unzip phpmyadmin.zip
mv phpMyAdmin-3.2.2-all-languages /data0/www/phpmyadmin
chown -R www:www /data0/www
echo "Generate rsa public key "
su www
cd
ssh-keygen -t rsa
echo "The WEB SERVER installation was completed"
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel