溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

shell之路--LAMP一鍵安裝yum版

發(fā)布時(shí)間:2020-06-28 05:59:16 來(lái)源:網(wǎng)絡(luò) 閱讀:609 作者:Max_zhao 欄目:MySQL數(shù)據(jù)庫(kù)

#!/bin/bash


cat <<EOF

# auto install lamp env

# by author max

# 2017-03-20

EOF


APACHE_SOFT="httpd httpd-devel"

MYSQL_SOFT="mariadb-server mariadb mariadb-devel"

PHP_SOFT="php php-mysql php-devel"

IP=`ifconfig eno16777736|grep 192|awk '{print $2}'|sed 's/addr://g'`


if [ -Z $1 ];then

        echo -e "\033[36mPlease Se;ect Install Menu:\033[0m"

        echo "1)install httpd"

        echo "2)install mysql"

        echo "3)install php"

        echo "4)install lamp and access lamp"

        echo -e "\033[32m----------------------------\033[0m"

        echo "Usage:{Please enter $0 '@1 arg 1|2|3|4}"

        exit 0

fi

############################

if [ $1 == "1" ];then

        # install apache

        yum -y install $APACHE_SOFT

fi


if [ $1 == "2" ];then

        # install mysql

        yum -y install $MYSQL_SOFT

fi


if [ $1 == "3" ];then

        # install php

        yum -y install $PHP_SOFT

fi


if [ $1 == "4" ];then

        # lamp config

        yum -y install $APACHE_SOFT $MYSQL_SOFT $PHP_SOFT

        # touch index,php

        cat >/var/www/html/index.php<<EOF

        <?php

        phpinfo();

        ?>

EOF

        systemctl restart httpd

        systemctl restart mariadb-service

        echo "----------------------------"

        echo "You can to use http://$IP/ to access."

fi


向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI