shell之路--LAMP一键安装yum版
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell之路--LAMP一键安装yum版相关的知识,希望对你有一定的参考价值。
#!/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
以上是关于shell之路--LAMP一键安装yum版的主要内容,如果未能解决你的问题,请参考以下文章