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,隐藏了产品信息。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值