Discuz论坛系统搭建

#!/bin/bsah
#关闭防火墙和selinux
#安装LAMP架构
hanshu(){
systemctl stop firewalld && setenforce 0
yum -y install httpd mariadb-server mariadb php php-mysql gd php-gd >>/dev/null
while [ $? -ne 0 ]
do
    yum -y install httpd mariadb-server mariadb php php-mysql gd php-gd >>/dev/null
done
systemctl start httpd
if [ $? -eq 0 ]; then
    echo "Apache启动成功"
fi
touch /etc/httpd/conf.d/discuz.conf
echo "" >>/etc/httpd/conf.d/discuz.conf
echo "   ServerName www.discuz.com" >>/etc/httpd/conf.d/discuz.conf
echo "   ServerAlias dscuz.com" >>/etc/httpd/conf.d/discuz.conf
echo "   DocumenTRoot /webroot/discuz" >>/etc/httpd/conf.d/discuz.conf
echo "" >>/etc/httpd/conf.d/discuz.conf
echo '' >>/etc/httpd/conf.d/discuz.conf
echo '   Require all granted' >>/etc/httpd/conf.d/discuz.conf
echo '' >>/etc/httpd/conf.d/discuz.conf
mkdir -p /webroot/discuz
unzip /tmp/Discuz_X3.4_SC_UTF8.zip >>/dev/null
cp -rf /tmp/upload/* /webroot/discuz
chmod 777 -R /webroot/discuz
systemctl start mariadb
if [ $? -eq 0 ]; then
    mysql=$(which mysql)
    $mysql -uroot -p123 -e "create database discuz";
    exit
fi
systemctl restart httpd
}
cat << EOF
本脚本适用于Centos7版本安装discuz论坛系统,要求将Discuz_X3.4_SC_UTF8.zip上传至/tmp目录下,请选择是否安装。
y) 安装discuz论坛系统;
n) 不安装;
EOF
read -p "Your choice:" choice
case $choice in
y)
    hanshu
    echo 开始安装
    ;;
n)
    exit
    ;;
esac

你可能感兴趣的:(Discuz论坛系统搭建)