{"id":619,"date":"2021-09-24T01:02:30","date_gmt":"2021-09-23T17:02:30","guid":{"rendered":"https:\/\/log.tanxiaodian.com\/?p=619"},"modified":"2021-09-24T01:02:30","modified_gmt":"2021-09-23T17:02:30","slug":"lnmp%e7%8e%af%e5%a2%83%e5%ae%89%e8%a3%85shell%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/log.tanxiaodian.com\/?p=619","title":{"rendered":"LNMP\u73af\u5883\u5b89\u88c5shell\u811a\u672c"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<h1>#<code>!\/bin\/bash<\/code><\/h1>\n\n\n\n<p>echo &#8220;rpm\u5305\u5b89\u88c5mysql&#8221;<br>yum localinstall mysql80-community-release-el7-1.noarch.rpm<br>yum repolist all | grep mysql<br>yum repolist enabled|grep mysql<br>yum install yum-utils<br>yum-config-manager &#8211;disable mysql80-community<br>yum-config-manager &#8211;enable mysql57-community<br>yum repolist enabled | grep mysql<br>yum install -y mysql-community-server<\/p>\n\n\n\n<p>echo &#8220;\u542f\u52a8mysql\u670d\u52a1&#8221;<br>systemctl start mysqld<br>systemctl status mysqld<br>systemctl enable mysqld<\/p>\n\n\n\n<p>echo &#8220;\u751f\u6210mysql\u521d\u59cb\u5bc6\u7801&#8221;<br>mysql_init_pwd_src=<code>grep \"temporary password\" \/var\/log\/mysqld.log<\/code><br>mysql_init_pwd=${mysql_init_pwd_src##*: }<br>echo &#8220;\u521d\u59cb\u5bc6\u7801\u4e3a: [${mysql_init_pwd}]&#8221;<br>mysqladmin -u root -p&#8221;${mysql_init_pwd}&#8221; password &#8216;Sjm1987!&#8217;<br>systemctl restart mysqld<\/p>\n\n\n\n<p>yum -y install tcl-devel<br>yum -y install expect<br>\/usr\/bin\/expect &lt;&lt;-EOF<br>spawn mysql -h 127.0.0.1 -uroot -p<br>set timeout 100<br>expect {<br>&#8220;*Enter password:&#8221; {send &#8220;Sjm1987!\\r&#8221;}<br>interact<br>}<br>expect eof<br>EOF<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>echo &#8220;PHP\u5b89\u88c5&#8221;<br>yum -y gcc install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libzip-devel pcre-devel sqlite-devel bzip2 bzip2-devel openldap openldap-devel epel-release oniguruma oniguruma-devel<\/p>\n\n\n\n<p>tar -zxvf php-7.4.20.tar.gz<br>cd php-7.4.20<br>cp -frp \/usr\/lib64\/libldap* \/usr\/lib\/<br>.\/configure &#8211;prefix=\/usr\/local\/php &#8211;with-config-file-path=\/usr\/local\/php\/etc &#8211;with-iconv-dir=\/usr\/local &#8211;with-freetype &#8211;with-jpeg &#8211;with-zlib &#8211;enable-pdo &#8211;with-pdo-mysql &#8211;enable-xml &#8211;with-xmlrpc &#8211;disable-rpath &#8211;enable-bcmath &#8211;with-curl &#8211;enable-mbregex &#8211;enable-fpm &#8211;enable-mbstring &#8211;with-openssl &#8211;with-mhash &#8211;enable-sockets &#8211;enable-pcntl &#8211;with-ldap &#8211;with-ldap-sasl &#8211;enable-soap &#8211;without-pear &#8211;with-bz2 &#8211;disable-fileinfo &#8211;enable-gd<\/p>\n\n\n\n<p>line=<code>sed -n '\/EXTRA_LIBS = \/=' Makefile | tail -n1<\/code><br>sed -i &#8220;${line}s\/.*\/&amp; -llber\/&#8221; Makefile<\/p>\n\n\n\n<p>make &amp;&amp; make install<br>cp \/root\/soft\/confgfile\/php.ini \/usr\/local\/php\/etc\/php.ini<br>cp \/root\/soft\/confgfile\/php-fpm.conf \/usr\/local\/php\/etc\/php-fpm.conf<br>cp \/root\/soft\/confgfile\/www.conf \/usr\/local\/php\/etc\/php-fpm.d\/www.conf<br>cat&gt;\/etc\/systemd\/system\/php-fpm.service&lt;&lt;EOF<br>[Unit]<br>Description=php-fpm<br>After=network.target<\/p>\n\n\n\n<p>[Service]<br>Type=forking<br>ExecStart=\/usr\/local\/php\/sbin\/php-fpm<br>PrivateTmp=True<\/p>\n\n\n\n<p>[Install]<br>WantedBy=multi-user.target<br>EOF<\/p>\n\n\n\n<p>sed -i &#8216;$a \\PATH=$PATH:\\\/usr\\\/local\\\/php\\\/bin&#8217; \/etc\/profile<br>export PATH<br>source \/etc\/profile<\/p>\n\n\n\n<p>sudo groupadd nginx<br>sudo useradd -g nginx nginx<br>mkdir -p \/usr\/local\/tmpphp\/log<br>php -v<br>source \/etc\/profile<br>systemctl enable php-fpm<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>echo &#8220;\u5b89\u88c5nginx&#8221;<br>tar -zxvf nginx-1.12.1.tar.gz<br>cd nginx-1.12.1<br>.\/configure &#8211;prefix=\/usr\/local\/nginx &#8211;with-http_ssl_module<br>make &amp;&amp; make install<br>cp \/root\/soft\/confgfile\/nginx.conf \/usr\/local\/nginx\/conf\/nginx.conf<br>mkdir \/usr\/local\/nginx\/conf\/conf.d<br>cp \/root\/soft\/confgfile\/vhost.conf \/usr\/local\/nginx\/conf\/conf.d\/my_vhost.conf<\/p>\n\n\n\n<p>cat&gt;\/etc\/systemd\/system\/nginx.service&lt;&lt;EOF<br>[Unit]<br>Description=nginx web server<br>Documentation=http:\/\/nginx.org\/en\/docs\/<br>After=network.target remote-fs.target nss-lookup.target<\/p>\n\n\n\n<p>[Service]<br>Type=forking<br>PIDFile=\/usr\/local\/nginx\/logs\/nginx.pid<br>ExecStartPre=\/usr\/local\/nginx\/sbin\/nginx -t -c \/usr\/local\/nginx\/conf\/nginx.conf<br>ExecStart=\/usr\/local\/nginx\/sbin\/nginx -c \/usr\/local\/nginx\/conf\/nginx.conf<br>ExecReload=\/bin\/kill -s HUP $MAINPID<br>ExecStop=\/bin\/kill -s QUIT $MAINPID<br>PrivateTmp=true<\/p>\n\n\n\n<p>[Install]<br>WantedBy=multi-user.target<br>EOF<br>systemctl daemon-reload<br>systemctl enable nginx<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#!\/bin\/bash echo &#8220;r&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/log.tanxiaodian.com\/?p=619\">Continue reading<span class=\"screen-reader-text\">LNMP\u73af\u5883\u5b89\u88c5shell\u811a\u672c<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,2,5,3],"tags":[103,105,104],"_links":{"self":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/619"}],"collection":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=619"}],"version-history":[{"count":1,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/619\/revisions"}],"predecessor-version":[{"id":620,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/619\/revisions\/620"}],"wp:attachment":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}