#!/bin/bash
#---------------------------
#一键安装 LAMP 和 Discuz
#---------------------------
#所需安装包
#httpd 包:apr-1.6.2.tar.gz,apr-util-1.6.0.tar.gz,httpd-2.4.29.tar.bz2
#mysql 包:mysql-5.7.17.tar.gz,boost_1_59_0.tar.gz
#PHP 包:php-7.1.10.tar.bz2
#Discuz 包:Discuz_X3.4_SC_UTF8.zip
###安装包准备
mkdir /data
yum -y install wget bzip2
wget http://47.117.130.238/LAMP/apr-1.6.2.tar.gz -P /data
wget http://47.117.130.238/LAMP/apr-util-1.6.0.tar.gz -P /data
wget http://47.117.130.238/LAMP/httpd-2.4.29.tar.bz2 -P /data
wget http://47.117.130.238/LAMP/mysql-5.7.17.tar.gz -P /data
wget http://47.117.130.238/LAMP/boost_1_59_0.tar.gz -P /data
wget http://47.117.130.238/LAMP/php-7.1.10.tar.bz2 -P /data
wget http://47.117.130.238/LAMP/Discuz_X3.4_SC_UTF8.zip -P /data
###安装前准备
systemctl stop firewalld && systemctl disable firewalld
sed -i 's/enforcing/disabled/' /etc/selinux/config
setenforce 0
echo "nameserver 114.114.114.114" >> /etc/resolv.conf
ntpdate ntp1.aliyun.com
IP=`ifconfig ens33 | grep netmask | tr -s ' ' @ | cut -d@ -f3`
###安装 apache
tar xf /data/apr-1.6.2.tar.gz -C /opt
tar xf /data/apr-util-1.6.0.tar.gz -C /opt
tar xf /data/httpd-2.4.29.tar.bz2 -C /opt
mv /opt/apr-1.6.2 /opt/httpd-2.4.29/srclib/apr
mv /opt/apr-util-1.6.0 /opt/httpd-2.4.29/srclib/apr-util
yum -y install gcc gcc-c++ make pcre pcre-devel expat-devel perl
cd /opt/httpd-2.4.29/
./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lit