0
点赞
收藏
分享

微信扫一扫

LAMP环境搭建wordpress

wordpress安装

翻找网上的教程基本都是之前的
很多都不匹配,比如PHP版本过低不支持新版wordpress
这里做一个更新,每一步都有详细说明


1.部署apache服务

#安装http服务
[root@xiudaochengxian ~]# yum -y install httpd
#启动http服务,并加入开机启动项
[root@xiudaochengxian ~]# systemcel start httpd
[root@xiudaochengxian ~]# systemcel enable httpd
#查看http服务状态
[root@xiudaochengxian ~]# systemcel status httpd
#打开浏览器输入本机地址
出现apache默认界面即为安装成功
#关闭防火墙
[root@xiudaochengxian ~]# systemcel stop firewalld

2.部署MariaDB服务

也可用MySQL,但是MariaDB安装使用都方便

MariaDB详细安装步骤点此

#安装mariadb
[root@xiudaochengxian ~]# yum -y install mariadb mariadb-server
#初始化数据库
[root@xiudaochengxian ~]# mysql_secure_installation
#启动数据库服务,并加入开机启动项
[root@xiudaochengxian ~]# systemcel start mariadb
[root@xiudaochengxian ~]# systemcel enable mariadb
#查看mariadb服务启动状态
[root@xiudaochengxian ~]# systemcel status mariadb

3.部署PHP服务

分界线下面是升级操作,非必须

#安装php和php-mysql(如果未安装此包,打开wordpress可能会报错)
[root@xiudaochengxian ~]# yum -y install php php-mysql
#安装php补丁包,也是一个php控制台
[root@xiudaochengxian ~]# yum -y install php-fpm
#启动php-fpm服务
[root@xiudaochengxian ~]# systemctl start php-fpm
#查看php-fpm服务启动状态
[root@xiudaochengxian ~]# systemctl status php-fpm
#查看php版本,如果版本过低,进行下面升级操作,反之不用
[root@xiudaochengxian ~]# php -v
---------------------------------------------------------------------------------
#删除之前的php
[root@xiudaochengxian ~]# yum remove php-common
#安装php软件yum源
[root@xiudaochengxian ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
[root@xiudaochengxian ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
#安装php 5.6版本(php56w-devel这个不是必需的)
[root@xiudaochengxian ~]# yum -y install php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring php56w-fpm
#可以查看下缺失了那些依赖包
[root@xiudaochengxian ~]# yum search php56w
#重启http服务
[root@xiudaochengxian ~]# systemctl restart httpd
#查看php版本
[root@xiudaochengxian ~]# php -v

4.安装wordpress

#从国内的一些网站下载wp源码包,速度较快(也可以从官网下载)
[root@xiudaochengxian ~]# wget https://www.linuxprobe.com/Software/wordpress.tar.gz
#解压wordpress源码包
[root@xiudaochengxian ~]# tar xzvf wordpress.tar.gz
#将WordPress解压后的网站文件复制进去
[root@xiudaochengxian ~]# mv wordpress/* /var/www/html/
#切换到http服务网站默认路径
[root@xiudaochengxian ~]# cd /var/www/html/
#查看是否复制成功
[root@xiudaochengxian html]# ll
total 208
-rw-r--r--  1 1006 1006   405 Feb  6  2020 index.php
-rw-r--r--  1 1006 1006 19915 Jan  1  2021 license.txt
-rw-r--r--  1 1006 1006  7345 Dec 30  2020 readme.html
-rw-r--r--  1 1006 1006  7165 Jan 21  2021 wp-activate.php
drwxr-xr-x  9 1006 1006  4096 May  4  2021 wp-admin
-rw-r--r--  1 1006 1006   351 Feb  6  2020 wp-blog-header.php
-rw-r--r--  1 1006 1006  2328 Feb 17  2021 wp-comments-post.php
-rw-r--r--  1 1006 1006  2913 Feb  6  2020 wp-config-sample.php
drwxr-xr-x  5 1006 1006  4096 May  4  2021 wp-content
-rw-r--r--  1 1006 1006  3939 Jul 31  2020 wp-cron.php
drwxr-xr-x 25 1006 1006 12288 May  4  2021 wp-includes
-rw-r--r--  1 1006 1006  2496 Feb  6  2020 wp-links-opml.php
-rw-r--r--  1 1006 1006  3313 Jan 11  2021 wp-load.php
-rw-r--r--  1 1006 1006 44994 Apr  5  2021 wp-login.php
-rw-r--r--  1 1006 1006  8509 Apr 14  2020 wp-mail.php
-rw-r--r--  1 1006 1006 21125 Feb  2  2021 wp-settings.php
-rw-r--r--  1 1006 1006 31328 Jan 28  2021 wp-signup.php
-rw-r--r--  1 1006 1006  4747 Oct  9  2020 wp-trackback.php
-rw-r--r--  1 1006 1006  3236 Jun  9  2020 xmlrpc.php
#复制wordpress基本配置文件
[root@xiudaochengxian html]# cp wp-config-sample.php wp-config.php
#进入mariadb,创建用于网站的数据库
[root@xiudaochengxian html]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 5.5.68-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> exit
Bye

#编辑wordpress基本配置文件
[root@xiudaochengxian html]# vim wp-config.php 
define( 'DB_NAME', '创建的数据库名称,这里是wordpress' );

/** MySQL database username */
define( 'DB_USER', '用户,这里是root' );

/** MySQL database password */
define( 'DB_PASSWORD', '自己设置的密码' );

#重启http服务
[root@xiudaochengxian ~]# systemcel restart httpd
#浏览器输入本机地址即可打开wordpress默认界面
举报

相关推荐

0 条评论