shell下比較完善的LNMP一鍵安裝包
[重要通告]如您遇疑難雜癥,本站支持知識(shí)付費(fèi)業(yè)務(wù),掃右邊二維碼加博主微信,可節(jié)省您寶貴時(shí)間哦!
這是今天一個(gè)朋友說(shuō)他搞了一個(gè)LNMP一鍵安裝包腳本,其實(shí)這些腳本沒(méi)必要的,因?yàn)闀?huì)有很多完善的區(qū)域來(lái)操作;
代碼如下:
#!/bin/bash #by cuiyuxin zhanshi(){ echo "+------------------------------------------------+ | | | _o0o_ 1. 編譯安裝Nginx1.17.10 | | 08880 2. yum安裝Apache | | 88"."88 3. yum安裝MySQL5.7 | | (|-_-|) 4. yum安裝PHP7 | | 0\=/0 5. 部署LNMP環(huán)境 | | __/ \ 6.退出此管理程序| | ‘\ ///‘ | | / Linux一鍵 \ | | || Server || ====================== | | \ //// 一鍵安裝服務(wù) | | ||| i i i ||| by laoliang | | ___ ___ ====================== | |___‘. /--.--\ .‘___ | +------------------------------------------------+ " } install_nginx(){ #1.第一步:依賴環(huán)境安裝: echo -e "\033[41;33m 開(kāi)始安裝依賴環(huán)境 \033[0m" yum install pcre pcre-devel openssl openssl-devel zlib zlib-devel -y yum install gcc gcc-c++ make libtool -y yum install wget -y #2.開(kāi)始下載nginx源碼包,nginx-1.17.10 echo -e "\033[41;33m 開(kāi)始下載目前穩(wěn)定版nginx-1.17.10 \033[0m" wget -P /tmp http://nginx.org/download/nginx-1.17.10.tar.gz #3.解壓nginxtar包,進(jìn)行編譯 echo -e "\033[41;33m 開(kāi)始解壓nginx-1.17.10 并且進(jìn)行編譯 \033[0m" tar xf /tmp/nginx-1.17.10.tar.gz -C /tmp cd /tmp/nginx-1.17.10 ./configure --prefix=/usr --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/tem/nginx/client --http-proxy-temp-path=/var/tem/nginx/proxy --http-fastcgi-temp-path=/var/tem/nginx/fcgi --with-http_stub_status_module make && make install useradd -s /sbin/nologin -M nginx mkdir -p /var/tem/nginx/client if [ $? == 0 ];then echo -e "\033[41;33m nginx-1.17.10安裝完成,安裝目錄為/etc/nginx 日志目錄在/ar/log/nginx/ 輸入命令"nginx" 即可啟動(dòng)nginx服務(wù) \033[0m" fi } install_apache(){ echo "開(kāi)始安裝Apache請(qǐng)稍后" yum install httpd -y &>/dev/null if [ "$?" -eq 0 ] then echo "Apache安裝成功!" else echo "Apache安裝失敗!" fi } install_mysql(){ echo "開(kāi)始下載mysql 5.7的rpm安裝包" wget -P /tmp https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm echo "開(kāi)始安裝mysql 5.7的rpm安裝包" yum -y localinstall /tmp/mysql57-community-release-el7-11.noarch.rpm echo "開(kāi)始在線安裝MySQL 文件比較大,安裝較慢!!" yum -y install mysql-community-server if [ "$?" -eq 0 ] then echo "Mysql安裝成功!輸入命令:systemctl start mysqld 啟動(dòng)Mysql" echo "mysql安裝完成之后,會(huì)在/var/log/mysqld.log文件中給root生成了一個(gè)臨時(shí)的默認(rèn)密碼" else echo "Mysql安裝失敗!" fi } install_php() { echo "開(kāi)始移除舊的php" yum remove php-mysql-5.4 php php-fpm php-common cat >>/etc/yum.repos.d/php.repo<<'EOF' [php-fpm] name = php Repository baseurl = http://us-east.repo.webtatic.com/yum/el7/x86_64/ gpgcheck = 0 EOF echo "開(kāi)始安裝php7" yum -y install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb if [ $? -eq 0 ];then echo "php7安裝成功,使用systemctl start php-fpm 來(lái)啟動(dòng)php-fpm" else echo "php7安裝失敗" fi } install_lnmp(){ install_nginx install_mysql install_php } zhanshi read -p "請(qǐng)您輸入需要安裝的服務(wù):" NUM case $NUM in 1) install_nginx ;; 2) install_apache ;; 3) install_mysql ;; 4) install_php ;; 5) install_lnmp ;; 6) exit ;; esac
其實(shí)不用這些東西,也有比較完善的腳本~
問(wèn)題未解決?付費(fèi)解決問(wèn)題加Q或微信 2589053300 (即Q號(hào)又微信號(hào))右上方掃一掃可加博主微信
所寫(xiě)所說(shuō),是心之所感,思之所悟,行之所得;文當(dāng)無(wú)敷衍,落筆求簡(jiǎn)潔。 以所舍,求所獲;有所依,方所成!
賞
支付寶贊助
微信贊助
免責(zé)聲明,若由于商用引起版權(quán)糾紛,一切責(zé)任均由使用者承擔(dān)。
您必須遵守我們的協(xié)議,如您下載該資源,行為將被視為對(duì)《免責(zé)聲明》全部?jī)?nèi)容的認(rèn)可->聯(lián)系老梁投訴資源 LaoLiang.Net部分資源來(lái)自互聯(lián)網(wǎng)收集,僅供用于學(xué)習(xí)和交流,請(qǐng)勿用于商業(yè)用途。如有侵權(quán)、不妥之處,請(qǐng)聯(lián)系站長(zhǎng)并出示版權(quán)證明以便刪除。
敬請(qǐng)諒解! 侵權(quán)刪帖/違法舉報(bào)/投稿等事物聯(lián)系郵箱:service@laoliang.net
意在交流學(xué)習(xí),歡迎贊賞評(píng)論,如有謬誤,請(qǐng)聯(lián)系指正;轉(zhuǎn)載請(qǐng)注明出處: » shell下比較完善的LNMP一鍵安裝包