php 5.3.10 + nginx1.0.12 + PostgreSQL 9.1.2 源碼編譯自動化部署第一版

來源:互聯網
上載者:User

繼續總結整理學習shell script 同時提高部署效率,這次帶來 php 5.3.10 + nginx1.0.12 + PostgreSQL 9.1.2 源碼編譯自動化部署第一版,lnpp可以自由選擇安裝地址,同時感謝盟哥和卿哥帶來的一些靈感.

詳細地分解地址如下:

php 5.3.10 + nginx1.0.12 + PostgreSQL 9.1.2 源碼編譯

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

自動部署指令碼如下(其後有註解)

#!/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.修改第28行 :LNPP_ROOT=/tmp/lnpp,可以改變安裝地址;
2.pg並沒有初始化data,由使用者自己控制
3.其中會自動建立兩個使用者名稱:nginx 和 postgres

產品環境部署不適合我寫的這個指令碼,此指令碼更多的還是用於開發調整,所以目錄部署沒嚴格安裝FHS來部署,指令碼布局思路貫穿著統一在單目錄下和易於備份的思想。


lnpp.sh 在這裡

https://code.google.com/p/lnpp/


建立了一個php群,歡迎一起學習(QQ群號:213572677)

Reference:

https://writer.zoho.com/public/6b6a49b6dcbb8205336873dd09e1b3517a451cd1e1176acb29ac6183f6c6c0976db04614eed231e5

http://lnmp.org/

http://www.pathname.com/fhs/

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.