shell 脚本实现yum安装 LAMP 架构的 wordpress

请提前将wordpress包下载好,放到root目录下(下载地址:https://cn.wordpress.org/latest-zh_CN.zip)

曾尝试 wget https://cn.wordpress.org/latest-zh_CN.zip 未成功,迫于无奈,只能手动下载并完成

#!/bin/bash
#
#************************************************************************************
#Auther:            zc
#QQ:                194679342
#Date:              2020-10-31
#FileName:          wordpress.sh
#URL:               http://www.magedu.com
#Description:       The test script
#Copyrignt (C):    2020 All rights reseaved
#***********************************************************************************
COLOR="\e[1;32m"
END="\e[0m"
WORDPRESS="wordpress-*"

echo -e "${COLOR}开始安装稍等${END}"
dnf -y install httpd php php-json php-mysqlnd mariadb-server unzip &> /dev/null
systemctl enable --now httpd mariadb &> /dev/null && echo -e "${COLOR}httpd mariadb已启动${END}" 
mysql -e 'create database wordpress'                  #如果数据库有密码加个 -p后面加密码
mysql -e 'grant all on wordpress.* to wordpress@"localhost" identified by "123456"'
echo -e "${COLOR}正在解压稍等${END}"
unzip /root/${WORDPRESS}  &> /dev/null
mv /root/wordpress/* /var/www/html/
chown -R apache.apache /var/www/html/
echo -e "${COLOR}完事了请用浏览器访问:`hostname -I`${END}"

浏览器访问,操作步骤如下(图)

点击右下角:现在就开始

 

 

脚本中定义得用户名及密码等信息,输入正确后点击提交

 

 

提交后,这里得信息,都看心情设置--------之后在点击安装

点击登录

 

 

 

 然后就可以玩了

 

 

 

posted @ 2020-10-31 12:20  天-王-盖-地-虎  阅读(104)  评论(0编辑  收藏  举报