centos7 lamp+nginx搭建(附自动安装脚本)

查询 ip信息 ip addr
重启网络服务 systemctl restart network network.server
设置防火墙开放22端口 firewall-cmd –zone=public –add-port=22/tcp –permanent
重启防火墙 systemctl retart firewalld.service
首先我们先安装php;
linux安装 php
下载php:wget http://cn2.php.net/get/php-7.0.11.tar.gz/from/this/mirror
解压:tar -zxvf mirror
安装gcc:yum install gcc gcc+ libxml2-devel
编译:./configure –prefix=/usr/local/php7 –enable-fpm
make
sudo make install
执行1.php文件 /usr/local/php7/bin/php 1.php,

CGI,FAST-CGI,enable=fpm这三点不是很了解;
1. PHP 解释器是否嵌入 Web 服务器进程内部执行

mod_php 通过嵌入 PHP 解释器到 Apache 进程中,只能与 Apache 配合使用,而 cgi 和 fast-cgi 以独立的进程的形式出现,只要对应的Web服务器实现 cgi 或者 fast-cgi 协议,就能够处理 PHP 请求。

mod_php 这种嵌入的方式最大的弊端就是内存占用大,不论是否用到 PHP 解释器都会将其加载到内存中,典型的就是处理CSS、JS之类的静态文件是完全没有必要加载解释器。

2. 单个进程处理的请求数量

mod_php 和 fast-cgi 的模式在每个进程的生命周期内能够处理多个请求,而 cgi 的模式处理一个请求就马上销毁进程,在高并发的场景下 cgi 的性能非常糟糕。 

综上,如果对性能有极高的要求,可以将静态请求和动态请求分开,这时 Nginx + php-fpm 是比较好的选择。

PS: cgi、fastcgi 通常指 Web 服务器与解释器通信的协议规范,而 php-fpm 是 fastcgi 协议的一个实现。

然后安装mysql;

wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.15.tar.gz 下载
tar -zxvf mysql-5.7.15.tar.gz 解压
yum install cmake gcc-c++ ncurses-devel perl-Data-Dumper boost boost-doc boost-devel 安装依赖
然后进入mysql目录,用cmake进行安装;
这时,遇到一个问题;

报错:cmake -DCMAKE_STALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/home/mysql/data -DSYSCONFDIR=/etc -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1  -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock  -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DENABLED_DOWNLOADS=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0 -DMYSQL_MAINTAINER_MODE=0 -DWITH_SSL:STRING=bundled -DWITH_ZLIB:STRING=bundled -DDOWNLOAD_BOOST=1

原因分析:没有boost包
解决方法:
1、在预编译时添加相应的选项:cmake . -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
[root@kongxl mysql-5.7.6-m16]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
2、或者下载一个boost包,放到/usr/local/boost目录下,然后在cmake后面加选项-DWITH_BOOST=/usr/local/boost
[root@kongxl mysql-5.7.6-m16]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_BOOST=/usr/local/boost

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \   #安装路径
-DMYSQL_DATADIR=/usr/local/mysql/data       \    #数据文件存放位置
-DSYSCONFDIR=/etc              \                                  #my.cnf路径
-DWITH_MYISAM_STORAGE_ENGINE=1    \       #支持MyIASM引擎
-DWITH_INNOBASE_STORAGE_ENGINE=1 \     #支持InnoDB引擎
-DWITH_MEMORY_STORAGE_ENGINE=1 \        #支持Memory引擎
-DWITH_READLINE=1                    \                         #快捷键功能(我没用过)
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock      \   #连接数据库socket路径
-DMYSQL_TCP_PORT=3306                  \               #端口
-DENABLED_LOCAL_INFILE=1            \                #允许从本地导入数据
-DWITH_PARTITION_STORAGE_ENGINE=1  \   #安装支持数据库分区
-DEXTRA_CHARSETS=all                  \                   #安装所有的字符集
-DDEFAULT_CHARSET=utf8              \                   #默认字符
-DDEFAULT_COLLATION=utf8_general_ci

boost包地址http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz

用tar 解压 tar.bz2文件出错 debian:/usr/src# tar jxf linux-2.6.26.tar.bz2 tar:
bzip2: Cannot exec: No such file or directory tar: Error is not
recoverable: exiting now tar: Child returned status 2 tar: Error exit
delayed from previous errors 解决办法 安装bzip2软件包 apt-get install bzip2

下面,我们来安装apache服务;

[root@bogon httpd-2.4.23]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.23.tar.gz
解压
[root@bogon httpd-2.4.23]# ./configure --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... no
configure: error: APR not found.  Please read the documentation.
报错,安装APR http://apr.apache.org/download.cgi
[root@bogon null]# wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz
[root@bogon null]# wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.4.tar.gz
解压,mv重命名
[root@bogon null]# mv apr-1.5.2 apr
[root@bogon null]# mv apr-util-1.5.4 apr-util
[root@bogon null]# mv apr apr-util httpd-2.4.23/srclib/
然后安装pcre的依赖包https://sourceforge.net/projects/pcre/files/pcre/8.39/
[root@bogon null]# cd pcre-8.39/
[root@bogon pcre-8.39]# ./configure --prefix=/usr/local/pcre-8.39 make make install
[root@bogon httpd-2.4.23]# ./configure --prefix=/usr/local/apache -with-pcre=/usr/local/pcre-8.39/bin/pcre-config -with-included-apr make make install
[root@bogon httpd-2.4.23]# cd /usr/local/apache/bin/
[root@bogon bin]# ./apachetcl -k start
-bash: ./apachetcl: 没有那个文件或目录
[root@bogon bin]# ./apachectl -k start
AH00557: httpd: apr_sockaddr_info_get() failed for bogon
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

firewall-cmd –zone=public –add-port=80/tcp –permanent
systemctl retart firewalld.service

#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH
#INFO函数定义输出字体颜色,echo -e 表示保持字符串的特殊含义,$1表示字体颜色编号,$2表示等待程序执行时间,$3表示echo输出内容。
function INFO()
{
     echo -e "\e[$1;49;1m: $3 \033[39;49;0m"
     sleep "$2"
     echo ""
}
#非root用户不能执行该脚本
if  [ "$UID" != 0 ];
        then
          echo " "
                INFO 35 "0" "Must be root ro run this script."
        exit 1
fi
#USAGE函数定义脚本用法,可反复调用,basename其实就是脚本名,\n表示换行。
function USAGE()
{
        INFO 35 "0.1" "Please see the script of the usage:"
        basename=$(basename "$0")
        INFO \
          36 "0" \
          "$(echo -e "Usage: \n\n./$basename (apache|mysql|php) install \n./$basename apache (start|stop|restart) \n./$basename mysql (start|stop|restart)\n")"
}
#YUM_INSTALL函数安装依赖包,可反复调用,$@表示所有参数都分别被双引号引住"$1","$2",而$*表示所有这些参数都被双引号引住"$1$2"
function YUM_INSTALL()
{
        for a in $@; do
          INFO 32 1 "Install depend on the [ $a ]"
                yum -y install $a || exit 1
          if [ $a = "libXpm-devel" ]; then
               ln -s /usr/lib/x86_64-linux-gnu/libXpm.so /usr/lib/libXpm.so
          #elif [ $a = "libsasl2-dev" ]; then
          #     cp /usr/lib/x86_64-linux-gnu/libldap* /usr/lib/
          fi
        done
}
#INSTALL函数定义安装程序,可一反复调用,安装apache程序的时候要先安装3个依赖包,在安装mysql的时候要用cmake编译。$1表示要安装的程序,$2表示yum安装对应的依赖包,$3表示程序解压后的目录,$4表示程序源码包。
function INSTALL()
{
     YUM_INSTALL "$2" && cd $SOURCE_PATH
     [ -d $3 ] && rm -r $3; INFO 31 4 "Unpack the $4 installation package......"
     tar zxvf $4; cd $3 ; pwd ; INFO 32 4 "Configure the $1......"
            if [ $1 = apache ];
                then
                        cp -rf ../apr-1.4.8 srclib/apr
                        cp -rf ../apr-util-1.5.2 srclib/apr-util
               ./configure $5 || exit 1
     elif [ $1 = mysql ];
          then
               cmake $5 || exit 1
     elif [ $1 = openssl ];
          then
               ./config $5 || exit 1
     elif [ $1 = libpng ];
          then
               cp scripts/makefile.linux makefile
     elif [ $1 = jpegsrc.v6b.tar.gz ];
          then
               cp /usr/share/libtool/config.guess  ./
               cp /usr/share/libtool/config.sub ./
               ./configure $5 || exit 1
               mkdir -p  /usr/local/env/jpeg/bin
               mkdir -p  /usr/local/env/jpeg/lib
               mkdir -p  /usr/local/env/jpeg/include
               mkdir -p /usr/local/env/jpeg/man/man1
                 else
               ./configure $5 || exit 1
            fi
     INFO 36 3 "Compile $1......"
            make || exit 1 && INFO 34 4 "Install $1......" ; make install && INFO 33 4 "$1 installation is successful......"

     if [ $1 = mysql ];
          then
               echo $INSTALL_PATH/mysql/lib/mysql >> /etc/ld.so.conf
               /sbin/ldconfig && INFO 33 4 "Add $1 library file to ld.so.conf......"
     fi
     if [ $1 = libiconv ];
          then
               echo "/usr/local/env/libiconv/lib" >> /etc/ld.so.conf
               /sbin/ldconfig && INFO 33 4 "Add $1 library file to ld.so.conf......"
     fi
     if [ $1 = libxml2 ];
          then
               echo "/usr/local/env/libxml2/lib" >> /etc/ld.so.conf
                        /sbin/ldconfig && INFO 33 4 "Add $1 library file to ld.so.conf......"
     fi
     if [ $1 = libmcrypt ];
          then
               echo "/usr/local/env/libmcrypt/lib" >> /etc/ld.so.conf
                        /sbin/ldconfig && INFO 33 4 "Add $1 library file to ld.so.conf......"
     fi
     if [ $1 = mhash ];
          then
               echo "/usr/local/lib" >> /etc/ld.so.conf
               echo "/usr/local/lib64" >> /etc/ld.so.conf
                        /sbin/ldconfig && INFO 33 4 "Add $1 library file to ld.so.conf......"
     fi
     if [ $1 = gettext ];
          then
                        echo "/usr/local/env/gettext/lib" >> /etc/ld.so.conf
                        /sbin/ldconfig && INFO 33 4 "Add $1 library file to ld.so.conf......"
     fi
     if [ $1 = gd ];
          then
               sed -i '27 a void (*data);' /usr/local/env/gd/include/gd_io.h
               echo "/usr/local/env/gd/lib" >> /etc/ld.so.conf
                        /sbin/ldconfig && INFO 33 4 "Add $1 library file to ld.so.conf......"
     fi
     if [ $1 = freetype ];
          then
               echo "/usr/local/env/freetype/lib" >> /etc/ld.so.conf
                        /sbin/ldconfig && INFO 33 4 "Add $1 library file to ld.so.conf......"
     fi
     if [ $1 = jpegsrc.v6b.tar.gz ];
                then
                        echo "/usr/local/env/jpeg/lib" >> /etc/ld.so.conf
                        /sbin/ldconfig && INFO 33 4 "Add jpeg library file to ld.so.conf......"
     fi
}
#SERVICE函数定义程序启动,关闭,重启。
function SERVICE()
{
     if [ $1 = apache -a $2 = start ]; then
          $INSTALL_PATH/$1/bin/apachectl -k start && \
          INFO 33 "2.5" "Apache startup success......"
          exit
     elif [ $1 = apache -a $2 = stop ]; then
          $INSTALL_PATH/$1/bin/apachectl -k stop && \
          INFO 31 "2.5" "Apache has stopped......"
          exit
     elif [ $1 = apache -a $2 = restart ]; then
          $INSTALL_PATH/$1/bin/apachectl -k stop ; sleep 2
          INFO 31 "2.5" "Apache has stopped......"
          $INSTALL_PATH/$1/bin/apachectl -k start && \
          INFO 34 "2.5" "Apache has restarted......"
          exit
     elif [ $1 = mysql -a $2 = start ]; then
          /bin/bash $INSTALL_PATH/$1/bin/mysqld_safe --defaults-file=$INSTALL_PATH/$1/my.cnf 2>&1 > /dev/null &
          INFO 33 "2.5" "Mysql startup success......"
          echo -e "$(netstat -ntpl|grep "/:::3306")"
          exit
     elif [ $1 = mysql -a $2 = stop ]; then
          kill $(netstat -ntpl|awk '/:::3306/{print $NF}'|awk -F '/' '{print $1}') && \
          INFO 31 "2.5" "Mysql has stopped......"
          exit
     elif [ $1 = mysql -a $2 = restart ]; then
          kill $(netstat -ntpl|awk '/:::3306/{print $NF}'|awk -F '/' '{print $1}') && \
          INFO 31 "3" "Mysql has stopped......"
          /bin/bash $INSTALL_PATH/$1/bin/mysqld_safe --defaults-file=$INSTALL_PATH/$1/my.cnf 2>&1 > /dev/null &
          INFO 34 "2.5" "Mysql has restarted......"
          exit
     fi
}
#CONFIG_MYSQL函数用来定义mysql的配置。
function CONFIG_MYSQL()
{
     INFO 32 3 "Configure the mysql......"
        groups mysql || groupadd mysql && id mysql || useradd -g mysql mysql
        cd $INSTALL_PATH/mysql ; pwd
                ./scripts/mysql_install_db \
                        --user=mysql \
                        --basedir=$INSTALL_PATH/mysql/ \
                        --datadir=$INSTALL_PATH/mysql/data/ \
                        --defaults-file=$INSTALL_PATH/mysql/my.cnf
        echo ""; sleep 3
        cp $(dirname $SOURCE_PATH)/conf/my.cnf ./
     INFO 35 2 "Mysql configuration is complete......"
}
#CONFIG_HTTPD函数用来配置apache。
function CONFIG_HTTPD()
{
     INFO 32 3 "Configure the apache......"
     echo -e "" > $INSTALL_PATH/apache/htdocs/phpinfo.php
     sed -i 's/^\ \ \ \ AddType application\/x-gzip .gz .tgz$/&\n\ \ \ \ AddType application\/x-httpd-php .php/' \
     $INSTALL_PATH/apache/conf/httpd.conf
     sed -i 's/^#ServerName www.example.com:80$/&\nServerName 127.0.0.1:80/' $INSTALL_PATH/apache/conf/httpd.conf
     INFO 35 2 "Apache configuration is complete......"
}
#CONFIG_PHP函数用来配置php。
function CONFIG_PHP()
{
     INFO 32 3 "Configure the php......"
     cp $SOURCE_PATH/$1/php.ini-development $INSTALL_PATH/php5/etc/php.ini
     INFO 35 2 "Php configuration is complete......"
}
#INSTALL_BRANCH函数定义程序安装,${TAR_NAME[@]}是shell脚本中数组写法,即取全部元素,即TAR_NAME里面的所有包,SERVER_NAME表示包的名称,COMPILE_DIR表示包名+版本后,即解压后的目录名。
function INSTALL_BRANCH()
{
     for i in ${TAR_NAME[@]}; do
             SERVER_NAME=$(echo $i|awk -F "-[0-9]" '{print $1}')
             COMPILE_DIR=$(echo $i|awk -F ".tar.gz" '{print $1}')
          if [ $1 = $SERVER_NAME -a $1 = apr ]; then
               INSTALL apr " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/apr"
          elif [ $1 = $SERVER_NAME -a $1 = apr-util ];then
               INSTALL apr-util " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/apr-util --with-apr=/usr/local/env/apr"
          elif [ $1 = $SERVER_NAME -a $1 = pcre ]; then
               INSTALL pcre " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/pcre"
          elif [ $1 = $SERVER_NAME -a $1 = httpd ]; then
               INSTALL apache "$HTTP_YUM" "$COMPILE_DIR" "$i" "$HTTP_PARAMETERS"
               CONFIG_HTTPD
          elif [ $1 = $SERVER_NAME -a $1 = mysql ]; then
               INSTALL mysql "$MYSQL_YUM" "$COMPILE_DIR" "$i" "$MYSQL_PARAMETERS"
               CONFIG_MYSQL
          elif [ $1 = $SERVER_NAME -a $1 = libiconv ]; then
               INSTALL libiconv " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/libiconv"
          elif  [ $1 = $SERVER_NAME -a $1 = libxml2 ]; then
               INSTALL libxml2 " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/libxml2 --with-iconv=/usr/local/env/libiconv"
          elif  [ $1 = $SERVER_NAME -a $1 = curl ]; then       
               INSTALL curl " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/curl --enable-utf8"
          elif  [ $1 = $SERVER_NAME -a $1 = libmcrypt ]; then                                  
               INSTALL libmcrypt " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/libmcrypt"
          elif  [ $1 = $SERVER_NAME -a $1 = mhash ]; then
               INSTALL mhash " " "$COMPILE_DIR" "$i" " "
          elif  [ $1 = $SERVER_NAME -a $1 = mcrypt ]; then
               INSTALL mcrypt " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/mcrypt \
               --with-libmcrypt-prefix=/usr/local/env/libmcrypt \
               --with-libiconv-prefix=/usr/local/env/libiconv"
          elif   [ $1 = $SERVER_NAME -a $1 = gettext ]; then
                        INSTALL gettext " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/gettext \
                        --with-libiconv-prefix=/usr/local/env/libiconv \
               --with-libxml2-prefix=/usr/local/env/libxml2"
          elif  [ $1 = $SERVER_NAME -a $1 = freetype ]; then
                        INSTALL freetype " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/freetype"
          elif  [ $1 = $SERVER_NAME -a $1 = jpegsrc.v6b.tar.gz ]; then
               COMPILE_DIR="jpeg-6b"
                        INSTALL jpegsrc.v6b.tar.gz " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/jpeg --enable-shared --enable-static"
          elif  [ $1 = $SERVER_NAME -a $1 = libpng ]; then
                        INSTALL libpng " " "$COMPILE_DIR" "$i" " "
          elif  [ $1 = $SERVER_NAME -a $1 = gd ]; then
               INSTALL gd " " "$COMPILE_DIR" "$i" "--prefix=/usr/local/env/gd --with-png=/usr \
               --with-freetype=/usr/local/env/freetype \
               --with-jpeg=/usr/local/env/jpeg  --with-fontconfig=/usr --with-xpm=/usr"
          elif  [ $1 = $SERVER_NAME -a $1 = openssl ]; then
               INSTALL openssl " " "$COMPILE_DIR" "$i" "-fPIC --prefix=/usr/local/env/openssl shared"
          elif  [ $1 = $SERVER_NAME -a $1 = php ]; then
               INSTALL php5 "$PHP5_YUM" "$COMPILE_DIR" "$i" "$PHP5_PARAMETERS"
               CONFIG_PHP "$COMPILE_DIR"
               break
          else
               continue
          fi
     done
}
#MOD_CASE函数用KASE定义选择安装程序。
function MOD_CASE()
{
     if [[ $1 =~ apache|mysql|php ]] && [[ $2 =~ install|start|stop|restart ]]; then
          INFO 32 "1.5" "Input the correct,according to the option to perform related operations......"
          echo ""
          if [ $2 = install ]; then
               case "$1 $2" in
                    "apache install")
                         INFO 35 "2.5" "Start to $1 the $2......"
                         INSTALL_BRANCH apr
                         INSTALL_BRANCH apr-util
                         INSTALL_BRANCH pcre
                         INSTALL_BRANCH httpd
                         ;;
                    "mysql install")
                         INFO 35 "2.5" "Start to $1 the $2......"
                         INSTALL_BRANCH mysql
                         ;;
                    "php install")
                         INFO 35 "2.5" "Start to $1 the $2......"
                         export LD_LIBRARY_PATH=/lib/:/usr/lib/:/usr/local/lib:/usr/local/lamp/mysql/lib
                         INSTALL_BRANCH libiconv
                         INSTALL_BRANCH libxml2
                         INSTALL_BRANCH curl
                         INSTALL_BRANCH libmcrypt
                         INSTALL_BRANCH mhash
                         INSTALL_BRANCH mcrypt
                         INSTALL_BRANCH gettext
                         INSTALL_BRANCH freetype
                         INSTALL_BRANCH jpegsrc.v6b.tar.gz
                         INSTALL_BRANCH libpng
                         INSTALL_BRANCH gd
                         INSTALL_BRANCH openssl
                         #INSTALL_BRANCH httpd && INSTALL_BRANCH mysql && INSTALL_BRANCH php
                         INSTALL_BRANCH php
                         ;;
               esac
          else
               SERVICE $1 $2
          fi
     else
               INFO 31 1 "Input error, please try again!"
               INPUT
     fi
}
#LAMP程序安装的目录
INSTALL_PATH="/usr/local/lamp"
#源码包存放目录
SOURCE_PATH="$(cd $(dirname $0); pwd)/install_tar"
#源码包列表
TAR_NAME=(httpd-2.4.4.tar.gz mysql-5.6.12.tar.gz php-5.4.17.tar.gz apr-1.4.8.tar.gz apr-util-1.5.2.tar.gz pcre-8.10.tar.gz freetype-2.4.0.tar.gz jpegsrc.v6b.tar.gz libxml2-2.7.2.tar.gz mhash-0.9.9.9.tar.gz mcrypt-2.6.8.tar.gz gd-2.0.35.tar.gz libiconv-1.14.tar.gz gettext-0.18.tar.gz libmcrypt-2.5.8.tar.gz openssl-0.9.8p.tar.gz curl-7.32.0.tar.gz libpng-1.2.33.tar.gz)
#Apache,Mysql,PHP yum安装依赖包
HTTP_YUM="build-essential libapr1 libapr1-dev libaprutil1 libaprutil1-dev gettext gettext-devel"
MYSQL_YUM="cmake libncurses5 libncurses5-dev bison"
PHP5_YUM="libxml2 libxml2-devel openssl libjpeg-devel bzip2 libXpm-devel libmcrypt-devel"
#Apache编译参数
HTTP_PARAMETERS="\
--prefix=$INSTALL_PATH/apache \
--enable-module=so \
--enable-module=rewrite \
--enable-shard=rewrite \
--enable-shared=max \
--with-apr=/usr/local/env/apr \
--with-apr-util=/usr/local/env/apr-util \
--with-pcre=/usr/local/env/pcre \
--with-included-apr \
"
#mysql编译参数
MYSQL_PARAMETERS="\
-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH/mysql \
-DYSQL_TCP_PORT=3306 \
-DMYSQL_DATADIR=$INSTALL_PATH/mysql/data \
-DMYSQL_UNIX_ADDR=$INSTALL_PAHT/mysql/mysql.sock \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_DEBUG=0 \
"
#PHP编译参数
PHP5_PARAMETERS="\
--prefix=$INSTALL_PATH/php5 \
--with-config-file-path=$INSTALL_PATH/php5/etc \
--with-mysql=$INSTALL_PATH/mysql \
--with-apxs2=$INSTALL_PATH/apache/bin/apxs \
--with-mysqli=$INSTALL_PATH/mysql/bin/mysql_config \
--with-iconv=/usr/local/env/libiconv \
--with-jpeg-dir=/usr/local/env/jpeg  \
--with-png-dir=/usr \
--with-libxml-dir=/usr/local/env/libxml2  \
--with-pdo-mysql \
--with-zlib \
--with-curl=/usr/local/env/curl \
--with-curlwrappers \
--with-mcrypt=/usr/local/env/libmcrypt \
--with-gd=/usr/local/env/gd  \
--with-openssl=/usr/local/env/openssl \
--with-mhash=/usr \
--with-xmlrpc \
--with-xpm-dir \
--with-freetype-dir=/usr/local/env/freetype \
--with-zlib-dir \
--with-ldap \
--with-ldap-sasl \
--with-pcre-regex \
--with-gettext=/usr/local/env/gettext \
--with-ncurses \
--enable-shared \
--enable-xml \
--enable-safe-mode \
--enable-track-vars \
--enable-magic-quotes \
--enable-bcmath \
--enable-sysvsem \
--enable-sysshm \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-gd-native-ttf \
--enable-pcntl \
--enable-sockets \
--enable-zip \
--enable-soap \
--enable-discard-path \
--enable-force-cgi-redirect \
--enable-pdo \
--enable-calendar \
--enable-exif \
--enable-zend-multibyte \
"
#--disable-rpath
#脚本调用帮助程序
if [ $# = 2 ]
     then
          INFO 33 "1.5" "please wait......"
          echo ""
          MOD_CASE "$1" "$2"
     else
          USAGE
          exit 1
fi

你可能感兴趣的:(Linux)