安装wordpress

一·安装Apache HTTP服务

  1. yum -y install httpd
  2. yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
  3. service httpd start # 启动服务
  4. chkconfig httpd on # 设置开机自启动

默认监听端口为80和443

二. 安装MYSQL数据库

  1. yum -y install mysql mysql-server
  2. service mysqld start
  3. mysql_secure_installation
  4. mysql -uroot -p123
  5. create database wordpress;
  6. chkconfig mysqld on

[root@ossec-server ~]# yum install mysql-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
No package mysql-server available.
Error: Nothing to do

会报错原因是yum安装库里没有直接可以用的安装包,这时候就需要用到MariaDB了,MariaDB是

MySQL社区开发的分支,也是一个增强型的替代品。

  1. yum -y install mariadb-server mariadb mariadb-devel
  2. systemctl start mariadb # 启动mariadb服务
  3. mysql_secure_installation # 刚安装时root是没有密码的,所以为了安全要设置密码
  4. mysql -uroot -p123
  5. systemctl enable mariadb == chkconfig mysqld on # 设置开机自启动

默认监听端口为3306

三.安装PHP语言环境

  1. yum -y install php php-mysql
  2. yum -y install gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap # 安装PHP常用模块
  3. service httpd restart
  4. echo "<?php phpinfo();?>" > /var/www/html/phpinfo.php

四.安装WordPress并配置mysql

  1. wget https://cn.wordpress.org/wordpress-4.7.4-zh_CN.tar.gz

  2. tar -zxf wordpress-4.7.4-zh_CN.tar.gz

  3. cd wordpress
    cp wp-config-sample.php wp-config.php

  4. vim wp-config.php

  5. mkdir /var/www/html/wp-blog
    mv * /var/www/html/www/html/wp-blog

    sitename:wordpress
    user:luli
    pwd:focp#cr%jYaq3AnHQfocp#cr%jYaq3AnHQ

推荐阅读更多精彩内容