LNMP+WordPress 一键搭建个人博客
1、目标
(1)了解LNMP环境的组成。
(2)了解LNMP环境的部署与安装。
(2)了解WordPress应用的部署与使用。
2、准备
(1)软件准备
软件包 | 版本 | 大小 |
lnmp1.7.tar.gz | 1.7 | 165kB |
wordpress-4.7.3-zh_CN.zip | 4.7.3 | 8995KB |
CentOS-7-x86_64-DVD-1511.iso | 1511 | 4.03GB |
(2)基础准备
①、准备centos7虚拟机一台
②、上传软件包到虚拟机
③、配置本地yum源(使用网络yum源也可以。)
# mount CentOS-7-x86_64-DVD-1511.iso /opt/centos/
# cat /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
3、案例实施
(1)运行lnmp包
# tar -zxf lnmp1.7.tar.gz
# cd lnmp1.7
./install.sh
一路下一步即可。
MySQL密码为:
(2)配置MySQL
# mysql -uroot -plnmp.org#16285
mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on *.* to root@localhost identified by '000000' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to root@"%" identified by '000000' with grant option;
Query OK, 0 rows affected (0.01 sec)
mysql> Ctrl-C -- exit!
(3)配置wordpress
# 解压wordpress
unzip wordpress-4.7.3-zh_CN.zip
ls
# 删除nginx默认文件
rm -rf /home/wwwroot/default/index.html
# 把wordpress文件 全部复制到nginx的默认目录当中
cp -rvf wordpress/* /home/wwwroot/default/
ls /home/wwwroot/default/
# 赋予777权限
chmod 777 /home/wwwroot/default/*
# 修改wordpress模板
cd /home/wwwroot/default/
ls
cp wp-config-sample.php wp-config.php
vi wp-config.php
(4)验收
在浏览器中输入虚拟机IP地址,进入wordpress安装界面,填写必要信息,单机左下角安装按钮即可。
安装完毕后,刷新页面,点击登录进入登陆界面,输入用户名和密码进入。
4、总结
安装步骤大致分为:准备虚拟机?配置yum源?安装lnmp?配置MySQL?配置wordpress?页面登陆。