Continue to summarize and learn shell script and improve deployment efficiency. This time, PHP 5.3.10 + nginx1.0.12 + PostgreSQL 9.1.2 source code compilation is automatically deployed for the first version. lnpp can freely choose the installation address, at the same time, I would like to thank Meng Ge and Qing Ge for their inspiration.
The detailed decomposition address is as follows:
PHP 5.3.10 + nginx1.0.12 + PostgreSQL 9.1.2 source code compilation
Http://blog.csdn.net/qzier_go/article/details/7252887
The automatic deployment script is as follows (with annotations)
#!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATH# Check if user is rootif [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script, please use root to install lnpp" exit 1ficlearecho "========================================================================="echo "lnpp install shell script for CentOS/RadHat Written by Qzi"echo "creatred in 2012/2/13"echo "last modified in 2012/2/18"echo "========================================================================="echo "========================================================================="echo "PHP Version: 5.3.10"echo "========================================================================="echo "========================================================================="echo "PostgreSQL Version: 9.1.2"echo "========================================================================="echo "========================================================================="echo "nginx Version: 1.0.12"echo "========================================================================="LNPP_SRC_ROOT=$(pwd)LNPP_ROOT=/tmp/lnppPG_ROOT=$LNPP_ROOT/pgsqlPHP_ROOT=$LNPP_ROOT/phpPHP_EXTRA_LIBS=$PHP_ROOT/3rdlibsNGINX_ROOT=$LNPP_ROOT/nginxif [ -d $LNPP_ROOT ]; then echo "lnpp will install in $LNPP_ROOT" else echo "lnpp is creating the directory $LNPP_ROOT" mkdir -p $LNPP_ROOTfirpm -qa|grep phprpm -e phpecho "========================================================================="echo "install dependences"echo "========================================================================="for packages in patch make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip autoconf;do yum -y install $packages; doneecho "============================check files=================================="if [ -s php-5.3.10.tar.gz ]; then echo "php-5.3.10.tar.gz [found]" else echo "Error: php-5.3.10.tar.gz not found!!!download now......" wget -c wget http://www.php.net/get/php-5.3.10.tar.gz/from/us.php.net/mirrorfiif [ -s libiconv-1.14.tar.gz ]; then echo "libiconv-1.14.tar.gz [found]" else echo "Error: libiconv-1.14.tar.gz not found!!!download now......" wget -c http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gzfiif [ -s pcre-8.21.tar.bz2 ]; then echo "pcre-8.21.tar.bz2 [found]" else echo "Error: pcre-8.21.tar.bz2 not found!!!download now......" wget http://downloads.sourceforge.net/project/pcre/pcre/8.21/pcre-8.21.tar.bz2fiif [ -s postgresql-9.1.2.tar.gz ]; then echo "postgresql-9.1.2.tar.gz [found]" else echo "Error: postgresql-9.1.2.tar.gz not found!!!download now......" wget http://ftp.postgresql.org/pub/source/v9.1.2/postgresql-9.1.2.tar.gzfiif [ -s nginx-1.0.12.tar.gz ]; then echo "nginx-1.0.12.tar.gz [found]" else echo "Error: nginx-1.0.12.tar.gz not found!!!download now......" wget http://nginx.org/download/nginx-1.0.12.tar.gzfiecho "============================check complete=================================="echo "============================postgresql install=================================="mkdir -p $PG_ROOTtar -zxvf postgresql-9.1.2.tar.gzif [ $(id -nu) == "postgres" ]; then echo "user postgres is not found ... " else echo "creating the user called 'postgres'" su - -c "useradd -M postgres"fichown -R postgres:postgres postgresql-9.1.2mkdir -p /opt/pgsql/etccd postgresql-9.1.2/./configure --prefix=$PG_ROOT --sysconfdir=$PG_ROOT/etcmake && make installmkdir /opt/pgsql/logs/chown postgres:postgres /opt/pgsql/logs/mkdir -p $PG_ROOT/datachown postgres:postgres $PG_ROOT/datasu postgres$PG_ROOT/bin/initdb -D $PG_ROOT/dataexitecho "============================postgresql complete=================================="echo "============================php install=================================="cd $LNPP_SRC_ROOTmkdir -p $PHP_EXTRA_LIBStar -zxf libiconv-1.14.tar.gz2cd libiconv-1.14./configure --prefix=$PHP_EXTRA_LIBS/libiconv-1.14/make && make installls $PHP_EXTRA_LIBS/libiconv-1.14/cd ../tar -jxf pcre-8.21.tar.bz2cd pcre-8.21./configure --prefix=$PHP_EXTRA_LIBS/pcre-8.21/make && make installcd ../mkdir -p $PHP_ROOT tar -zxvf php-5.3.10.tar.gzcd php-5.3.10./configure --prefix=$PHP_ROOT --with-config-file-path=$PHP_ROOT/etc --with-iconv-dir=$PHP_EXTRA_LIBS/libiconv-1.14 --with-pcre-dir=$PHP_EXTRA_LIBS/pcre-8.21 --with-pgsql=$PG_ROOT --enable-fpmmake ZEND_EXTRA_LIBS = -liconvmake installcd ../echo "============================php complete================================="echo "============================nginx install================================="mkdir -p $NGINX_ROOTtar -zxvf nginx-1.0.12.tar.gzcd nginx-1.0.12 if [ $(id -nu) == "nginx" ]; then echo "user nginx is not found ... " else echo "creating the user called 'nginx'" su - -c "useradd -M nginx"fi./configure --user=nginx --group=nginx --prefix=$NGINX_ROOT --with-http_ssl_module --with-pcre=$LNPP_SRC_ROOT/pcre-8.21make && make installcd ../echo "============================nginx complete================================="exit 0
1. Modify row 28th: lnpp_root =/tmp/lnpp. You can change the installation address;
2. PG does not initialize data, which is controlled by the user.
3. Two usernames are automatically created: nginx and ipvs.
The product environment deployment is not suitable for the script I wrote. This script is mostly used for development and adjustment, so the directory deployment is not strictly installed with FHS for deployment, the idea of script layout runs through the idea of unified under a single directory and easy to back up.
Lnpp. Sh is here
Https://code.google.com/p/lnpp/
We have established a PHP Group. Welcome to join us (QQ Group No.: 213572677)
Reference:
Https://writer.zoho.com/public/6b6a49b6dcbb8205336873dd09e1b3517a451cd1e1176acb29ac6183f6c6c0976db04614eed231e5
Http://lnmp.org/
Http://www.pathname.com/fhs/