centos7搭建LAMP(wordpress+discuz)
一、思路:
1、使用脚本自动化安装。
2、分别安装mysql和apache/php,可以根据需要安装在同一台机器或不同机器上。
二、实践:
1、安装mysql,并配置wordpress\discuz相关账号。为了方便测试,尽可能使用默认的配置。
#cat lamp-mysql.sh
#!/bin/bash
yum install -y mariadb-server
systemctl enable --now mariadb
#mysql_secure_installation
cat > create_sql_user.sql <<-EOF
create database wordpress;
grant all on wordpress.* to username@'%' identified by 'password';
create database ultrax;
grant all on ultrax.* to discuz@'%' identified by 'discuz';
flush privileges;
EOF
mysql < create_sql_user.sql
2、安装apache\php。下载wordpress\discuz,并解压、拷贝到apache默认的网页部署目录(/var/www/html/)。这里使用清华镜像源加速下载php。
#cat lamp-web.sh
#!/bin/bash
# http+php+wordpress+discuz
wget https://cn.wordpress.org/wordpress-5.9.3-zh_CN.tar.gz
wget -O Discuz_X3.4_SC_UTF8_20220518.zip https://gitee.com/Discuz/DiscuzX/attach_files/1067401/download
wget https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm --no-check-certificate
yum install -y remi-release-7.rpm
sed -i '/^mirrorlist=/c\mirrorlist=https:\/\/mirrors.tuna.tsinghua.edu.cn\/remi\/enterprise\/7\/safe\/mirror' /etc/yum.repos.d/remi-safe.repo
yum install -y httpd php74-php php74-php-mbstring php74-php-mysqlnd \
php74-php-xml.x86_64 php74-php-opcache.x86_64 unzip
systemctl enable --now httpd
tar vxf wordpress-5.9.3-zh_CN.tar.gz
mv wordpress /var/www/html/blog
unzip Discuz_X3.4_SC_UTF8_20220518.zip
mv upload /var/www/html/forum
chown -R apache.apache /var/www/html/
3、用浏览器访问http://<apache服务器ip>/blog和http://<apache服务器ip>/forum ,两个网址分别对应wordpress、discuz,网址不直接用wordpress,隐藏了产品信息。

浙公网安备 33010602011771号