centos7之安装wordpress

wordpress安装教程如下:

mysql安装可以参考我的博客园Centos构建Java环境:https://www.cnblogs.com/youcong/p/9118753.html

1.安装apache
yum install httpd

systemctl start httpd

2.安装php

yum install -y php php-mysql
systemctl restart httpd

vim /var/www/html/info.php

<?php phpinfo(); ?>


3.安装phpmyadmin(补充说明:安装mysql教程不论是centos还是ubuntu,可以参考我的博客文章)
yum install -y epel-release
yum install -y phpmyadmin

vim /etc/httpd/conf.d/phpMyAdmin.conf

配置文件内容如下:

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
    #   Require ip 127.0.0.1
     #  Require ip ::1
      Require all granted
   </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 127.0.0.1
       Require ip ::1
     </RequireAny>
   </IfModule>
</Directory>

重启httpd服务器
systemctl restart httpd

安装完phpmyadmin一定要输入对应的地址进入phpMyAdmin管理平台
进入该平台进行用户添加和数据添加
也可以通过命令行的形式:
例如:
# 登录数据库
mysql -u root -p
# 创建数据库
CREATE DATABASE wordpress;
# 创建数据库用户和密码
CREATE USER wordpressuser@localhost IDENTIFIED BY '123456';
# 设置wordpressuser访问wordpress数据库权限
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY '123456';
# 刷新数据库设置
FLUSH PRIVILEGES;
# 退出数据库
exit

4.安装wordpress
http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz

解压后并在当前目录下执行:sudo rsync -avP ~/wordpress/ /var/www/html/wordpress/

# 切换到wordpress目录
cd /var/www/html/wordpress
# 复制wp-config.php文件
cp wp-config-sample.php wp-config.php
# 编辑wp-config.php文件
sudo vim wp-config.php

默认内容如下:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');
/** MySQL database username */
define('DB_USER', 'username_here');
/** MySQL database password */
define('DB_PASSWORD', 'password_here');
/** MySQL hostname */
define('DB_HOST', 'localhost');

将其修改为:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpress');
/** MySQL database password */
define('DB_PASSWORD', '123456');
/** MySQL hostname */
define('DB_HOST', 'localhost');

完成后在浏览器输入地址:www.example.com/wordpress/wp-admin/install.php
按照步骤来,一步一步安装。

posted @ 2018-06-28 20:47  挑战者V  阅读(3698)  评论(2编辑  收藏  举报