centos6一键安装WordPress

#!/bin/bash
service iptables stop
setenforce 0
yum -y install httpd
service httpd restart

yum -y install mysql-server
service mysqld start
ss -ntl |awk -F" " '{print $4}'|grep ^:::3306$  &> /dev/null
[ $? -eq 0 ] && echo "MYSQL服务正常启动" || echo "MYSQL服务启动失败.."
echo "执行数据库安全策略.."
mysql -u root -e "UPDATE mysql.user SET Password=PASSWORD('123123') WHERE User='root';"
mysql -u root -e "DELETE FROM mysql.user WHERE User='';"
mysql -u root -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
mysql -u root -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';"
mysql -u root -e "FLUSH PRIVILEGES;"
echo "数据库安全策略执行完毕"
echo "创建wordpress数据库"
mysql -h127.0.0.1 -uroot -p123123 -e "CREATE DATABASE wpdb;"
mysql -h127.0.0.1 -uroot -p123123 -e "CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'centos';"
mysql -h127.0.0.1 -uroot -p123123 -e "GRANT ALL ON wpdb.* TO 'wpuser'@'localhost';"
echo "wordpress数据库创建完成"

yum -y install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php php-mysql

service iptables stop

echo "---------------"
echo "db is wpdb"
echo "user is wpuser"
echo "pass is centos"
echo "---------------"
curl -o wp.tar.gz https://wordpress.org/latest.tar.gz
tar -xf wp.tar.gz
rm -rf /var/www/html/*
mv wordpress/* /var/www/html

 

posted on 2019-07-26 16:58  弘道者  阅读(571)  评论(0编辑  收藏  举报