博主用的是系统是centos6.5shell脚本################################################################################### #!/bin/bash #Date: 13:19 2018-1-13 #Author: create by xpp #QQ: 610109797 #Blog: www.xuepanpan.com #version:1.1 . /etc/init.d/functions nginx_name='nginx-1.6.3.tar.gz' nginx_download_path='http:///download/nginx-1.6.3.tar.gz' mysql_name='mysql-5.5.49-linux2.6-x86_64.tar.gz' mysql_download_path='http://dev./get/Downloads/MySQL-5.5/mysql-5.5.49-linux2.6-x86_64.tar.gz' php_name='php-5.5.26.tar.gz' php_download_path='http://museum./php5/php-5.5.26.tar.gz' nginx_config=" worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { root html; index index.php index.html index.htm; } location ~ .*\.(php|php5)?$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } } } " install_nginx(){ yum install pcre-devel openssl-devel -y [ -f $nginx_name ] ||{ wget $nginx_download_path [ $? -ne 0 ] &&{ echo "nginx Download fail" exit 0 } } tar zxf $nginx_name && cd nginx-1.6.3 useradd nginx -s /sbin/nologin -M ./configure --user=nginx --group=nginx --prefix=/application/nginx-1.6.3/ --with-http_stub_status_module --with-http_ssl_module [ $? -eq 0 ] && make && make install [ $? -eq 0 ] &&{ echo "nginx install success" ln -s /application/nginx-1.6.3 /application/nginx } cd } config_nginx(){ cp /application/nginx/conf/nginx.conf /application/nginx/conf/nginx.cnf.xpp echo $nginx_config >/application/nginx/conf/nginx.conf mv /application/nginx/html/* ./ echo "<?php phpinfo();?>" >/application/nginx/html/index.php } start_nginx(){ /application/nginx/sbin/nginx if [ $(netstat -lutnp|grep 80|wc -l) -eq 1 ] then action "nginx starting success..." /bin/true else echo "nginx starting fail,plaese check the service!" fi } install_mysql(){ [ -f $mysql_name ] ||{ wget $mysql_download_path [ $? -ne 0 ] &&{ echo "nginx Download fail" exit 0 } } groupadd mysql useradd -s /sbin/nologin -g mysql -M mysql tar zxvf $mysql_name && mv mysql-5.5.49-linux2.6-x86_64 /application/mysql-5.5.49 ln -s /application/mysql-5.5.49 /application/mysql mkdir -p /application/mysql/data chown -R mysql.mysql /application/mysql/ \cp /application/mysql/support-files/my-small.cnf /etc/my.cnf mkdir -p /application/mysql/data chown -R mysql.mysql /application/mysql /application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql \cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld } config_mysql(){ sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on chkconfig --list mysqld echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile export PATH=/application/mysql/bin:$PATH } start_mysql(){ /etc/init.d/mysqld start if [ $(netstat -lutnp|grep 3306|wc -l) -eq 1 ] then action "mysql starting success..." /bin/true else echo "mysql starting fail,plaese check the service!" fi } install_php(){ yum install -y zlib-devel libxm12-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel wget http://ftp./pub/gnu/libiconv/libiconv-1.14.tar.gz tar zxvf libiconv-1.14.tar.gz && cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make && make install wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum -y install libmcrypt-devel mhash mcrypt mhash mcrypt openldap openldap-devel cp -frp /usr/lib64/libldap* /usr/lib/ cd /root [ -f $php_name ] ||{ wget $php_download_path [ $? -ne 0 ] &&{ echo "nginx Download fail" exit 0 } } tar zxvf php-5.5.26.tar.gz && cd php-5.5.26 ./configure \ --prefix=/application/php-5.5.26 \ --with-mysql=/application/mysql \ --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 \ --with-gettext \ --with-ldap \ --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-soap \ --enable-short-tags \ --enable-static \ --with-xsl \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --enable-ftp \ --enable-opcache=no [ $? -eq 0 ] &&{ ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/ touch ext/phar/phar.phar make && make install } [ $? -eq 0 ] &&{ ln -s /application/php-5.5.26/ /application/php cp php.ini-production /application/php/lib/php.ini cp /application/php/etc/php-fpm.conf.default /application/php/etc/php-fpm.conf echo "php install success" } } start_php(){ /application/php/sbin/php-fpm if [ $(netstat -lutnp|grep 9000|wc -l) -eq 1 ] then action "php-fpm starting success..." /bin/true else echo "php-fpm starting fail,plaese check the service!" fi } install_nginx config_nginx install_mysql config_mysql install_php start_nginx start_mysql start_php
|
|