美文网首页
安装 WordPress

安装 WordPress

作者: _于曼丽_ | 来源:发表于2022-03-07 15:01 被阅读0次
  1. wordpress 中文官网 下载 wordpress。

  2. 将下载的压缩包上传到服务器。

scp -r wordpress-5.9.1-zh_CN.tar.gz root@192.168.100.103:/web/download
  1. 解压缩
tar -zxvf wordpress-5.9.1-zh_CN.tar.gz
  1. 复制到网站根目录
cp -r wordpress /web
  1. 浏览器访问 https://192.168.100.103/wordpress/wp-admin/setup-config.php
    浏览器提示:
    Your server is running PHP version 5.4.16 but WordPress 5.9.1 requires at least 5.6.20.

  2. 升级 php 版本
    参考
    6.1 查看目前php版本

    php -v
    

    6.2 删除之前的 php

    yum remove php-common
    

    6.3 安装 php 软件 yum 仓库

    rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    

    6.4 安装php 5.6版本(php56w-devel这个不是必需的)(可以使用yum search php56w查看下缺失了那些依赖包)

    yum -y install php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring php56w-fpm
    

    6.5 重启 httpd 服务

    systemctl restart httpd
    php -v
    
  3. 创建数据库以及数据库用户

mysql -u root -p

create database wordpress;
show databases;
GRANT ALL ON wordpress.* TO 'lishiqing'@'192.168.100.103' IDENTIFIED BY '123456';
exit
  1. 修改 wordpress 基础配置文件
cp wp-config-sample.php wp-config.php
vi wp-config.php
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** Database username */
define( 'DB_USER', 'lishiqing' );

/** Database password */
define( 'DB_PASSWORD', '123456' );

/** Database hostname */
define( 'DB_HOST', '192.168.100.103' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
systemctl restart httpd
  1. 设置 selinux,selinux 默认阻止 httpd 使用网络连接的功能,因此 httpd 无法连接到数据库
getsebool -a | grep httpd
setsebool -P httpd_can_network_connect=1
  1. 浏览器访问 https://192.168.100.103/wordpress/wp-admin/setup-config.php

点击继续安装

相关文章

网友评论

      本文标题:安装 WordPress

      本文链接:https://www.haomeiwen.com/subject/anagrrtx.html