LNMP One-click Deployment script
Personal gitpage:https://owelinux.github.io/
#!/bin/bash# #DATE: 2016-7-25# #USER: owelinux## #install wallet###### #install mysql################################# ################ #yum-y install cmake ncurses-devel bison libaio make gcc gcc-c++mkdir-p/application/toolscd/applica Tion/toolswget http://pkgs.fedoraproject.org/repo/pkgs/community-mysql/mysql-boost-5.7.14.tar.gz/ F90464874ee635ff63c436d1b64fe311/mysql-boost-5.7.14.tar.gztar xvf mysql-boost-5.7.14.tar.gzcd Mysql-5.7.14/cmake. -dcmake_install_prefix=/application/mysql/-dmysql_datadir=/data/mysqldata/mysql21406/-DWITH_MYISAM_STORAGE_ Engine=1-dwith_innobase_storage_engine=1-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-ddownload_ boost=1-ddownload_boost=1-dwith_boost=./boost/#boost路径修改一下 point to your source path Make-j4 && make Installgroupadd mysqluser Add-m-G mysql-s/sbin/nologin mysqlchown-r mysql:mysql/application/mysqlmkdir-p/data/mysqldata/mysql21406mkdir/dat A/mysqldata/mysql21406/binlogmkdir/data/mysqldata/mysql21406/relaylogchmod 750/data/mYsqldata/mysql21406/binlogchmod 750/data/mysqldata/mysql21406/relaylogchown-r mysql:mysql/data/mysqldata/* # Initialize mysql/application/mysql/bin/mysqld--initialize--user=mysql--basedir=/application/mysql/--datadir=/data/ Mysqldata/mysql21406/data/application/mysql/bin/mysql_ssl_rsa_setup-d/data/mysqldata/mysql21406/data/# Upload mys.cnf configuration file cd/data/mysqldata/mysql21406chown-r mysql:mysql/data/mysqldata/mysql21406# Modify configuration file Vim/data/mysqldata /mysql21406/my.cnf# Start Mysql/application/mysql/bin/mysqld_safe--defaults-file=/data/mysqldata/mysql21406/my.cnf- -user=mysql &/application/mysql/bin/mysql-uroot-s/data/mysqldata/mysql21406/mysql.sock-p# Setting the root password set PASSWORD =password (' root '); Set PASSWORD for Username=password (' New PASSWORD '), create database Zabbix character Set UTF8 collate utf8_bin;grant all PR Ivileges on zabbix.* to ' Zabbix ' @ '% ' identified by ' Zabbix '; flush privileges;# set boot from start echo "Export path=\ $PATH:/applicati On/mysql/bin ">>/etc/profile Source/etc/profileecho '/applIcation/mysql/bin/mysqld_safe--defaults-file=/data/mysqldata/mysql21406/my.cnf--user=mysql & ' >>/etc/ Rc.local #安装nginx ###################################################### #useradd-M-s/sbin/nologin nginx#mkdir-p/ Var/log/nginx#cd/application/tools#wget Http://nginx.org/download/nginx-1.10.1.tar.gz#tar ZXVF NGINX-1.10.1.TAR.GZ#CD nginx-1.10.1#yum-y Install epel-release#yum-y install OpenSSL openssl-devel gcc C pcre pcre-deve L bzip2-devel libcurl-devel libpng-devel libmcrypt-devel libxml2-devel readline-devel freetype freetype-devel#./ Configure--user=nginx--group=nginx--prefix=/application/nginx--with-http_stub_status_module--with-http_ssl_ Module#make && make installyum-y install OpenSSL openssl-devel gcc C pcre pcre-devel bzip2-devel libcurl-devel L Ibpng-devel libmcrypt-devel libxml2-devel readline-devel gd-devel perl-devel perl-extutils-embed# installation openrestyyum-y Install epel-releaseyum-y install OpenSSL openssl-devel gcc C pcre pcre-devel bzip2-develLibcurl-devel libpng-devel libmcrypt-devel libxml2-devel libxslt-devel readline-devel gd-devel perl-devel Perl-extutils-embedmkdir-p/application/toolscd/application/toolswget https://openresty.org/download/ Openresty-1.13.6.1.tar.gztar zxvf OPENRESTY-1.13.6.1.TAR.GZCD openresty-1.13.6.1./configure--prefix=/application/ Openresty--with-http_iconv_module--with-luajit--user=nginx--group=nginx--with-select_module--with-poll_module- -with-threads--with-ipv6--with-http_v2_module--with-http_ssl_module--with-http_realip_module--with-http_ Addition_module--with-http_xslt_module--with-http_xslt_module=dynamic--with-http_image_filter_module-- With-http_image_filter_module=dynamic--with-http_sub_module--with-http_gunzip_module--with-http_gzip_static_ Module--with-http_auth_request_module--with-http_random_index_module--with-http_secure_link_module--with-http_ Degradation_module--with-http_slice_module--with-http_stub_status_module--with-http_perl_module--with-http_ Perl_moduLe=dynamic--with-stream--with-stream=dynamic--with-stream_ssl_module--with-pcre--with-pcre-jitgmake-j4 & & gmake installuseradd-s/sbin/nologin-m nginxln-sv/application/openresty/nginx/application/nginxln-s/applicat Ion/openresty/nginx/sbin/nginx/usr/sbin/nginx/application/nginx/sbin/nginx # Set power on from start echo "Export path=\ $PATH:/ Application/openresty/nginx/sbin ">>/etc/profilesource/etc/profilechmod +x/etc/rc.localecho"/application/ Openresty/nginx/sbin/nginx ">>/etc/rc.localmkdir-p/data/tmp/nginx/client_tempmkdir-p/data/tmp/nginx/proxy _tempchmod 711/data/tmp/nginx# Installation php############################################## #yum-y install epel-release #cd/ Application/tools#wget http://www.atomicorp.com/installers/atomic#sh./atomicyum-y install gcc gcc-c++ c autoconf ma Ke mcrypt mhash zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml 2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel OpenSSL openssl-devel OpenLDAP ope Nldap-devel nss_ldap openldap-clients openldap-servers libxslt libxslt-devel libmcrypt libmcrypt-devel libpng12 Libpng12-devel libcurl libcurl-devel readline-devel libxpm-devel GMP gmp-devel mysql-devel unixODBC unixodbc-devel Pspel L-devel net-snmp net-snmp-devel cd/application/toolswget HTTP://CN2.PHP.NET/DISTRIBUTIONS/PHP-7.1.2.TAR.GZTAR-ZXVF PHP-7.1.2.TAR.GZCD php-7.1.2./configure--PREFIX=/APPLICATION/PHP7--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd --with-iconv--with-iconv-dir=/usr/local/libiconv--with-freetype-dir--without-pear--with-fpm-user=nginx--wit H-fpm-group=nginx--with-jpeg-dir--with-png-dir--with-zlib--with-zlib-dir--with-bz2--with-xsl--with-x Mlrpc--with-mhash--with-mcrypt--with-gd--with-openssl--with-libxml-dir--with-readline--with-gette XT--with-pcre-regex--with-curl--disable-rpath--disable-ipv6--disable-debug--enable-xml--enable-bcmath--enable-shmop--enable-sysvsem --enable-sysvmsg--enable-sysvshm--enable-mbregex--enable-mysqlnd--enable-fpm--enable-mbstring--enable-g D-native-ttf--enable-pcntl--enable-sockets--enable-soap--enable-short-tags--enable-static--enable-ftp --enable-opcache=yes--enable-json--enable-zip--enable-exif--enable-inline-optimization #ln-S/APPLICATION/MYSQ l/lib/libmysqlclient.so.20/usr/lib64 make-j4 && make install echo "Export path="/application/php7/bin:\ $PATH " ">>/etc/profilesource/etc/profileecho"/APPLICATION/PHP7/SBIN/PHP-FPM ">>/etc/rc.local############## ##################################### #php7环境安装模块: # Install Emqttd#cd/application/tools#wget http://emqtt.io/static/ Brokers/emqttd-centos6.8-v2.1.0-beta.1.zip#unzip EMQTTD-CENTOS6.8-V2.1.0-BETA.1.ZIP#CD Emqttd#./bin/emqttd start# ./bin/emqttd_ctl status# Installing Memcache, Redis, YAF module #cd/aPplication/tools#wget Http://pecl.php.net/get/memcache-2.2.5.tgz#tar XF MEMCACHE-2.2.5.TGZ#CD memcache-2.2.5#/ Application/php/bin/phpize#./configure--with-php-config=/application/php/bin/php-config#make && Make Install # YAF Module Cd/application/toolswget https://pecl.php.net/get/yaf-3.0.5.tgztar-zxvf yaf-3.0.5.tgz CD yaf-3.0.5/ Application/php7/bin/phpize./configure--with-php-config=/application/php7/bin/php-configmake && Make install# Installing the Redis module Cd/application/toolswget https://github.com/phpredis/phpredis/archive/develop.zipunzip DEVELOP.ZIPCD phpredis-develop/application/php7/bin/phpize./configure--with-php-config=/application/php7/bin/ Php-configmake && make install# install Seaslog module Cd/application/toolswget https://pecl.php.net/get/ SEASLOG-1.6.9.TGZTAR-ZXVF SEASLOG-1.6.9.TGZCD Seaslog-1.6.9/application/php7/bin/phpize./configure-- With-php-config=/application/php7/bin/php-configmake && make install# installing RABBITMQ module yum-y Install CMAKECD/ Application/toolswGet HTTPS://GITHUB.COM/ALANXZ/RABBITMQ-C/RELEASES/DOWNLOAD/V0.8.0/RABBITMQ-C-0.8.0.TAR.GZTAR-ZXVF RABBITMQ-C-0.8.0.TAR.GZCD Rabbitmq-c-0.8.0#mkdir Build && CD build #cmake-dcmake_install_prefix=/usr/local/ Librabbitmq. #cmake--build. ./configure--prefix=/usr/local/rabbitmq-cmake-j4 && make Installcd/application/toolswget https:// PECL.PHP.NET/GET/AMQP-1.9.1.TGZTAR-ZXVF AMQP-1.9.1.TGZCD Amqp-1.9.1/application/php7/bin/phpize./configure-- With-php-config=/application/php7/bin/php-config--WITH-AMQP--with-librabbitmq-dir=/usr/local/rabbitmq-c/make- J4 && make install# #php7环境配置cd/application/tools/php-7.1.2\cp php.ini-production/application/php7/lib/ PHP.INICD/APPLICATION/PHP7/ETC\CP Php-fpm.conf.default PHP-FPM.CONFCD/APPLICATION/PHP7/ETC/PHP-FPM.D/\CP Www.conf.default www.conf/application/php7/sbin/php-fpm# finally in php.ini definition load module can be cat >>/application/php7/lib/ Php.ini<<eofdate.timezone = "Asia/shanghai" Extension=redis.soextension=seaslog.soextenSion=yaf.soextension = Amqp.soyaf.environ=cloudseaslog.default_basepath =/data/applog/wallet; default log root seaslog. Default_logger = default, logger directory Seaslog.disting_type = 1, and whether to Typ E Sub-file 1 is 0 no (default) Seaslog.disting_by_hour = 1; whether to divide one file per hour 1 is 0 no (default) Seaslog.use_buffer = 0 , whether buffer 1 is enabled is 0 no (default) seaslog.buffer_size = 0, buffer quantity is the default With buffer_size) Seaslog.level = 0; Logging level default 0 (all logs) Seaslog.trace_error = 1 Automatic Logging error default 1 (ON) seaslog.trace_exception = 0; Automatically record exception information default 0 (off) seaslog.defaul T_datetime_format = "Y:m:d h:i:s"; Date format configuration default "Y:m:d h:i:s" seaslog.appender = 1; Log storage media 1File 2TCP 3UDP (default = 1) Seaslog.remote_host = 127.0.0.1; receive IP default 127.0.0.1 (required when TCP or UDP is used) seas Log.remote_port = 514 Receive port default 514 (required when TCP or UDP is used) eof# restart Php-fpmpkill php-fpm/application/php7/sbin/php-fpm# service boot from CA T >>/etc/rc.local<<eof/application/php/sbin/php-fpm/application/nginx/sbin/nginx/application/mysql/ Bin/mysqld_safe--defaults-file=/data/mysqldata/mysql21406/my.cnf--user=mysql & EOF# kernels tuning Cat >>/etc/ Sysctl.conf<<eofnet.ipv4.tcp_max_syn_backlog = 65536net.core.netdev_max_backlog = 32768net.core.somaxconn = 32768net.core.wmem_default = 8388608net.core.rmem_default = 8388608net.core.rmem_max = 16777216net.core.wmem_max = 16777216net.ipv4.tcp_timestamps = 0net.ipv4.tcp_synack_retries = 2net.ipv4.tcp_syn_retries = 2net.ipv4.tcp_tw_ Recycle = 1#net.ipv4.tcp_tw_len = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_mem = 94500000 915000000 927000000net.ipv4.tcp_ Max_orphans = 3276800#net.ipv4.tcp_fin_timeout = 30#net.ipv4.tcp_keepalive_time = 120net.ipv4.ip_local_port_range = 1024x768 65535eof/sbin/sysctl-p
LNMP One-click Deployment scripts (including module installation, php7,openresty+ cache, etc.)