Linux7通过LAMP环境构搭建WordPress论坛

(1).更换YUM源:

这里我使用的是阿里源

[root@localhost ~]#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo


(2).关闭防火墙和selinux,后期可根据需求开启。

[root@localhost ~]# systemctl stop firewalld.service   
[root@localhost ~]# setenforce 0

 

(3).安装httpd服务:


[root@localhost ~]#yum install httpd -y  #安装阿帕奇服务

(4).安装相关的php*服务:


[root@localhost ~]#yum -y install php php-mysql gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap

(5).下载并安装MySQL官方的Yum Repository:

[root@localhost ~]#rpm -e mariadb-libs --nodeps   # 删除原先的数据库                
[root@localhost ~]#yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-common-5.7.35-1.el7.x86_64.rpm
[root@localhost ~]#yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-5.7.35-1.el7.x86_64.rpm
[root@localhost ~]#yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-compat-5.7.35-1.el7.x86_64.rpm
[root@localhost ~]#yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-client-5.7.35-1.el7.x86_64.rpm
[root@localhost ~]#yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-server-5.7.35-1.el7.x86_64.rpm

(6).启动数据库:


[root@localhost ~]#systemctl start mysqld.service

(7).执行以下命令,查看MySQL初始密码:

[root@localhost ~]#grep "password" /var/log/mysqld.log  #Xx+Q)4AWBUp)这个是我的初始密码

(8).配置数据库:

输入上面的随机密码登陆数据库


[root@localhost ~]#mysql -uroot -p
password:             
mysql> set global validate_password_policy=0;  #修改密码安全策略为低
mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678'; #这里我设的密码为12345678
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678';  #执行以下命令,授予root用户远权限
mysql>CREATE  DATABASE wordpress;  #创建一个wordpress库
mysql>exit  #退出

(9).下载WordPress安装包:


[root@localhost ~]#cd /var/www/html 
[root@localhost html]# wget http://cn.wordpress.org/wordpress-3.9-zh_CN.zip  #如果路径失效,自行寻找。


#此版是3.9版本,官网新版本无法与这里的PHP5.4版本匹配!!!


[root@localhost html]#ls  #根据下载版本,返回下面信息
    wordpress-3.9-zh_CN.zip  
[root@localhost html]#unzip wordpress-3.9-zh_CN.zip  #进行解压,会发现目录里有一个wordpress文件。
[root@localhost html]#chown -R apache.apache wordpress #授予权限

————————————————
版权声明:本文为CSDN博主「susususuao」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_47118413/article/details/122665559

(10).配置httpd服务:


[root@localhost ~]#vi /etc/httpd/conf.d/wordpress.conf #编辑如下
[root@localhost ~]#cat /etc/httpd/conf.d/wordpress.conf
<VirtualHost x.x.x.x:80>            #x.x.x.x为你得服务器IP地址
    ServerName x.x.x.x        #这里由于没有域名所有用服务器IP地址代替,如果有域名则可以用域名代替
    DocumentRoot /var/www/html/wordpress      #wordpress存放路径
</VirtualHost>
<Directory "/var/www/html/wordpress">
           AllowOverride All
           Require all granted
</Directory>


(11).重启相关服务:


[root@localhost ~]#systemctl restart mysqld.service
[root@localhost ~]#systemctl restart httpd
[root@localhost ~]#systemctl restart  php*



(12).网页输入http://ip/wordpress进入配置页面,ip为你服务器的IP地址进入wordpress安装向导




上一篇:冬季实战营第五期学习报告5:基于Elasticsearch+Fink的日志全观测最佳实践


下一篇:冬季实战营第五期报告