要求:
编写脚本
执行脚本lamp.sh
脚本执行后部署好论坛,并设定apache的网络接口为8080
实验:
vim lamp.sh
#!/bin/bash
echo "install software..."
yum install httpd mariadb-server php php-mysql -y &> /dev/null
sed '/^Listen 80/cListen 8080' -i /etc/httpd/conf/httpd.conf #修改httpd服务端口
sed '/^datadir/i\skip-networking=1' -i /etc/my.cnf #数据库安全设定,不让匿名用户登陆
systemctl start mariadb httpd
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
mysql_secure_installation &> /dev/null <<EOF
westos
westos
EOF
wget ftp://172.25.254.250/pub/Discuz_X3.2_SC_UTF8.zip -O /var/www/html/Discuz_X3.2_SC_UTF8.zip &> /dev/null
ll
cd /var/www/html
unzip Discuz_X3.2_SC_UTF8.zip &> /dev/null
chmod o+w upload/ -R
setenforce 0
firefox http://172.25.254.176:8080/upload &
脚本在执行时发送错误解决办法:
rm -fr /var/lib/mysql/
rm -fr /var/www/html/
vim /etc/my.cnf
删除掉laskip-networking=1
yum remove httpd mariadb-server php php-mysql -y
lamp.sh #重新执行