PHP 5.4.10 + nginx1.0.12 + PostgreSQL 9.1.3 source code compilation automated deployment Second Edition

Source: Internet
Author: User
Tags postgresql version

PHP 5.3.10 + nginx1.0.12 + PostgreSQL 9.1.2 source code compilation automated deployment of the first version

Http://blog.csdn.net/qzier_go/article/details/7256560

This time, PHP 5.4.10 and PostgreSQL 9.1.3 are updated, automatically started, and standardized.

#!/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/3/3"echo "========================================================================="echo "========================================================================="echo "PHP Version: 5.4.10"echo "========================================================================="echo "========================================================================="echo "PostgreSQL Version: 9.1.3"echo "========================================================================="echo "========================================================================="echo "nginx Version: 1.0.12"echo "========================================================================="# prepare for futurePHP_VERSION=php-5.4.0PG_VERSION=postgresql-9.1.3NGINX_VERSION=nginx-1.0.12LNPP_SRC_ROOT=$(pwd)LNPP_ROOT=/tmp/lnpp/lnpp-0.04PG_ROOT=$LNPP_ROOT/pgsql/$PG_VERSIONPHP_ROOT=$LNPP_ROOT/php/$PHP_VERSIONPHP_EXTRA_LIBS=$PHP_ROOT/3rdlibsNGINX_ROOT=$LNPP_ROOT/nginx/$NGINX_VERSIONif [ -d $LNPP_ROOT ]; then  echo "lnpp will install in $LNPP_ROOT"  else  echo "lnpp is creating the directory $LNPP_ROOT"  mkdir -p $LNPP_ROOTfifor filename in $(rpm -aq|grep php)do     yum erase $filename     #yum erase $filename -ydoneecho "========================================================================="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 yum;do yum -y install $packages; doneecho "============================check files=================================="if [ -s $PHP_VERSION.tar.bz ]; then  echo "$PHP_VERSION.tar.gz [found]"  else  echo "Error: $PHP_VERSION.tar.gz not found!!!download now......"  wget -c http://cn2.php.net/get/$PHP_VERSION.tar.gz/from/cn.php.net/mirror fiif [ -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 $PG_VERSION.tar.gz ]; then  echo "$PG_VERSION.tar.gz [found]"  else  echo "Error: $PG_VERSION.tar.gz not found!!!download now......"  wget http://ftp.postgresql.org/pub/source/v9.1.3/$PG_VERSION.tar.gz # !!!!!!!!!!!!!!!!!!!!!!!!fiif [ -s $NGINX_VERSION.tar.gz ]; then  echo "$NGINX_VERSION.tar.gz [found]"  else  echo "Error: $NGINX_VERSION.tar.gz not found!!!download now......"  wget http://nginx.org/download/$NGINX_VERSION.tar.gzfiecho "============================check complete=================================="echo "============================postgresql install=================================="mkdir -p $PG_ROOTtar -zxvf $PG_VERSION.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 $PG_VERSIONmkdir -p $PG_ROOT/etc cd $PG_VERSIONmake clean./configure --prefix=$PG_ROOT --sysconfdir=$PG_ROOT/etcmakemake installmkdir -p $PG_ROOT/datamkdir -p $PG_ROOT/logstouch $PG_ROOT/logs/pgsql.logchown postgres:postgres $PG_ROOT/datasu postgres -c "$PG_ROOT/bin/initdb -D $PG_ROOT/data && exit"echo "============================postgresql complete=================================="echo "============================php install=================================="cd $LNPP_SRC_ROOTmkdir -p $PHP_EXTRA_LIBStar -zxf libiconv-1.14.tar.gz2cd libiconv-1.14make clean./configure --prefix=$PHP_EXTRA_LIBS/libiconv-1.14/makemake installls $PHP_EXTRA_LIBS/libiconv-1.14/cd ../tar -jxf pcre-8.21.tar.bz2cd pcre-8.21make clean./configure --prefix=$PHP_EXTRA_LIBS/pcre-8.21/makemake installcd ../mkdir -p $PHP_ROOT tar -zxvf $PHP_VERSION.tar.gz cd $PHP_VERSIONmake clean./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-fpm --with-pearmake ZEND_EXTRA_LIBS = -liconvmake installcp ./php.ini-production $PHP_ROOT/etc/php.inicp $PHP_ROOT/etc/php-fpm.conf.default $PHP_ROOT/etc/php-fpm.confcd ../echo "============================php complete================================="echo "============================nginx install================================="mkdir -p $NGINX_ROOTtar -zxvf $NGINX_VERSION.tar.gzcd $NGINX_VERSION  if [ $(id -nu) == "nginx" ]; then  echo "user nginx is not found ... "  else  echo "creating the user called 'nginx'"  su - -c "useradd -M nginx"fimake clean./configure --user=nginx --group=nginx --prefix=$NGINX_ROOT --with-http_ssl_module --with-pcre=$LNPP_SRC_ROOT/pcre-8.21makemake installcd ../echo "============================nginx complete================================="echo "============================starting lnpp================================="PHP=$PHP_ROOT/sbin/php-fpmNGINX=$NGINX_ROOT/sbin/nginxPGDAEMON=$PG_ROOT/bin/postmasterPGCTL=$PG_ROOT/bin/pg_ctlPGUSER=postgresPGDATA=$PG_ROOT/dataPGLOG=$PG_ROOT/logs/pgsql.logstop(){    echo "-------------stop php----------------"    ps -e | grep $(basename $PHP) | {      while read pid tty time cmd;      do        echo "killing $pid ==> $cmd"        kill -9 $pid      done    }    echo "-------------stop nginx--------------"ps -e | grep $(basename $NGINX) | {      while read pid tty time cmd;      do        echo "killing $pid ==> $cmd"        kill -9 $pid      done    }   # killproc $NGINX -QUIT    echo "-------------stop pgsql--------------"#    su  $PGUSER -c "$PGCTL stop -D '$PGDATA' -m fast"ps -e | grep $(basename $PGDAEMON) | {      while read pid tty time cmd;      do        echo "killing $pid ==> $cmd"        kill -9 $pid      done    }    echo "-------------stop pgsql--------------"}start(){echo "-------------start php---------------"$PHP_ROOT/sbin/php-fpmecho "-------------start success---------------"echo "-------------start nginx-------------"$NGINX_ROOT/sbin/nginxecho "-------------start success---------------"echo "-------------start pgsql---------------"su  $PGUSER -c "$PGDAEMON -D '$PGDATA' &" >>$PGLOG 2>&1echo "-------------start success---------------"}stopstartecho "============================lnpp started================================="exit 0

Notes:
1. Configure nginx. conf as follows (phpinfo. php is in the nginx/html directory)

Http://blog.csdn.net/qzier_go/article/details/7252887

2. php-FPM log and PID need to be configured in ETC/php-fpm.conf

Lnpp-0.04.sh is here

Http://code.google.com/p/lnpp/downloads/detail? Name = lnpp-0.04.sh & can = 2 & Q =

Insufficient individual tests. If you have any suggestions for correction, please emailto: hotseason007 @ gmail dot com

We have established a PHP Group. Welcome to join us (QQ Group No.: 213572677)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.