This commit is contained in:
2017-10-23 17:04:15 +08:00
parent 4512994566
commit 37a5cec3bf
2 changed files with 15 additions and 14 deletions

17
lemp.sh
View File

@@ -5,6 +5,18 @@
SCRIPT_ROOT=`pwd` SCRIPT_ROOT=`pwd`
cd $SCRIPT_ROOT cd $SCRIPT_ROOT
# Checking
echo "Checking..."
if [ -n "`grep 'Aliyun Linux release' /etc/issue`" -o -e /etc/redhat-release ];then
OS=CentOS
[ -n "`grep ' 7\.' /etc/redhat-release`" ] && CentOS_RHEL_version=7
fi
if [ $OS != 'CentOS' ] || [ $CentOS_RHEL_version != '7' ];then
echo "${CFAILURE}Error: This script only support CentOS 7${CEND}";
kill -9 $$
fi
while :; do echo while :; do echo
read -p "Do you want to init your CentOS? [y/n]:(Default y press Enter) " init_yn read -p "Do you want to init your CentOS? [y/n]:(Default y press Enter) " init_yn
[ -z "$init_yn" ] && init_yn=y [ -z "$init_yn" ] && init_yn=y
@@ -46,11 +58,12 @@ while :; do echo
read -p "Please type MariaDB root password:(Default lemp.sh press Enter) " MariaDB_ROOT_PWD read -p "Please type MariaDB root password:(Default lemp.sh press Enter) " MariaDB_ROOT_PWD
[ -z "$MariaDB_ROOT_PWD" ] && MariaDB_ROOT_PWD="lemp.sh" [ -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; } [ -n "`echo $MariaDB_ROOT_PWD | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; }
break; break
done done
else else
break break
fi fi
break
fi fi
done done
@@ -61,7 +74,7 @@ fi
# Install base packages # Install base packages
echo "Installing base packages..." echo "Installing base packages..."
sudo yum -y update sudo yum -y update
sudo yum -y install vim wget epel-release unzip git sudo yum -y install sudo vim wget epel-release unzip git
if [ "$nginx_yn" == 'y' ]; then if [ "$nginx_yn" == 'y' ]; then
. ./utils/nginx.sh . ./utils/nginx.sh

View File

@@ -1,17 +1,5 @@
#!/bin/bash #!/bin/bash
# Checking
echo "Checking..."
if [ -n "`grep 'Aliyun Linux release' /etc/issue`" -o -e /etc/redhat-release ];then
OS=CentOS
[ -n "`grep ' 7\.' /etc/redhat-release`" ] && CentOS_RHEL_version=7
fi
if [ $OS != 'CentOS' ] || [ $CentOS_RHEL_version != '7' ];then
echo "${CFAILURE}Error: This script only support CentOS 7${CEND}";
kill -9 $$
fi
# Close SELINUX # Close SELINUX
setenforce 0 setenforce 0
sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config