Files
lemp/lemp.sh
2017-08-26 12:52:13 +08:00

69 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Install script for LEMP Web Server base on CentOS 7 by xiaosong
SCRIPT_ROOT=`pwd`
cd `${SCRIPT_ROOT}`
while :; do echo
read -p "Do you want to init your CentOS? [y/n]: " init_yn
if [[ ! $init_yn =~ ^[y,n]$ ]]; then
echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
else
break
fi
done
while :; do echo
read -p "Do you want to install nginx? [y/n]: " nginx_yn
if [[ ! $nginx_yn =~ ^[y,n]$ ]]; then
echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
else
break
fi
done
while :; do echo
read -p "Do you want to install PHP? [y/n]: " php_yn
if [[ ! $php_yn =~ ^[y,n]$ ]]; then
echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
else
break
fi
done
while :; do echo
read -p "Do you want to install MariaDB? [y/n]: " mariadb_yn
if [[ ! $mariadb_yn =~ ^[y,n]$ ]]; then
echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
else
while :; do echo
read -p "Please type MariaDB root password:(Default lemp.sh press Enter) " MariaDB_ROOT_PWD
[ -z "$MariaDB_ROOT_PWD" ] && MariaDB_ROOT_PWD="lemp.sh"
[ -n "`echo $MariaDB_ROOT_PWD | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; }
break;
done
fi
done
if [ "$init_yn" == 'y' ]; then
. ./utils/init.sh
fi
# Install base packages
echo "Installing base packages..."
sudo yum -y update
sudo yum -y install vim wget epel-release unzip git
if [ "$nginx_yn" == 'y' ]; then
. ./utils/nginx.sh
fi
if [ "$php_yn" == 'y' ]; then
. ./utils/php.sh
fi
if [ "$mariadb_yn" == 'y' ]; then
. ./utils/mariadb.sh
fi