lamp 安装wordpress
lamp
linux + apache + mariadb + php
安装过程:
环境准备:
镜像: centos7 1804
关闭防火墙: systemctl stop firewalld
设置防火墙开机不自启: systemctl disable firewalld
临时关闭selinux: setenforce 0
永久关闭selinux: vi /etc/selinux/config:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing (此处修改为:disabled)
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
下载软件:
获取wordpresstar包:
https://cn.wordpress.org/download/ 传入虚拟机
安装php mariadb apache(html):
yum install -y http mariadb mariadb-server php php-mysql
启动html mariadb:
systemctl start mariadb httpd
设置开机自启:
systemctl enable mariadb httpd
mariadb初始化:
mysql_secure_installation
回车
y(设置数据库root登录密码)
y
n
y
y
登录数据库:
mysql -uroot -p000000
创建数据库:
create database wordpress;
exit
解压wordpress:
查看wordpress的后缀名是什么如果是.zip记得安装unzip来解压: yum install -y unzip unzip wordpress包名
tar包的话使用这个命令: tar -zxvf wordpress包名
把解压后的wordpress文件中的内容移动到http源路径下:
cp -rvf ./wordpress/* /var/www/html/
移动到刚才解压的目录:
cd /var/www/html/
修改wordpress配置文件:
两种方法:
第一种直接修改源文件
备份文件:
cp wp-config-sample.php wp-config.php
vi wp-config.php:(只修改三个地方是wordpress找到直接的数据库)
修改前:
define('DB_NAME', 'database_name_here'); //数据库名称
define('DB_USER', 'username_here'); //数据库登录的mingc
define('DB_PASSWORD', 'password_here'); //数据库登录的密码
修改后:
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');
/** MySQL数据库用户名 */
define('DB_USER', 'root');
/** MySQL数据库密码 */
define('DB_PASSWORD', '000000');
安装完成:
在浏览器输入你centos的ip地址
第二种:
把wordpress文件导入httpld后浏览器输入你centos的ip地址出现如下界面:
点击现在开始按照步骤一步步的做,做错了也不要着急,大不了重新再来!
:)