CentOS7.3安装部署wordpress


环境介绍:

CentOS7.3安装部署wordpress,本环境主机运行在阿里云,部署方式为单节点部署。
       主机配置:
                系统:CentOS7.3 mini
                CPU:1核
                内存:1GB
                硬盘:60G
                外网带宽:1Mbs

一、配置主机名

[ [email protected] ~]# vi /etc/hostname //需要重启电脑
wordpress
[ [email protected] ~]# reboot
[ [email protected] ~]# hostname
wordpress

二、下载wordpress

[ [email protected] ~]# yum install wget -y
wordpress-4.8.1-zh_CN.zip

三、安装lamp+vsftp

1、安装httpd、php和vsftpd
[ [email protected] ~]# yum install -y httpd*
[ [email protected] ~]# yum install -y php*  
[ [email protected] ~]# yum install -y vsftpd*
2、安装mysql
a. 下载mysql的repo源
b. 安装mysql-community-release-el7-5.noarch.rpm包
#rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装这个包后,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。
c. 安装mysql
# yum install mysql-server
d 、设置开机启动
[ [email protected] ~]# systemctl enable httpd
[ [email protected] ~]# systemctl enable mysqld
[ [email protected] ~]# systemctl enable vsftpd

自己安装的系统需关闭firewalld和selinux
[ [email protected] ~]# systemctl stop firewalld
[ [email protected] ~]# systemctl disable firewalld
[ [email protected] ~]# setenforce 0
[ [email protected] ~]# vi /etc/selinux/config
SELINUX=disabled

四、配置lamp和vsftp

1、为mysql设置root账户密码
mysql_secure_installation
回车,根据提示输入Y
输入2次密码,回车
根据提示一路输入Y
最后出现:Thanks for using MySQL!
MySql密码设置完成,重新启动 MySQL:
2、创建wordpress库
[ [email protected] ~]# mysql -u root -p 
mysql> show databases;
mysql> create database wordpress;
mysql> exit;

3、配置httpd
[ [email protected] wordpress]# vi /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/wordpress"
4、配置vsftp
[ [email protected] ~]# vi /etc/vsftpd/vsftpd.conf
anonymous_enable=No //关闭匿名登陆
[ [email protected] ~]# useradd  wpftp  -s  /sbin/nologin      //创建wpftp用户,但不能登陆系统
[ [email protected] ~]# passwd wpftp //设置wpftp密码
5、解压wordpress
[ [email protected] ~]# cp  wordpress-4.8.1-zh_CN.zip  /var/www/html/
[ [email protected] ~]# yum install unzip  -y
[ [email protected] html]# unzip wordpress-4.8.1-zh_CN.zip
6、重启服务
[ [email protected] ~]# systemctl restart httpd
[ [email protected] ~]# systemctl restart mysqld
[ [email protected]dpress ~]# systemctl restart vsftpd

五、初始化安装 wordpress


1、在浏览器中访问 http://IP/wp-admin/install.php

2、配置数据库连接

3、数据库配置文件生成失败

[ [email protected] ~]#  cd   /var/www/html/wordpress
[ [email protected] wordpress]# cp wp-config-sample.php wp-config.php
[ [email protected] wordpress]# vi wp-config.php //手动修改数据库连接信息
define('DB_NAME', 'wordpress');
define('DB_USER', 'root'); //数据库账户
define('DB_PASSWORD', '数据库密码'); //数据库密码
define('DB_HOST', 'localhost');       //数据库地址
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
4、配置用户名密码

5、安装完成

五、登陆

http://ip/wp-login.php                         //后台登陆
http://ip                                                 //网站首页