配置环境:
L:Centos 2.6.32-358.el6.x86_64
N:Nginx 1.7
M:Mysql5.7.3
P:PHP5.5.11
NGINX一键脚本:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
#!/bin/bash # Author:Byrd # Version:1.0 # Site:note.t4x.org # Contact:root#t4x.org # Compile and install NGINX BY:BYRD AT:2014-04-30 # This script for nginx1.4 nginx1.6 nginx1.7 # Define DownTools=/byrd/tools NginxWget=http://nginx.org/download/nginx-1.7.4.tar.gz Openssl=http://www.openssl.org/source/openssl-1.0.1h.tar.gz NginxVersion=nginx-1.7.4 InstallNginxDir=/byrd/service PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH LANG="en_US.UTF-8" # Check if user is root if [ $UID != "0" ]; then echo "Error: You must be root to run this script, please use root to install lnmp" exit 1 fi clear echo "=========================================================================" echo "============================Install Nginx================================" echo "=========================================================================" echo "=============================note.t4x.org=================================" echo "=========================================================================" # Create web user groupadd www useradd -s /sbin/nologin -g www www yum install pcre* openssl* openssl-devel gcc gcc-c++ wget vim -y # Create a file download directory [ ! -d $DownTools ] && mkdir -p $DownTools [ ! -d $InstallNginxDir ] && mkdir $InstallNginxDir cd $InstallNginxDir if [ ! -f openssl-1.0.1h.tar.gz ];then wget $Openssl || exit 1 && echo "Please changes Openssl URL" tar zxf openssl-1.0.1h.tar.gz cd openssl-1.0.1h ./config make else tar zxf openssl-1.0.1h.tar.gz cd openssl-1.0.1h ./config make fi RETVAL1=$? if [ $RETVAL1 -eq 0 ];then echo "Openssl installed successfully" else exit $RETVAL1 fi cd $DownTools wget $NginxWget tar zxf $NginxVersion.tar.gz cd $NginxVersion ./configure --user=www --group=www --prefix=$InstallNginxDir/$NginxVersion --with-openssl=$InstallNginxDir/openssl-1.0.1h --with-pcre --with-http_ssl_module --with-http_spdy_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --with-ipv6 --with-http_sub_module && #./configure --user=www --group=www --prefix=/byrd/service/nginx-1.6.2 --with-openssl=/byrd/service/openssl-1.0.1j --with-pcre --with-http_ssl_module --with-http_spdy_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module #1.9.6./configure --user=www --group=www --prefix=/byrd/service/nginx-1.9.6 --with-openssl=/byrd/service/openssl-1.0.2d --with-pcre --with-http_ssl_module --with-http_v2_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --with-ipv6 --with-http_sub_module make && make install RETVAL2=$? if [ $RETVAL2 -eq 0 ];then echo "Nginx installed successfully" else exit $RETVAL2 fi ln -s $InstallNginxDir/$NginxVersion /usr/local/nginx /usr/local/nginx/sbin/nginx /bin/netstat -tunlp | /bin/grep 80 if [ -s /sbin/iptables ]; then /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT /sbin/iptables-save fi |
MySQL一键安装:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
#!/bin/bash # Author:Byrd # Version:1.0 # Site:note.t4x.org # Contact:root#t4x.org # This script for Mysql 5.6.16 # Check if user is root if [ $UID != "0" ]; then echo "Error: You must be root to run this script, please use root to install lnmp" exit 1 fi clear echo "=========================================================================" echo "Will automatically install mysql" echo "=========================================================================" MysqlInstall=/byrd/service DownMysqlTools=/byrd/tools MysqlUrl=http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.19.tar.gz Version=mysql-5.6.19 [ ! -d $DownMysqlTools ] && mkdir -p $DownMysqlTools [ ! -d $MysqlInstall ] && mkdir $MysqlInstall groupadd mysql useradd -s /sbin/nologin -g mysql mysql yum install pcre* openssl* openssl-devel gcc gcc-c++ cmake libaio* library* ncurses-* bison* -y cd $DownMysqlTools if [ ! -f $Version.tar.gz ];then wget $MysqlUrl tar zxf $Version.tar.gz cd $Version cmake . -DCMAKE_INSTALL_PREFIX=$MysqlInstall/$Version -DMYSQL_DATADIR=$MysqlInstall/$Version/data -DMYSQL_UNIX_ADDR=$MysqlInstall/$Version/tmp/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 && make && make install RETVAL1=$? elif [ -f $Version.tar.gz ];then tar zxf $Version.tar.gz cd $Version cmake . -DCMAKE_INSTALL_PREFIX=$MysqlInstall/$Version -DMYSQL_DATADIR=$MysqlInstall/$Version/data -DMYSQL_UNIX_ADDR=$MysqlInstall/$Version/tmp/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 && make && make install RETVAL1=$? else exit 1 fi if [ $RETVAL1 -eq 0 ];then echo "$Version install successful" else echo "$Version install failed." fi ln -s $MysqlInstall/$Version /usr/local/mysql /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql /bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld /bin/mv /etc/my.cnf /etc/my.cnf.backup /bin/cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf /etc/init.d/mysqld start if [ `netstat -tunlp | grep mysql |wc -l` -ne 0 ];then echo "$Version Starting successful" else echo "$Version Starting failed." fi |
PHP一键脚本:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
#!/bin/bash # Author:Byrd # Version:1.0 # Site:note.t4x.org # Contact:root#t4x.org PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH LANG="en_US.UTF-8" # Check if user is root if [ $UID != "0" ]; then echo "Error: You must be root to run this script, please use root to install lnmp" exit 1 fi clear echo "=========================================================================" echo "Install PHP5.5.11 BY:BYRD AT:2014-04-30" echo "=========================================================================" RETVAL=0 SoftTool=/byrd/tools Server=/byrd/server LibiconvUrl=http://ftp.gnu.org/gnu/libiconv/libiconv-1.9.2.tar.gz LibicoVern=libiconv-1.9.2 [ ! -d $SoftTool ] && mkdir -p $SoftTool [ ! -d $Server ] && mkdir $Server yum install zlib libjpeg freetype libpng gd curl zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel gcc gcc-c++ wget libxml* libtool* libxslt* -y cd $SoftTool if [ ! -f $LibicoVern.tar.gz ];then wget $LibiconvUrl || exit 1 && echo "$LibicoVern Download Error,Please try again" tar zxf $LibicoVern.tar.gz cd $LibicoVern ./configure --prefix=/usr/local/libiconv make && make install RETVAL1=$? elif [ -f $LibicoVern.tar.gz ];then tar zxf $LibicoVern.tar.gz cd $LibicoVern ./configure --prefix=/usr/local/libiconv make && make install RETVAL1=$? else exit 1 fi if [ `echo $RETVAL1` -eq $RETVAL ];then echo "$LibicoVern Install Successful" else echo "$LibicoVern Install Failured" exit `echo $RETVAL1` fi libmcryptUrl=http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz libmcryptVen=libmcrypt-2.5.8 cd $SoftTool if [ ! -f $libmcryptVen.tar.gz ];then wget $libmcryptUrl || exit 1 && echo "$libmcryptVen.tar.gz Download Error,Please try again" tar zxf $libmcryptVen.tar.gz cd $libmcryptVen ./configure make && make install RETVAL2=$? rm -f /usr/lib/libmcrypt.* rm -f /usr/lib/libmhash* ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config rm -f /usr/lib64/libmcrypt.* rm -f /usr/lib64/libmhash* ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la ln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so ln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a ln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la ln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so ln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2 ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib64/ ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18 ldconfig -v elif [ -f $libmcryptVen.tar.gz ];then tar zxf $libmcryptVen.tar.gz cd $libmcryptVen ./configure make && make install rm -f /usr/lib/libmcrypt.* rm -f /usr/lib/libmhash* ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config rm -f /usr/lib64/libmcrypt.* rm -f /usr/lib64/libmhash* ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la ln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so ln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a ln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la ln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so ln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2 ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib64/ ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18 ldconfig -v else exit 1 fi if [ `echo $RETVAL2` -eq $RETVAL ];then echo "$libmcryptVen Install Successful" else echo "$libmcryptVen Install Failured" exit `echo $RETVAL2` fi cd $SoftTool mhashUrl=http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz mhashDev=mhash-0.9.9.9 if [ ! -f $mhashDev.tar.gz ];then wget $mhashUrl tar zxf $mhashDev.tar.gz cd $mhashDev ./configure make && make install RETVAL3=$? else tar zxf $mhashDev.tar.gz cd $mhashDev ./configure make && make install RETVAL3=$? fi if [ `echo $RETVAL3` -eq $RETVAL ];then echo "$mhashDev Install Successful" else echo "$mhashDev Install Failured" exit `echo $RETVAL3` fi cd $SoftTool PhpUrl=http://am1.php.net/distributions/php-5.5.11.tar.gz PhpVen=php-5.5.11 if [ ! -f $PhpVen.tar.gz ];then wget $PhpUrl tar zxf $PhpVen.tar.gz cd $PhpVen ./configure --enable-opcache --prefix=$Server/$PhpVen --with-mysql=/usr/local/mysql/ --with-mysqli --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp make && make install RETVAL4=$? else tar zxf $PhpVen.tar.gz cd $PhpVen ./configure --enable-opcache --prefix=$Server/$PhpVen --with-mysql=/usr/local/mysql/ --with-mysqli --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp make && make install RETVAL4=$? fi if [ `echo $RETVAL4` -eq $RETVAL ];then echo "$PhpVen Install Successful" else echo "$PhpVen Install Failured" exit `echo $RETVAL4` fi ln -s $Server/$PhpVen /usr/local/php cp $SoftTool/$PhpVen/php.ini-production /usr/local/php/lib/php.ini mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf /usr/local/php/sbin/php-fpm -t /usr/local/php/sbin/php-fpm if [ `netstat -tunlp | grep php-fpm |wc -l` -ne 0 ];then echo "$PhpVen Starting successful" else echo "$PhpVen Starting failed." fi |
PHP参数设置:
0 1 2 |
[root@hz php-7.0.0]# ./configure --enable-opcache --prefix=/byrd/service/php-7.0.0 --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=http --with-fpm-group=http --enable-ftp --disable-fileinfo --enable-mysqlnd --with-openssl --with-gettext ./configure --enable-opcache --prefix=/opt/php-7.4.12 --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype --with-jpeg --with-zlib --with-libxml=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --enable-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=http --with-fpm-group=http --enable-ftp --disable-fileinfo --enable-mysqlnd --with-openssl --with-gettext |
0 |
./configure --enable-opcache --prefix=/Byrd/service/php-5.5.11 --with-mysql=/usr/local/mysql/ --with-mysqli --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=bywww --with-fpm-group=bywww --enable-ftp --disable-fileinfo --with-pdo-mysql --with-gettext |
申明:本文由BYRD原创(基于Centos6.4 X64、PHP5.5.11、NGINX1.7、MYSQL5.7.3),未经许可禁止转载! SourceByrd's Weblog-https://note.t4x.org/code/centos-nginx-mysql-php/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!
Trackbacks