微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

LNMP环境一键部署

  1 #!/bin/bash
  2 #用于安装LNMP环境
  3 
  4 [ ! -d /software/ ] && mkdir /software
  5 
  6 #功能选择菜单
  7 menu(){
  8         echo -e "\033[31;32m                              LNMP编译安装脚本                                 \033[0m"
  9         echo -e "\033[31;32m================================================================================\033[0m"
 10         echo -e "\033[34m   此脚本能直接在rhel7.5、Centos 7.5上成功执行   \033[0m"
 11         echo -e "\033[33m   安装包版本:  Nginx:1.14.0   MysqL5.7.23   PHP7.2.6   \033[0m"
 12         echo "   相关依赖包:pcre-devel、gd-devel、openssl、openssl-devel、PHP-MysqL、bzip2   "
 13         echo "               perl-devel、libxml2-devel bzip2-devel libcurl-devel   "
 14         echo -e "\033[47;34m------------安装需联网下载软件包,若下载地址失效,需自行更新下载地址------------\033[0m"
 15         echo -e "\033[31;32m================================================================================\033[0m"
 16         echo -e "\033[33m   Nginx安装目录:/usr/local/Nginx,日志目录:/data/logs/Nginx/   \033[0m"
 17         echo -e "\033[33m   MysqL安装目录:/usr/local/MysqL,数据存放目录:/data/MysqL/   \033[0m"
 18         echo -e "\033[33m   PHP安装目录:/usr/local/PHP7   \033[0m"
 19         echo -e "\033[31;32m================================================================================\033[0m"
 20         echo -e "\033[34m请选择:\033[0m"
 21         echo -e "\033[36m0、安装依赖包   1、安装Nginx   2、源码编译安装MysqL   3、安装PHP   \033[0m"
 22         echo -e "\033[36m4、整合NginxPHP   5、启动NginxMysqLPHP-fpm服务   \033[0m"
 23         echo -e "\033[36m6、一键安装并部署lnmp   7、退出脚本   \033[0m"
 24         echo -e "\033[31;32m================================================================================\033[0m"
 25         echo
 26         read -p "请输入数字:0-5[单独安装](单独安装需要先安装依赖包),6[一键安装],7[退出脚本]: " num
 27 }
 28 
 29 #(0)安装依赖包
 30 install_package(){
 31         cd /software
 32 
 33         yum install -y vim-enhanced lrzsz net-tools gcc rsync epel-release wget unzip curl
 34         yum install -y bzip2-devel openssl-devel gnutls-devel gcc gcc-c++ cmake ncurses-devel bison-devel libaio-devel openldap  openldap-devel
 35         yum install -y autoconf bison libxml2-devel libcurl-devel libevent libevent-devel gd-devel expat-devel numactl
 36 
 37         if [ ! -f libmcrypt-2.5.8.tar.gz ]
 38         then
 39             wget http://nchc.dl.sourceforge.net/project/mcrypt/libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
 40         fi
 41 
 42         [ ! -d libmcrypt-2.5.8 ] && tar -zxf libmcrypt-2.5.8.tar.gz
 43         cd libmcrypt-2.5.8
 44         ./configure && make && make install
 45 
 46         if [ $? -eq 0 ]
 47         then
 48                sleep 3
 49                echo -e "\033[36m==========依赖包安装成功==========\033[0m"
 50           else
 51                echo -e "\033[31m**********安装依赖包失败,请检查**********\033[0m"
 52         fi
 53 }
 54 
 55 #(1)编译安装Nginx
 56 install_Nginx(){
 57         cd /software
 58 
 59         #1、新建Nginx系统用户
 60         id Nginx &> /dev/null
 61         [ $? -ne 0 ] && useradd -r -s /sbin/nologin Nginx
 62 
 63         #2、新建Nginx日志存放目录
 64         [ ! -d /data/logs/Nginx/ ] &&  mkdir -pv /data/logs/Nginx/ && chown -R  Nginx:Nginx /data/logs/Nginx/
 65 
 66         #3、定义Nginx安装的版本
 67         Nginx_VERS=Nginx-1.14.0
 68 
 69         #4、下载Nginx
 70         if [ ! -f $Nginx_VERS.tar.gz ]
 71         then
 72            echo -e "\033[34m==========正在下载Nginx源码包==========\033[0m"
 73            curl -O  http://Nginx.org/download/$Nginx_VERS.tar.gz
 74         fi
 75 
 76         #5、解压下载包
 77         [ ! -d $Nginx_VERS ] && tar xf $Nginx_VERS.tar.gz
 78 
 79         #6、进入Nginx解压后的目录
 80         cd $Nginx_VERS
 81 
 82         #7、编译安装
 83         ./configure --prefix=/usr/local/Nginx \
 84         --user=Nginx \
 85         --group=Nginx \
 86         --http-log-path=/data/logs/Nginx/access.log \
 87         --error-log-path=/data/logs/Nginx/error.log \
 88         --with-http_ssl_module \
 89         --with-http_realip_module \
 90         --with-http_flv_module \
 91         --with-http_mp4_module \
 92         --with-http_gunzip_module \
 93         --with-http_gzip_static_module \
 94         --with-http_image_filter_module \
 95         --with-http_stub_status_module &&  make && make install
 96 
 97         if [ $? -eq 0 ]
 98         then
 99                sleep 3
100                echo -e "\033[36m==========Nginx编译安装成功==========\033[0m"
101         else
102                echo -e "\033[31m**********Nginx编译安装失败,请检查**********\033[0m"
103                exit 1
104         fi
105     
106         cat > /usr/lib/systemd/system/Nginx.service << EOF
107 [Unit]
108 Description=The Nginx HTTP and reverse proxy server
109 After=network.target remote-fs.target nss-lookup.target
110 
111 [Service]
112 Type=forking
113 PIDFile=/run/Nginx.pid
114 # Nginx will fail to start if /run/Nginx.pid already exists but has the wrong
115 # SELinux context. This might happen when running \`Nginx -t\` from the cmdline.
116 # https://bugzilla.redhat.com/show_bug.cgi?id=1268621
117 ExecStartPre=/usr/bin/rm -f /run/Nginx.pid
118 ExecStartPre=/usr/local/Nginx/sbin/Nginx -t
119 ExecStart=/usr/local/Nginx/sbin/Nginx
120 ExecReload=/bin/kill -s HUP \$MAINPID
121 KillSignal=SIGQUIT
122 TimeoutStopSec=5
123 KillMode=process
124 PrivateTmp=true
125 
126 [Install]
127 WantedBy=multi-user.target
128 EOF
129         systemctl enable Nginx && systemctl daemon-reload
130 }
131 
132 #(2)源码编译安装MysqL
133 install_MysqL(){
134         cd /software
135 
136         VERSION=5.7.23      #MysqL版本
137 
138         if [ ! -f MysqL-$VERSION.tar.gz ]
139         then
140             #下载MysqL
141             echo -e "\033[34m==========下载MysqL源码包==========\033[0m"
142             curl -o MysqL-$VERSION.tar.gz https://mirrors.tuna.tsinghua.edu.cn/MysqL/downloads/MysqL-5.7/MysqL-$VERSION-linux-glibc2.12-x86_64.tar.gz
143         fi
144 
145         # 1、创建MysqL用户
146         id MysqL &> /dev/null
147         [ $? -ne 0 ] && useradd -r -s /sbin/nologin MysqL
148 
149         #2、解压MysqL
150         echo -e "\033[34m==========解压MysqL...==========\033[0m"
151 
152         if [ -f MysqL-$VERSION.tar.gz ]
153         then
154            tar xvf MysqL-$VERSION.tar.gz
155            mv MysqL-$VERSION-* /usr/local/MysqL
156         fi
157     
158         #3、创建数据库数据存放目录、安装目录
159         [ ! -d  /data/MysqL/ ] && mkdir -pv /data/MysqL/
160         [ ! -f /usr/local/MysqL/log/error.log ] && mkdir -pv /usr/local/MysqL/log/ && touch /usr/local/MysqL/log/error.log
161         chown -R MysqL:MysqL  /data/MysqL/
162         chown -R MysqL:MysqL  /usr/local/MysqL/
163 
164         #4、初始化
165     
166         cd /usr/local/MysqL
167     
168         if [ $? -eq 0 ]
169         then
170             echo -e "\033[34m==========数据库开始初始化==========\033[0m"
171             ./bin/MysqLd --initialize-insecure --user=MysqL --basedir=/usr/local/MysqL/  --datadir=/data/MysqL/
172             if [ $? -eq 0 ]
173             then
174                 echo -e "\033[36m==========数据库初始化成功==========\033[0m"
175             else
176                 echo -e "\033[31m**********编译安装错误!初始化失败**********\033[0m"
177                 exit 1
178             fi
179         fi
180 
181         #5、配置数据库配置文件
182         cat > /etc/my.cnf << EOF
183 [client]
184 port    = 3306
185 socket = /usr/local/MysqL/tmp/MysqL.sock
186 
187 [MysqL]
188 default-character-set=utf8
189 
190 [MysqLd]
191 default-storage-engine=INNODB
192 character_set_server=utf8
193 explicit_defaults_for_timestamp
194 basedir=/usr/local/MysqL/
195 datadir=/data/MysqL/
196 socket=/usr/local/MysqL/tmp/MysqL.sock
197 log_error = /usr/local/MysqL/log/error.log
198 
199 sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
200 EOF
201 
202         [ ! -f /etc/init.d/MysqL ] && \cp  /usr/local/MysqL/support-files/MysqL.server /etc/init.d/MysqL
203         
204         sed -i '46s/basedir=/basedir=\/usr\/local\/MysqL/' /etc/init.d/MysqL
205         sed -i '47s/datadir=/datadir=\/data\/MysqL/' /etc/init.d/MysqL
206     
207         chmod +x /etc/init.d/MysqL
208     
209         #6、配置环境变量
210         n=`grep "/usr/local/MysqL/bin" /etc/profile |wc -l`
211     
212         if [ $n -eq 0 ]
213         then
214             echo "export PATH=$PATH:/usr/local/MysqL/bin" >> /etc/profile
215             source /etc/profile
216         else 
217             source /etc/profile
218         fi
219 
220         #7、创建日志目录、/var/run/MysqLd/
221         [ ! -d /var/log/MysqL/ ] && mkdir /var/log/MysqL/ && chown -R MysqL:MysqL /var/log/MysqL/
222         [ ! -d /var/run/MysqLd/ ] && mkdir /var/run/MysqLd/ && chown -R MysqL:MysqL /var/run/MysqLd/
223         [ ! -d /usr/local/MysqL/tmp/ ] && mkdir /usr/local/MysqL/tmp/ && chown -R MysqL:MysqL /usr/local/MysqL/tmp/
224     
225         #8、配置成MysqLd服务并启动
226         cat > /usr/lib/systemd/system/MysqLd.service << EOF
227 [Unit]
228 Description=MysqL Server
229 After=network.target
230 After=syslog.target
231 
232 [Install]
233 WantedBy=multi-user.target
234 
235 [Service]
236 User=MysqL
237 Group=MysqL
238 ExecStart=/usr/local/MysqL/bin/MysqLd --defaults-file=/etc/my.cnf
239 
240 #连接数限制
241 LimitNOFILE=65535
242 LimitNPROC=65535
243 
244 #Restart配置可以在进程被kill掉之后,让systemctl产生新的进程,避免服务挂掉
245 #Restart=always
246 PrivateTmp=false
247 EOF
248 
249         systemctl daemon-reload && systemctl enable MysqLd && systemctl start MysqLd && systemctl daemon-reload
250     
251         if [ $? -eq 0 ]
252         then
253             echo -e "\033[36m==========MysqL安装成功并启动==========\033[0m"
254         fi    
255        
256         n=`grep "/usr/local/MysqL/bin" /etc/profile |wc -l`
257     
258         if [ $n -eq 0 ]
259         then
260             echo "export PATH=$PATH:/usr/local/MysqL/bin" >> /etc/profile
261             source /etc/profile
262         else
263             source /etc/profile
264         fi
265         
266         MysqL -uroot -D MysqL -e "UPDATE user SET authentication_string=PASSWORD("123456789") WHERE user='root';"
267         MysqL -uroot -e "FLUSH PRIVILEGES;"
268         MysqL -uroot -p123456789 -e "grant all privileges on *.* to root@'%'  identified by '123456789';"
269     
270         if [ $? -eq 0 ]
271         then
272            echo -e "\033[36m==========数据库root密码修改为123456789成功==========\033[0m"
273         else
274            echo -e "\033[31m**********数据库root密码修改为123456789失败,为空**********\033[0m"
275         fi    
276 }
277 
278 #(3)编译安装PHP
279 install_PHP(){
280         cd /software
281         
282         PHPVERS=7.2.6       #PHP版本
283         DLOAD_PHP=http://mirrors.sohu.com/PHP/PHP-$PHPVERS.tar.gz  #PHP下载地址
284 
285         #0 、创建PHP-fpm用户用户名PHP-fpm
286         id PHP-fpm &> /dev/null
287         [ $? -ne 0 ] && useradd -r -s /sbin/nologin PHP-fpm
288 
289         #1、下载PHP
290         [ ! -f  PHP-$PHPVERS.tar.gz ] && echo -e "\033[36m正在下载PHP源码包...\033[0m"  && curl -O $DLOAD_PHP
291 
292         #2、解压PHP
293         [ ! -d PHP-$PHPVERS/ ] && tar xf PHP-$PHPVERS.tar.gz
294         echo -e "\033[36m编译安装PHP需要很长时间,请慢慢等待...\033[0m"
295         sleep 3
296         cd PHP-$PHPVERS/
297 
298         #3、编译安装
299         ./configure  --prefix=/usr/local/PHP7 \
300         --with-config-file-path=/usr/local/PHP7/etc \
301         --with-MysqLi=MysqLnd  \
302         --with-pdo-MysqL=MysqLnd \
303         --with-MysqL=/usr/local/MysqL \
304         --with-MysqL-sock=/usr/local/MysqL/tmp/MysqL.sock \
305         --with-iconv-dir \
306         --with-freetype-dir \
307         --with-jpeg-dir \
308         --with-png-dir \
309         --with-zlib \
310         --with-bz2 \
311         --with-libxml-dir \
312         --with-curl \
313         --with-gd \
314         --with-openssl \
315         --with-mhash  \
316         --with-xmlrpc \
317         --with-pdo-MysqL \
318         --with-libmbfl \
319         --with-onig \
320         --with-pear \
321         --enable-xml \
322         --enable-bcmath \
323         --enable-shmop \
324         --enable-sysvsem \
325         --enable-inline-optimization \
326         --enable-mbregex \
327         --enable-fpm \
328         --enable-mbstring \
329         --enable-pcntl \
330         --enable-sockets \
331         --enable-zip \
332         --enable-soap \
333         --enable-opcache \
334         --enable-pdo \
335         --enable-MysqLnd-compression-support \
336         --enable-maintainer-zts  \
337         --enable-session \
338         --with-fpm-user=PHP-fpm \
339         --with-fpm-group=PHP-fpm  && make -j 2 && make -j 2 install
340 
341         if [ $? -eq 0 ]
342         then
343             echo -e "\033[36m==========PHP编译安装成功==========\033[0m"
344         else
345             echo -e "\033[31m**********PHP编译安装失败,请检查**********\033[0m"
346             exit 1
347         fi
348 
349         #4、配置PHP-fpm服务文件
350         [ ! -d /usr/local/PHP7/etc/ ] && mkdir /usr/local/PHP7/etc/
351         \cp PHP.ini-production  /usr/local/PHP7/etc/PHP.ini
352         sed -i '/post_max_size/s/8/16/g;/max_execution_time/s/30/300/g;/max_input_time/s/60/300/g;s#\;date.timezone.*#date.timezone \= Asia/Shanghai#g' /usr/local/PHP7/etc/PHP.ini
353         \cp sapi/fpm/init.d.PHP-fpm  /etc/init.d/PHP-fpm
354         chmod +x /etc/init.d/PHP-fpm
355 
356         #5、将PHP-fpm添加到系统服务
357         chkconfig --add PHP-fpm
358         chkconfig PHP-fpm on
359 
360         #6、PHP-fpm配置文件
361         cd /usr/local/PHP7/
362         cat > etc/PHP-fpm.conf << EOF
363 [global]
364 pid = /usr/local/PHP7/var/run/PHP-fpm.pid
365 error_log = /usr/local/PHP7/var/log/PHP-fpm.log
366 [www]
367 listen = 127.0.0.1:9000
368 listen.mode = 666
369 listen.owner = nobody
370 listen.group = nobody
371 user = PHP-fpm
372 group = PHP-fpm
373 pm = dynamic
374 pm.max_children = 50
375 pm.start_servers = 20
376 pm.min_spare_servers = 5
377 pm.max_spare_servers = 35
378 pm.max_requests = 500
379 rlimit_files = 1024
380 EOF
381 
382         #7、编译ldap模块
383         echo -e "\033[34m==========安装ldap模块==========\033[0m"
384         cd /software/PHP-$PHPVERS/ext/ldap
385         \cp -af /usr/lib64/libldaP* /usr/lib/
386         /usr/local/PHP7/bin/PHPize
387         [ $? -eq 0 ] && ./configure --with-PHP-config=/usr/local/PHP7/bin/PHP-config && make && make install
388         sed -i '/\;extension=bz2/aextension=ldap.so' /usr/local/PHP7/etc/PHP.ini
389 
390         #8、编译gettext模块
391         echo -e "\033[34m==========安装gettext模块==========\033[0m"
392         cd /software/PHP-$PHPVERS/ext/gettext
393         \cp -af /usr/lib64/libldaP* /usr/lib/
394         /usr/local/PHP7/bin/PHPize
395         [ $? -eq 0 ] && ./configure --with-PHP-config=/usr/local/PHP7/bin/PHP-config && make && make install
396         sed -i '/\;extension=bz2/aextension=gettext.so' /usr/local/PHP7/etc/PHP.ini
397     
398         echo -e "\033[36m==========PHP安装步骤完成==========\033[0m"
399 }
400 
401 #(4)整合NginxPHP
402 config_lnmp(){
403         cd /usr/local/Nginx
404 
405         #1、编辑Nginx配置文件
406         cat > conf/Nginx.conf << EOF
407 user nobody nobody;    
408 worker_processes  1;
409 error_log /data/logs/Nginx/error.log crit;
410 pid /run/Nginx.pid;
411 worker_rlimit_nofile 51200;
412 
413 events {
414     use epoll;
415     worker_connections  1024;
416 }
417 
418 http {
419     include       mime.types;
420     log_format  main  '\$remote_addr - \$remote_user [\$time_local] "\$request" '
421                       '\$status \$body_bytes_sent "\$http_referer" '
422                       '"\$http_user_agent" "\$http_x_forwarded_for"';
423 
424     access_log  /data/logs/Nginx/access.log  main;
425 
426     server_tokens       off;
427     sendfile            on;
428     send_timeout        3m;
429     tcp_nopush          on;
430     tcp_nodelay         on;
431     keepalive_timeout   65;
432     types_hash_max_size 2048;
433 
434     client_header_timeout 3m;
435     client_body_timeout 3m;
436     connection_pool_size 256;
437     client_header_buffer_size 1k;
438     large_client_header_buffers 8 4k;
439     request_pool_size 4k;
440     output_buffers 4 32k;
441     postpone_output 1460;
442     client_max_body_size 10m;
443     client_body_buffer_size 256k;
444     client_body_temp_path /usr/local/Nginx/client_body_temp;
445     proxy_temp_path /usr/local/Nginx/proxy_temp;
446     fastcgi_temp_path /usr/local/Nginx/fastcgi_temp;
447     fastcgi_intercept_errors on;    
448 
449     gzip on;
450     gzip_min_length 1k;
451     gzip_buffers 4 8k;
452     gzip_comp_level 5;
453     gzip_http_version 1.1;
454     gzip_types text/plain application/x-javascript text/css text/htm 
455     application/xml;
456 
457     default_type  application/octet-stream;
458     include  /usr/local/Nginx/conf.d/*.conf;
459 }
460 EOF
461         #2、将server配置段从Nginx.conf分离出来
462         [ ! -d conf.d ] && mkdir conf.d    
463     
464         #3、创建conf.d/server.conf文件整合NginxPHP
465         cat > conf.d/server.conf << EOF
466 server {
467     listen       80;
468     server_name  localhost;
469     location / {
470         root   /usr/local/Nginx/html;
471         index  index.PHP index.html index.htm;
472     }
473     
474     error_page   500 502 503 504  /50x.html;
475         location = /50x.html {
476             root   html;
477         }    
478 
479     location ~ \.PHP$ {
480     root   /usr/local/Nginx/html;
481     fastcgi_pass   127.0.0.1:9000;
482     fastcgi_index  index.PHP;
483     fastcgi_param  SCRIPT_FILENAME  \$document_root\$fastcgi_script_name;
484     include        fastcgi_params;
485     }
486 }
487 EOF
488 
489         #4、修改conf/fastcgi_params
490         > conf/fastcgi_params
491         cat > conf/fastcgi_params << EOF
492 fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
493 fastcgi_param  SERVER_SOFTWARE    Nginx;
494 fastcgi_param  QUERY_STRING       \$query_string;
495 fastcgi_param  REQUEST_METHOD     \$request_method;
496 fastcgi_param  CONTENT_TYPE       \$content_type;
497 fastcgi_param  CONTENT_LENGTH     \$content_length;
498 fastcgi_param  SCRIPT_FILENAME    \$document_root\$fastcgi_script_name;
499 fastcgi_param  SCRIPT_NAME        \$fastcgi_script_name;
500 fastcgi_param  REQUEST_URI        \$request_uri;
501 fastcgi_param  DOCUMENT_URI       \$document_uri;
502 fastcgi_param  DOCUMENT_ROOT      \$document_root;
503 fastcgi_param  SERVER_PROTOCOL    \$server_protocol;
504 fastcgi_param  REMOTE_ADDR        \$remote_addr;
505 fastcgi_param  REMOTE_PORT        \$remote_port;
506 fastcgi_param  SERVER_ADDR        \$server_addr;
507 fastcgi_param  SERVER_PORT        \$server_port;
508 fastcgi_param  SERVER_NAME        \$server_name;
509 EOF
510 
511         #5、关闭SELinux、防火墙
512         setenforce 0 && sed -i 's/enforcing/disabled/g' /etc/selinux/config
513         systemctl stop firewalld && systemctl disable firewalld
514 
515         #6、创建测试页,备份Nginx认的页面
516 
517         cat > html/1.PHP << EOF
518 <?PHP
519 echo "PHP解析正常";
520 ?>
521 EOF
522 
523         if [ $? -eq 0 ]
524         then
525             sleep 3
526             echo -e "\033[36m==========整合NginxPHP成功==========\033[0m"
527         else
528             echo -e "\033[31m**********整合NginxPHP失败,请检查**********\033[0m"
529             # exit 1
530         fi
531 }
532 
533 #(5)启动NginxMysqLPHP-fpm服务
534 start_service(){
535         systemctl daemon-reload && systemctl start Nginx 
536        
537         if [ $? -eq 0 ]
538             then
539                 echo -e "\033[36m==========Nginx服务启动成功==========\033[0m"
540         else
541             echo -e "\033[31m**********Nginx服务启动失败**********\033[0m"
542         fi
543 
544         systemctl start MysqLd  &&  /etc/init.d/PHP-fpm start
545 
546         if [ $? -eq 0 ]
547         then
548             sleep 3
549             echo -e "\033[36m==========MysqLPHP-fpm服务启动成功==========\033[0m"
550             echo -e "\033[33m查看端口启用情况:\033[0m"
551             ss -tnl
552             echo -e "\033[33m端口:80、3306、9000已启动!\033[0m"
553             echo -e "\033[36m==========编译安装lnmp已完成==========\033[0m"
554             echo -e "\033[36m==========数据库root密码为123456789==========\033[0m"
555             echo -e "\033[36m--------打开浏览器输入你的ip/1.PHP,看看测试页--------\033[0m"
556         else
557              echo -e "\033[31m**********MysqLPHP-fpm服务启动失败**********\033[0m"
558         fi
559         
560         source /etc/profile
561 }
562 
563 #脚本运行入口
564 run_install(){
565         while true;do
566         menu
567 
568         case $num in
569         "0")
570                 #0、安装依赖包
571                     echo -e "\033[34m==========安装依赖包==========\033[0m"
572                     install_package
573                     ;;
574         "1")
575                 #1、编译安装Nginx
576                     echo -e "\033[34m==========编译安装Nginx==========\033[0m"
577                     install_Nginx
578                     ;;
579         "2")
580                 #2、编译安装MysqL
581                     echo -e "\033[34m==========编译安装MysqL==========\033[0m"
582                        install_MysqL
583                     ;;
584         "3")    #3、编译安装PHP
585                     echo -e "\033[34m==========编译安装PHP==========\033[0m"
586                     install_PHP
587                     ;;
588         "4")    #4、整合NginxPHP
589                     echo -e "\033[34m==========整合NginxPHP==========\033[0m"
590                        config_lnmp
591                     ;;
592         "5")    #5、启动NginxMysqLPHP-fpm服务
593                     echo -e "\033[34m==========启动NginxMysqLPHP-fpm服务==========\033[0m"
594                     start_service
595                     ;;
596         "6")    #6、一键编译安装lnmp
597                     echo -e "\033[34m==========一键编译安装并配置lnmp==========\033[0m"
598                     install_package
599                     install_Nginx
600                     install_MysqL
601                     install_PHP
602                     config_lnmp
603                     start_service
604                     exit 0
605                     ;;
606         "7")    #7、退出脚本
607                     exit 0
608                     ;;
609           *)
610                     ;;
611         esac
612         done
613 }
614 
615 #调用脚本运行入口
616 run_install

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐