防火墙配置
# yum -y install iptables-services # vim /etc/sysconfig/iptables # sample configuration for iptables service # you can edit this manually or use system-config-firewall # please do not ask us to add additional ports/services to this default configuration *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT # 防火墙开机启动 # service iptables start # chkconfig iptables on
php mysql 环境准备
# yum install -y httpd # yum install -y mariadb-server # yum install -y php # yum install -y php-mysql # yum install -y php-xml # yum install -y php-gd # 可以直接使用 yum install httpd php php-mysql php-gd php-xml mariadb-server mariadb # 关闭 SELINUX, 不关闭的话php无法连接mysql # getenforce Enforcing # vim /etc/selinux/config # SELINUX=enforcing SELINUX=disabled
解压wordpress 放入html路径
# cd /application/download/ # wget https://wordpress.org/latest.tar.gz # mv latest.tar.gz WordPress.tar.gz # tar -zxvf WordPress-4.3.1.tar.gz # mv /application/download/wordpress/ /var/www/html/ # chown -R apache.apache /var/www/html/wordpress/ # ll -a
创建数据库用户名和密码
# mysql -h192.168.1.20 -uroot -p Enter password: MariaDB [(none)]> create database word_press default character set utf8; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> show create database word_press; +------------+---------------------------------------------------------------------+ | Database | Create Database | +------------+---------------------------------------------------------------------+ | word_press | CREATE DATABASE `word_press` /*!40100 DEFAULT CHARACTER SET utf8 */ | +------------+---------------------------------------------------------------------+ 1 row in set (0.00 sec) MariaDB [(none)]> grant all privileges on word_press.* to 'wordpress'@'%' identified by 'wordpress'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> show grants for 'wordpress'@'%'; +----------------------------------------------------------------------------------------------------------+ | Grants for wordpress@% | +----------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'wordpress'@'%' IDENTIFIED BY PASSWORD '*C260A4F79FA905AF65142FFE0B9A14FE0E1519CC' | | GRANT ALL PRIVILEGES ON `word_press`.* TO 'wordpress'@'%' | +----------------------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec)
访问 http://192.168.1.20/wordpress
输入数据库信息, 就可以使用了