Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The shell script deploys the LNMP schema with one click

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The shell script deploys the LNMP schema with one click

For details, please see the previous article: LNMP building process.

Software packages: link: https://pan.baidu.com/s/1smqzl0usPj6rqsFUQCUAnA

Extraction code: tbvt

The following is a script (for servers that have not yet been built):

Package path:

[root@localhost ~] # ls tar/LNMP-C7/

Discuz_X3.4_SC_UTF8.zip php-7.1.10.tar.bz2

Mysql-boost-5.7.20.tar.gz php-7.1.20.tar.bz2

Ncurses-5.6.tar.gz php-7.1.20.tar.gz

Nginx-1.12.2.tar.gz zend-loader-php5.6-linux-x86_64_update1.tar.gz

Php-5.6.11.tar.bz2

1.main.sh (put three scripts into main.sh and execute them one by one)

#! / bin/bash./nginx.sh./mysql.sh 123456 / / the password required for mysqladmin interaction-free can be set by yourself. / php.sh

2.nginx.sh

#! / bin/bash# this script implements manual compilation and installation of Nginx pkgpath=~/tar/LNMP-C7/nginxpath=/usr/local/nginx/nginx_serpath=/lib/systemd/system/nginx.servicesystemctl stop firewalld.service setenforce 0echo "installing the required environment-related software package" yum install-y gcc gcc-c++ make pcre pcre-devel zlib-devel & > / dev/null if test $?! = 0then echo "environment installation error, ready to exit." Sleep 1 exit ficd $pkgpath tar zxf nginx-1.12.2.tar.gz-C / opt/# specifies a user but does not create a home directory egrep "^ nginx" / etc/passwd > & / dev/nullif [$?-ne 0] then useradd-M-s / sbin/nologin nginxfi# parameter configuration echo "configuring relevant parameters." sleep 2cd / opt/nginx-1.12.2/./configure\-- prefix=/usr/local/nginx\-- User=nginx\-- group=nginx\-- with-http_stub_status_module & > / dev/nullif test $? = = 0then echo "configuration parameter is correct!" else echo "configuration parameter is incorrect!" Exit 1fiecho "is compiling." make & > / dev/null if test $? = = 0then echo "compiled successfully!" else echo "compiled incorrectly!" Exit 1fiecho "installing..." make install & > / dev/nullif test $? = = 0then echo "installed successfully!" Else echo "installation failed!" Exit 1filn-s $nginxpathsbin/nginx / usr/local/sbin/cat > $nginx_serpath / dev/nullif [$?-ne 0] then useradd-s / sbin/nologin mysqlfi# decompress mysql package cd $pkgpathtar zxf mysql-boost-5.7.20.tar.gz-C / opt/# configuration parameter setting echo "performing configuration parameter setting." sleep 2cd / opt/mysql-5.7.20/cmake\-DCMKAE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock\-DSYSCONFDIR=/etc\-DSYSTEMD_PID_DIR=/usr/local/mysql\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DWITH_INNOBASE_STORAGE_ENGINE=1\-DWITH_ARCHIVE_STORAGE_ENGINE=1\-DWITH_BLACKHOLE_STORAGE_ENGINE=1\-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\-DWITH_BOOST=boost\-DWITH_SYSTEMD=1 & > / dev/nullif test $? = = 0then Echo "configuration parameters are correct!"else echo" configuration parameters are incorrect! " Exit 1fiecho is compiling. "echo" takes a long time to compile. Please wait patiently (20-45min). "sleep 3make & > / dev/nullif test $? = = 0then echo" compiled successfully! "else echo" compilation failed! " Exit 1fiecho "is installing." make install & > / dev/null if test $? = = 0then echo "installation succeeded!" else echo "installation failed!" Exit 1ficd / usr/localchown-R mysql.mysql mysql/cat > / etc/my.cnf / etc/profile#echo 'export PATH' > > / etc/profile#source / etc/profileln-s $mysqlpath/bin/* / usr/local/bin/ ln-s $mysqlpath/lib/* / usr/local/bin/cd $mysqlpath bin/mysqld\-initialize-insecure\-user=mysql\-basedir=/usr/local/mysql\-datadir=/usr/local/mysql/data > & / dev/null cp usr / lib/systemd/system/mysqld.service / lib/systemd/system/systemctl start mysqld.service passwd=$1/usr/bin/expect / dev/nullif test $? = = 0then echo "configuration parameters are correct!" Else echo "configuration parameters are incorrect!" Exit 1fiecho "is compiling, please wait patiently. (8-20min)" make & > / dev/nullif test $? = = 0then echo "compiled successfully!" Else echo "compilation failed!" Exit 1fiecho "is being installed and will be ready in a minute." make install & > / dev/null if test $? = = 0then echo "installed successfully!" Else echo "installation failed!" Exit 1fi# for related optimization and necessary configuration echo "php has three configuration files php.ini: core profile php-fpm.conf: process service profile www.conf: extension profile" echo "for core file configuration." cp php.ini-development $php_inifilesed-I'/ mysqli.default_socket = / cp php.ini-development $php_inifilesed-I'/ mysqli.default_socket = / cp php.ini-development _ usr\ / local\ / mysql\ / mysql.sock/p' $profile-I'/; date.timezone = / s / ^ / /'$php_inifilesed-I'/ date.timezone = / Asia / Asia\ / Shanghai/p' $php_inifileecho "the core configuration file is configured!" Echo "sets the process service profile." cd / usr/local/php/etc/cp php-fpm.conf.default php-fpm.confsed-I'/; pid/ s / ^; / /'/ usr/local/php/etc/php-fpm.conf echo "process service profile configuration is complete!" Echo "configure the extension profile..." cd / usr/local/php/etc/php-fpm.d/ cp www.conf.default www.confecho "configuration complete!" Echo "starting..." / usr/local/php/sbin/php-fpm-c $php_inifileecho "initialization is complete, creating command soft links..." ln-s / usr/local/php/bin/* / usr/local/bin/echo "changes the Nginx main configuration file to support the PHP function" cat > b.txt "

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report