一、前期环境
1.修改主机名
[root@localhost ~]# hostnamectl set-hostname LNMP-WordPress
[root@localhost ~]# su
[root@lnmp-wordpress ~]#
2.挂载镜像
[root@lnmp-wordpress ~]# mkdir /mnt/centos
[root@lnmp-wordpress ~]# mount -o loop /dev/cdrom /mnt/centos/
3.配置yum源
[root@lnmp-wordpress ~]# cat /etc/yum.repos.d/local.repo
[centos]
name=centos7
baseurl=file:///mnt/centos
gpgcheck=0
enabled=1
[root@lnmp-wordpress ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: base centos extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@lnmp-wordpress ~]# yum repolist
4.上传压缩包并解压
[root@lnmp-wordpress ~]# ls
anaconda-ks.cfg lnmp1.7.tar.gz wordpress-5.6-zh_CN.tar.gz
[root@lnmp-wordpress ~]# tar -zxvf lnmp1.7.tar.gz
二、进行实操
1.运行lnmp包
[root@lnmp-wordpress ~]# cd lnmp1.7
[root@lnmp-wordpress lnmp1.7]# ./install.sh
# 接着就是一直回车直到脚本跑起来
2.配置MySQL
[root@lnmp-wordpress lnmp1.7]# mysql -uroot -plnmp.org#22238
mysql> grant all privileges on *.* to root@localhost identified by '000000' with grant option;
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on *.* to root@"%" identified by '000000' with grant option;
Query OK, 0 rows affected (0.00 sec)
# ctrl+c退出
3.配置wordpress
# 解压wordpress
[root@lnmp-wordpress ~]# tar -zxvf wordpress-5.6-zh_CN.tar.gz
# 删除nginx默认文件
[root@lnmp-wordpress ~]# rm -rf /home/wwwroot/default/index.html
# 把wordpress文件 全部复制到nginx的默认目录当中
[root@lnmp-wordpress ~]# cp -rvf wordpress/* /home/wwwroot/default/
[root@lnmp-wordpress ~]# ls /home/wwwroot/default/
index.html wp-activate.php wp-load.php
index.php wp-admin wp-login.php
license.txt wp-blog-header.php wp-mail.php
lnmp.gif wp-comments-post.php wp-settings.php
ocp.php wp-config-sample.php wp-signup.php
phpinfo.php wp-content wp-trackback.php
phpmyadmin wp-cron.php xmlrpc.php
p.php wp-includes
readme.html wp-links-opml.php
# 赋予777权限
[root@lnmp-wordpress ~]# chmod 777 /home/wwwroot/default/*
# 修改wordpress模板
[root@lnmp-wordpress ~]# cd /home/wwwroot/default/
[root@lnmp-wordpress default]# ls
[root@lnmp-wordpress default]# cp wp-config-sample.php wp-config.php
[root@lnmp-wordpress default]# vim wp-config.php
4.验收
在浏览器中输入虚拟机IP地址,进入wordpress安装界面,填写必要信息,单机左下角安装按钮即可。
刷新页面进行登录
5.总结
安装步骤大致分为:准备虚拟机➡配置yum源➡安装lnmp➡配置MySQL➡配置wordpress➡页面登陆