Centos 7, PHP 7.1, Mysql 一键初始化脚本

#!/bin/bash

if grep -Eqii "CentOS" /etc/issue || grep -Eq "CentOS Linux release 7" /etc/*-release; then
    echo "Welcome CentOS 7 init script"
    mkdir -p ~/.install
    cd ~/.install
else
    echo "OS version Not Supported"
    exit
fi

rpm -Uvh https://nginx.org/packages/mainline/rhel/7/x86_64/RPMS/nginx-1.17.6-1.el7.ngx.x86_64.rpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
rpm -Uvh https://www.percona.com/redir/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm

yum -y install epel-release
yum -y install gcc gcc-c++ autoconf automake make
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
yum -y install ack screen wget curl zip unzip ntpdate httpd-tools
yum -y install net-snmp net-snmp-devel net-snmp-utils vim git bind-utils
yum -y install tar nc htop iotop iftop telnet wget curl curl-devel salt-minion mtr
yum -y remove mysql-server mysql httpd
yum -y install nginx nginx-module-geoip
yum -y install Percona-Server-server-57 percona-xtrabackup-24 --nogpgcheck
yum -y install libwebp-devel libwebp-tools ImageMagick ImageMagick-devel
yum -y install redis

yum -y install php71w php71w-fpm php71w-common php71w-cli php71w-devel php71w-intl php71w-mysqlnd php71w-pdo php71w-soap php71w-tidy php71w-xml php71w-xmlrpc php71w-zts php71w-gd php71w-mbstring php71w-mcrypt php71w-pecl-zendopcache php71w-pear php71w-posix php71w-mysqlnd php71w-pecl-redis

# 安装composer

wget https://getcomposer.org/download/1.10.5/composer.phar -O /usr/local/bin/composer
chmod +x /usr/local/bin/composer

# 安装 swoole, yar
pecl install swoole
echo
echo "extension=swoole.so">/etc/php.d/swoole.ini
pecl install msgpack
echo
pecl install yar
echo
pecl install apcu
echo
echo "extension=msgpack.so">/etc/php.d/msgpack.ini
echo "extension=yar.so">/etc/php.d/yar.ini
echo "extension=apcu.so">/etc/php.d/apcu.ini

yum -y install yum-utils
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
yum install certbot python2-certbot-nginx -y

#### 安装 Golang
wget https://dl.google.com/go/go1.14.9.linux-amd64.tar.gz
tar -zxvf go1*.linux-amd64.tar.gz
mv go /usr/local/
echo "PATH=$PATH:/usr/local/go/bin/">>~/.bash_profile
echo "export PATH">>~/.bash_profile
source ~/.bash_profile
go version