刘大神用centos部署WordPress



1、更新yum 源
[root@bogon ~]# yum -y update


2、安装软件
yum install httpd mysql-server php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc -y


3、查看php版本
php -version
如果低于5.6则卸载:
查看php版本命令:
#php -v
这个命令是删除不干净的
#yum remove php
因为使用这个命令以后再用
#php -v
还是会看到有版本信息的。。。。。
必须强制删除
查询php相关包信息
#rpm -qa|grep php
提示如下
#php-pdo-5.1.6-27.el5_5.3
#php-mysql-5.1.6-27.el5_5.3
#php-xml-5.1.6-27.el5_5.3
#php-cli-5.1.6-27.el5_5.3
#php-common-5.1.6-27.el5_5.3
#php-gd-5.1.6-27.el5_5.3

//卸载php相关所有的
rpm -qa | grep php | xargs rpm -e
//https://www.inqingdao.cn/737.html

注意卸载要先卸载没有依赖的
pdo是mysql的依赖项;common是gd的依赖项;
例如:# rpm -e php-pdo-5.1.6-27.el5_5.3
error: Failed dependencies:
? ? ? ? php-pdo is needed by (installed) php-mysql-5.1.6-27.el5_5.3.i386
所以正确的卸载顺序是:

rpm -e php-mysql-5.1.6-27.el5_5.3?

rpm -e php-pdo-5.1.6-27.el5_5.3?

rpm -e php-xml-5.1.6-27.el5_5.3?

rpm -e php-cli-5.1.6-27.el5_5.3?

rpm -e php-gd-5.1.6-27.el5_5.3?

rpm -e php-common-5.1.6-27.el5_5.3?

再用# php -v
查看版本信息已经没有提示

更新php的yum源:

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

安装新版php环境

#yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-odbc.x86_64 php56w-xml.x86_64 php56w-xmlrpc.x86_64 php56w-soap.x86_64


4、启动httpd服务:
[root@Shining ~]# service httpd start


5、启动Mysql服务
[root@localhost init.d]# service mysqld start

查看端口 ss -tnl
安装完之后开启MySQL服务:
进入mysql
[root@Shining ~]# mysql

配置数据库数据


为WordPress在MySQL中创建一个DB及相关用户

#登录MYSQL

[root@bogon html]# service mysqld restart
[root@bogon html]# mysql
mysql> show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
| test |
±-------------------+
3 rows in set (0.00 sec)

mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
| test |
| wordpress |
±-------------------+
4 rows in set (0.00 sec)

mysql> create user wpuser@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select User from user;
±-------+
| User |
±-------+
| root |
| |
| root |
| |
| root |
| wpuser |
±-------+
6 rows in set (0.00 sec)

mysql> update user set password = password(“wppassword”) where User = ‘wpuser’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wpuser@localhost IDENTIFIED BY ‘wppassword’;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit;
Bye



6.配置WordPress
下载WordPress的压缩包,并且放到centos系统中。
将该压缩包拷贝到/var/www/html目录,并且解压到该目录,注意压缩包的名称

[root@bogon html]# tar xvf wordpress5.xxx.gz
[root@bogon html]# cd /var/www/html
[root@bogon html]# cd wordpress/
[root@bogon wordpress]# cp wp-config-sample.php wp-config.php
[root@bogon wordpress]# vim wp-config.php
[root@bogon wordpress]#

/** WordPress数据库的名称 /
define(‘DB_NAME’,‘wordpress’);
/
* MySQL数据库用户名 /
define(‘DB_USER’,‘wpuser’);
/
* MySQL数据库密码 */
define(‘DB_PASSWORD’,‘wppassword’);


你可能感兴趣的:(刘大神用centos部署WordPress)