contos 7 搭建博客wordpress — LAMP
环境:
准备一台机器 ---- 192.168.184.137
系统:CentOS 7
数据库:mariadb
1、基础配置
关闭防火墙和selinux
[root@vsftp ~]# systemctl stop firewalld # 关闭防火墙
[root@vsftp ~]# systemctl disable firewalld # 开机自动关闭防火墙
[root@vsftp ~]# setenforce 0 # 临时关闭selinux
[root@vsftp ~]# vim /etc/selinux/config # 永久关闭selinux,要重启机器才生效(reboot)
SELINUX=disabled # 将enforcing修改为disabled
2、安装有关的包
[root@localhost ~]# yum -y install httpd mariadb-server mariadb php php-mysql gd php-gd php-fpm
3、启动httpd服务,并在浏览器测试
[root@localhost ~]# systemctl start httpd
在浏览器访问地址,返回结果如图,即开启成功
4、解压worpress并上传
下载中文版wordpress ,链接:https://pan.baidu.com/s/1X5kgK19BbZRIj1LHjePn5g ,提取码:tq40
可在wordpress官网下载安装包,该文档我们使用英文版wordpress
[root@localhost ~]# yum -y install wget
[root@localhost ~]# wget https://wordpress.org/wordpress-4.7.2.tar.gz
[root@localhost ~]# ls
anaconda-ks.cfg wordpress-4.7.2.tar.gz
[root@localhost ~]# tar xf wordpress-4.7.2.tar.gz
[root@localhost ~]# ls
anaconda-ks.cfg wordpress-4.7.2.tar.gz wordpress
[root@localhost ~]# cp -r wordpress/* /var/www/html
[root@localhost ~]# systemctl restart httpd
在浏览器测试 ---- 访问192.168.184.137
出现以上页面即成功
5、对数据库操作
[root@localhost ~]# systemctl restart mariadb
[root@localhost ~]# mysqladmin -uroot password 123
[root@localhost ~]# mysql -uroot -p123
MariaDB [(none)]> create database wordpress; #创建数据库wordpress
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| wordpress |
+--------------------+
5 rows in set (0.00 sec)
MariaDB [(none)]> flush privileges; #刷新
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> \q
Bye
[root@localhost ~]# systemctl restart mariadb #重启数据库
6、访问ip地址,配置wordpress解决上诉问题:
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# ls
index.php readme.html wp-admin wp-comments-post.php wp-content wp-includes wp-load.php wp-mail.php wp-signup.php xmlrpc.php
license.txt wp-activate.php wp-blog-header.php wp-config-sample.php wp-cron.php wp-links-opml.php wp-login.php wp-settings.php wp-trackback.php
[root@localhost html]# vim wp-config.php
###将浏览器页面的内容写入到该文件中
刷新一下浏览器页面,继续下一步
下一步
出现以上页面,即博客搭建成功。