CentOs搭建wordpress环境
写csdn的博客有一段时间了,现在想要换个地方,也想着更加认真的写。大家推荐wordpress果断就在我的服务器上搭建了这个环境。下面详细的说明步骤
1.登录SSH到你的云服务器上
2.查看是否已经安装过wordpress相关环境
wordpress依赖3个软件分别为:(1)php (2)apache (3) mysql
rpm -qa|grep httpd
rpm -qa|grep mysql
rpm -qa|grep php
3.安装php、apache、mysql
[root@www ~]# yum install -y httpd php php-mysql mysql mysql-server
这个时候安装mysql可能不会成功。仔细看会发现安装的不是mysql而是他的分支mariadb。下面是mariadb的说明
MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。
因此,此时mysql的相关服务都不能用,这个时候要重新安装mysql
正确安装mysql方法:
众所周知,Linux系统自带的repo是不会自动更新每个软件的最新版本(基本都是比较靠后的稳定版),所以无法通过yum方式安装MySQL的高级版本。所以我们需要先安装带有当前可用的mysql5系列社区版资源的rpm包。
执行命令:
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
查看可以使用的资源
yum repolist enabled | grep "mysql.*-community.*"
列表中会有3个选项。其中mysql56-community/x86_64和MySQL 5.6 Community Server可以使用。
因此使用命令安装
yum -y install mysql-community-serve
安装成功后进行配置工作
#######安装成功后,将其加入开机启动
[aaa@qq.com ~]# systemctl enable mysqld
#######启动mysql服务进程
[aaa@qq.com ~]# systemctl start mysqld
#######配置mysql(设置密码等)
[aaa@qq.com ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y [设置root用户密码]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y [删除匿名用户]
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y [禁止root远程登录]
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y [删除test数据库]
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y [刷新权限]
... Success!
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
至此 mysql安装成功
3. 将apache设置为开机启动
chkconfig httpd on
- 测试apche php是否可以使用
使用vim 新建一个 php 页面进行测试:
[root@www ~]# vi /var/www/html/info.php
按 “i” 键进行编辑, 输入测试页面内容:
<?php
phpinfo();
?>
按"esc"键,并输入:wq 保存并退出并启动apache服务:
[root@www ~]# service httpd start
在你的浏览器中输入地址比如:http://192.168.1.102/info.php
如果出现该页面则成功
5.启动配置mysql
启动mysql服务:
[root@www ~]# service mysqld start
登录mysql数据库:
[root@www ~]# mysql -u root -p
输入密码成功登陆
开启root账户远程登录权限:
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
mysql> flush privileges;
为准备部署wordpress创建一个数据库:
mysql> create database wordpress;
6. 安装wordpress
登陆wordpress官网下载对应的版本 我这里是目前最新wordpress-4.9.1-zh_CN.tar.gz
使用ssh工具将这个压缩包放入到 /var/www/html 并解压安装
进入目录:
[root@www ~]# cd /var/www/html/
解压缩wordpress压缩包
[root@www html]# tar -xzvf wordpress-4.1-zh_CN.tar.gz
修改apache默认项目路径:
[root@www html]# vi /etc/httpd/conf/httpd.conf
找到以下内容, 按 “i” 键进行编辑
将DocumentRoot 值修改成 “/var/www/html/wordpress”
DocumentRoot "/var/www/html/wordpress"
重启apache服务器:
[root@www html]# service httpd restart
授权wordpress项目(否则接下来有可能出现配置失败的问题)
[root@www html]# chmod -R 777 wordpress
接下来在地址栏输入你的ip地址,就可以配置wordpress了,开始要配置个人信息。按照提示将信息配置完成,就可以使用wordpress进行个人博客的修改了。wordpress支持很多插件,需要什么就直接下载即可!
上一篇: (腾讯云)CentOS搭建LNMP环境
下一篇: 腾讯云Centos7 图形界面搭建
推荐阅读
-
Linux centos7环境下MySQL安装教程
-
VS2017 Cordova Ionic2 移动开发环境搭建教程
-
如何在Windows平台下搭建PHP环境(phpnow图解版)
-
webpack4手动搭建Vue开发环境实现todoList项目的方法
-
Opencv2.4.13与Visual Studio2013环境搭建配置教程
-
Windows下搭建Android开发环境
-
Visual Studio 2017+OpenCV环境搭建教程
-
CentOS7系统搭建LAMP及更新PHP版本操作详解
-
php源码怎么搭建网站教程(详解php服务器环境搭建及配置)
-
Android Studio开发环境搭建教程详解