#!/bin/bash
yum -y
install
wget
wget http:
//cloud
.github.com
/downloads/libevent/libevent/libevent-2
.0.21-stable.
tar
.gz
wget http:
//nginx
.org
/download/nginx-1
.3.8.
tar
.gz
wget http:
//www
.cmake.org
/files/v2
.8
/cmake-2
.8.6.
tar
.gz
wget http:
//ftp
.gnu.org
/gnu/bison/bison-2
.5.1.
tar
.gz
wget http:
//cdn
.mysql.com
/Downloads/MySQL-5
.5
/mysql-5
.5.30.
tar
.gz
wget http:
//ncu
.dl.sourceforge.net
/project/qdbm/qdbm/1
.8.77
/qdbm-1
.8.77.
tar
.gz
wget http:
//ftp
.gnu.org
/pub/gnu/libiconv/libiconv-1
.14.
tar
.gz
wget http:
//fossies
.org
/linux/www/gd-2
.0.35.
tar
.gz
wget http:
//sourceforge
.net
/projects/mcrypt/files/Libmcrypt/2
.5.8
/libmcrypt-2
.5.8.
tar
.bz2
/download
wget http:
//sourceforge
.net
/projects/mhash/files/mhash/0
.9.9.9
/mhash-0
.9.9.9.
tar
.bz2
/download
wget http:
//sourceforge
.net
/projects/mcrypt/files/MCrypt/2
.6.8
/mcrypt-2
.6.8.
tar
.gz
/download
wget http:
//cronolog
.org
/download/cronolog-1
.6.2.
tar
.gz
wget http:
//cn2
.php.net
/distributions/php-5
.4.14.
tar
.gz
wget http:
//ncu
.dl.sourceforge.net
/project/pcre/pcre/8
.11
/pcre-8
.11.
tar
.gz
printf
"========install the compile tool=============\n"
yum -y
install
gcc gcc-c++ openssl-devel ncurses ncurses-devel zlib-devel
bzip2
bzip2
-devel curl-devel libjpeg-devel libxml2* libpng* freetype* libxslt*
tar
zxvf pcre-8.11.
tar
.gz -C
/usr/local/src/
tar
zxvf libevent-2.0.21-stable.
tar
.gz -C
/usr/local/src/
tar
zxvf nginx-1.3.8.
tar
.gz -C
/usr/local/src/
tar
zxvf cmake-2.8.6.
tar
.gz -C
/usr/local/src/
tar
zxvf bison-2.5.1.
tar
.gz -C
/usr/local/src/
tar
zxvf mysql-5.5.30.
tar
.gz -C
/usr/local/src/
tar
zxvf libiconv-1.14.
tar
.gz -C
/usr/local/src/
tar
zxvf qdbm-1.8.77.
tar
.gz -C
/usr/local/src/
tar
zxvf gd-2.0.35.
tar
.gz -C
/usr/local/src/
tar
zxvf mcrypt-2.6.8.
tar
.gz -C
/usr/local/src/
tar
zxvf cronolog-1.6.2.
tar
.gz -C
/usr/local/src/
tar
zxvf php-5.4.14.
tar
.gz -C
/usr/local/src/
tar
jxvf libmcrypt-2.5.8.
tar
.bz2 -C
/usr/local/src/
tar
jxvf mhash-0.9.9.9.
tar
.bz2 -C
/usr/local/src/
echo
"===========nginx Relevant source package is installed========== "
echo
"##### pcre install#####"
cd
/usr/local/src/pcre-8
.11/
.
/configure
--prefix=
/usr/local/pcre
&&
make
&&
make
install
printf
"====pcre is ok====\n"
echo
"#####libevent install######"
cd
/usr/local/src/libevent-2
.0.21-stable/
.
/configure
--prefix=
/usr/local/libevent
&&
make
&&
make
install
printf
"====libevent is ok====\n"
echo
"####nginx install######"
groupadd -r nginx
useradd
-r -g nginx -s
/bin/false
-M nginx
cd
/usr/local/src/nginx-1
.3.8/
.
/configure
--prefix=
/usr/local/nginx
--with-pcre=
/usr/local/src/pcre-8
.11/ --sbin-path=
/usr/local/nginx/sbin/nginx
--pid-path=
/usr/local/nginx/logs/nginx
.pid \
--with-http_gzip_static_module --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --user=nginx --group=nginx \
--http-proxy-temp-path=
/var/tmp/nginx/proxy/
--http-fastcgi-temp-path=
/var/tmp/nginx/fcgi/
--lock-path=
/var/lock/nginx
.lock --http-client-body-temp-path=
/var/tmp/nginx/client/
\
&&
make
&&
make
install
printf
"======nginx is ok!!======\n"
mkdir
-pv
/var/tmp/nginx/
cat
>>
/etc/init
.d
/nginx
<< EOF
nginxd=
/usr/local/nginx/sbin/nginx
nginx_config=
/usr/local/nginx/conf/nginx
.conf
nginx_pid=
/usr/local/nginx/logs/nginx
.pid
RETVAL=0
prog=
"nginx"
.
/etc/rc
.d
/init
.d
/functions
.
/etc/sysconfig/network
[ ${NETWORKING} =
"no"
] &&
exit
0
[ -x $nginxd ] ||
exit
0
start() {
if
[ -e $nginx_pid ];
then
echo
"nginx already running…."
exit
1
fi
echo
-n $
"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] &&
touch
/var/lock/subsys/nginx
return
$RETVAL
}
stop() {
echo
-n $
"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] &&
rm
-f
/var/lock/subsys/nginx
/usr/local/nginx/logs/nginx
.pid
}
reload() {
echo
-n $
"Reloading $prog: "
killproc $nginxd -HUP
RETVAL=$?
echo
}
case
"$1"
in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo
"Usage: $prog {start|stop|restart|reload|status|help}"
exit
1
esac
exit
$RETVAL
EOF
chmod
+x
/etc/init
.d
/nginx
chkconfig --add nginx
chkconfig --level 35 nginx on
service nginx restart
echo
"===========mysql Relevant source package is installed========== "
useradd
-M -s
/sbin/nologin
mysql
echo
"##### cmake install#####"
cd
/usr/local/src/cmake-2
.8.6
.
/bootstrap
&& gmake && gmake
install
printf
"====cmake is ok====\n"
echo
"##### bison install#####"
cd
/usr/local/src/bison-2
.5.1/
.
/configure
&&
make
&&
make
install
printf
"====bison is ok====\n"
echo
"##### mysql install#####"
cd
/usr/local/src/mysql-5
.5.30/
cmake -DCMAKE_INSTALL_PREFIX=
/usr/local/mysql
-DMYSQL_UNIX_ADDR=
/tmp/mysql
.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=
/var/mysql/data
&&
make
&&
make
install
printf
"====mysql is ok====\n"
cp
/usr/local/mysql/support-files/my-medium
.cnf
/etc/my
.cnf
cp
/usr/local/mysql/support-files/mysql
.server
/etc/init
.d
/mysqld
/usr/local/mysql/scripts/mysql_install_db
--user=mysql --basedir=
/usr/local/mysql/
--datadir=
/var/mysql/data
/usr/local/mysql/bin/mysqld_safe
--user=mysql
chmod
-R 755
/usr/local/mysql
chown
-R mysql:mysql
/usr/local/mysql
chown
-R mysql:mysql
/var/mysql/data
chkconfig --add mysqld
chkconfig --level 35 mysqld on
service mysqld restart
read
-p
"please set up password for mysql:"
pwd
/usr/local/mysql/bin/mysqladmin
-u root password $
pwd
export
PATH=$PATH:
/usr/local/mysql/bin/
echo
"PATH=$PATH:/usr/local/mysql/bin"
>>
/etc/profile
ln
-s
/usr/local/mysql/bin/
*
/usr/local/bin/
ln
-s
/usr/local/mysql/lib/
*
/usr/lib
ln
-s
/usr/local/mysql/include/mysql/
*
/usr/include/
echo
"===========php Relevant source package is installed========== "
echo
"####libiconv install####"
cd
/usr/local/src/libiconv-1
.14/
.
/configure
--prefix=
/usr/local/libiconv
&&
make
&&
make
install
printf
"====libiconv is ok====\n"
echo
"####qdbm install#####"
cd
/usr/local/src/qdbm-1
.8.77/
.
/configure
--prefix=
/usr/local/qdbm
--
enable
-devel --
enable
-zlib --
enable
-iconv &&
make
&&
make
install
printf
"====qdbm is ok====\n"
echo
"####gd install####"
cd
/usr/local/src/gd-2
.0.35/
.
/configure
--prefix=
/usr/local/gd2
--with-jpeg --with-png --with-zlib --with-freetype &&
make
&&
make
install
printf
"====gd is ok====\n"
sed
-i
'/\*gd_free/a\void (*data);'
/usr/local/gd2/include/gd_io
.h
echo
"/usr/local/gd2/lib"
>>
/etc/ld
.so.conf
ldconfig
echo
"####libmcrypt and libltdl install####"
cd
/usr/local/src/libmcrypt-2
.5.8/
.
/configure
--prefix=
/usr/local/libmcrypt
&&
make
&&
make
install
ldconfig
cd
/usr/local/src/libmcrypt-2
.5.8
/libltdl
.
/configure
--prefix=
/usr/local/libltdl
--
enable
-ltdl-
install
&&
make
&&
make
install
ln
-sf
/usr/local/lib/libmcrypt
.*
/usr/lib
ln
-sf
/usr/local/bin/libmcrypt-config
/usr/bin
printf
"====libmcrypt and libltdl is ok====\n"
echo
"####mhash install####"
cd
/usr/local/src/mhash-0
.9.9.9/
.
/configure
--prefix=
/usr/local/mhash
&&
make
&&
make
install
ln
-sf
/usr/local/lib/libmhash
.*
/usr/lib/
printf
"====mhash is ok====\n"
echo
"####mcrypt install####"
cd
/usr/local/src/mcrypt-2
.6.8/
/sbin/ldconfig
.
/configure
--prefix=
/usr/local/mcrypt
&&
make
&&
make
install
printf
"====mcrypt is ok====\n"
echo
"####cronolog install####"
cd
/usr/local/src/cronolog-1
.6.2
.
/configure
--prefix=
/usr/local/cronolog
&&
make
&&
make
install
printf
"====cronolog is ok====\n"
echo
"####php install#####"
ln
-sf
/usr/local/mysql/lib/libmysqlclient
.so.18
/usr/lib
ln
-sf
/usr/local/qdbm/lib/libqdbm
.so*
/usr/lib
cd
/usr/local/src/php-5
.4.14
.
/configure
--prefix=
/usr/local/php5
--with-config-
file
-path=
/usr/local/php5/etc
--with-mysql=
/usr/local/mysql
\
--with-iconv=
/usr/local/libiconv
--with-gd=
/usr/local/gd2
--with-iconv-
dir
=
/usr/local
--with-pdo-mysql=
/usr/local/mysql
\
--with-libxml-
dir
=
/usr
--with-qdbm=
/usr/local/qdbm
--with-mime-magic=
/usr/share/file/magic
--with-jpeg-
dir
--with-png-
dir
--with-freetype-
dir
\
--with-bz2 --with-zlib --without-pear --with-xmlrpc --with-zlib-
dir
--with-curl --with-curlwrappers --with-mcrypt=
/usr/local/libmcrypt
--with-mhash \
--with-ttf --with-xsl --with-gettext --with-pear --with-openssl --
enable
-discard-path --
enable
-gd-native-ttf \
--
enable
-bcmath --
enable
-shmop --
enable
-sysvsem --
enable
-inline-optimization --
enable
-mbregex --
enable
-xml \
--
enable
-soap --
enable
-calendar --
enable
-wddx --
enable
-dba --
enable
-gd-native-ttf--
enable
-calendar --
enable
-safe-mode \
--
enable
-
ftp
--
enable
-fpm --
enable
-zip --
enable
-mbstring --
enable
-bcmath --
enable
-sockets --
enable
-exif --
enable
-magic-quotes --disable-rpath --disable-debug \
&&
make
&&
make
install
printf
"====php is ok====\n"
ln
-s
/usr/local/php5/bin/
*
/usr/local/bin/
ln
-s
/usr/local/php5/sbin/
*
/usr/local/sbin/
cp
/usr/local/src/php-5
.4.14
/php
.ini-production
/usr/local/php5/php
.ini
cp
/usr/local/php5/etc/php-fpm
.conf.default
/usr/local/php5/etc/php-fpm
.conf
sed
-i
'/run/s/;//g'
/usr/local/php5/etc/php-fpm
.conf
sed
-i
'/^ /d'
/usr/local/php5/etc/php-fpm
.conf
sed
-i
's/nobody/nginx/g'
/usr/local/php5/etc/php-fpm
.conf
sed
-i
'/start/s/2/20/'
/usr/local/php5/etc/php-fpm
.conf
sed
-i
'/min/s/1/5/'
/usr/local/php5/etc/php-fpm
.conf
sed
-i
'/max_spare/s/3/25/'
/usr/local/php5/etc/php-fpm
.conf
sed
-i
'/max_children/s/5/35/'
/usr/local/php5/etc/php-fpm
.conf
/usr/local/sbin/php-fpm
sed
-i
'/\<user\>/a user nginx;'
/usr/local/nginx/conf/nginx
.conf
sed
-i
'/\<index\>/s/index.html index.htm/index.html index.htm index.php/g'
/usr/local/nginx/conf/nginx
.conf
cat
>>
/usr/local/nginx/html/test
.php << EOF
<?php
$link=mysql_connect(
'localhost'
,
'root'
,
'123456'
);
if
($link)
echo
"<h1>lian jie mysql cheng gong!!</h1>"
;
mysql_close();
?>
EOF
service nginx restart
copy所有的内容到linux新建的文件中,然后给文件赋予权限,然后执行,自动执行,漫长的过程,
自己运行这个脚本是木有出错的