一、前期环境

1.修改主机名

  1. [root@localhost ~]# hostnamectl set-hostname LNMP-WordPress
  2. [root@localhost ~]# su
  3. [root@lnmp-wordpress ~]#

2.挂载镜像

  1. [root@lnmp-wordpress ~]# mkdir /mnt/centos
  2. [root@lnmp-wordpress ~]# mount -o loop /dev/cdrom /mnt/centos/

3.配置yum源

  1. [root@lnmp-wordpress ~]# cat /etc/yum.repos.d/local.repo
  2. [centos]
  3. name=centos7
  4. baseurl=file:///mnt/centos
  5. gpgcheck=0
  6. enabled=1
  7. [root@lnmp-wordpress ~]# yum clean all
  8. 已加载插件:fastestmirror
  9. 正在清理软件源: base centos extras updates
  10. Cleaning up everything
  11. Cleaning up list of fastest mirrors
  12. [root@lnmp-wordpress ~]# yum repolist

4.上传压缩包并解压

  1. [root@lnmp-wordpress ~]# ls
  2. anaconda-ks.cfg lnmp1.7.tar.gz wordpress-5.6-zh_CN.tar.gz
  3. [root@lnmp-wordpress ~]# tar -zxvf lnmp1.7.tar.gz

二、进行实操

1.运行lnmp包

  1. [root@lnmp-wordpress ~]# cd lnmp1.7
  2. [root@lnmp-wordpress lnmp1.7]# ./install.sh
  3. # 接着就是一直回车直到脚本跑起来

MySQL密码为:
image.png

2.配置MySQL

  1. [root@lnmp-wordpress lnmp1.7]# mysql -uroot -plnmp.org#22238
  2. mysql> grant all privileges on *.* to root@localhost identified by '000000' with grant option;
  3. Query OK, 0 rows affected (0.01 sec)
  4. mysql> grant all privileges on *.* to root@"%" identified by '000000' with grant option;
  5. Query OK, 0 rows affected (0.00 sec)
  6. # ctrl+c退出

3.配置wordpress

  1. # 解压wordpress
  2. [root@lnmp-wordpress ~]# tar -zxvf wordpress-5.6-zh_CN.tar.gz
  3. # 删除nginx默认文件
  4. [root@lnmp-wordpress ~]# rm -rf /home/wwwroot/default/index.html
  5. # 把wordpress文件 全部复制到nginx的默认目录当中
  6. [root@lnmp-wordpress ~]# cp -rvf wordpress/* /home/wwwroot/default/
  7. [root@lnmp-wordpress ~]# ls /home/wwwroot/default/
  8. index.html wp-activate.php wp-load.php
  9. index.php wp-admin wp-login.php
  10. license.txt wp-blog-header.php wp-mail.php
  11. lnmp.gif wp-comments-post.php wp-settings.php
  12. ocp.php wp-config-sample.php wp-signup.php
  13. phpinfo.php wp-content wp-trackback.php
  14. phpmyadmin wp-cron.php xmlrpc.php
  15. p.php wp-includes
  16. readme.html wp-links-opml.php
  17. # 赋予777权限
  18. [root@lnmp-wordpress ~]# chmod 777 /home/wwwroot/default/*
  19. # 修改wordpress模板
  20. [root@lnmp-wordpress ~]# cd /home/wwwroot/default/
  21. [root@lnmp-wordpress default]# ls
  22. [root@lnmp-wordpress default]# cp wp-config-sample.php wp-config.php
  23. [root@lnmp-wordpress default]# vim wp-config.php

image.png

4.验收

在浏览器中输入虚拟机IP地址,进入wordpress安装界面,填写必要信息,单机左下角安装按钮即可。
image.png
image.png
刷新页面进行登录
image.pngimage.png

5.总结

安装步骤大致分为:准备虚拟机➡配置yum源➡安装lnmp➡配置MySQL➡配置wordpress➡页面登陆
image.png