centos7安装wordpress

本文详细介绍了如何在Linux环境下配置防火墙、安装并配置PHP、MySQL及WordPress,实现一个完整的博客系统。包括环境准备步骤、数据库创建过程以及WordPress的部署。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[b]环境准备[/b]

[b]防火墙配置[/b]


# 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



[b]php mysql 环境准备[/b]



# 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




[b]创建数据库用户名和密码[/b]

# 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
输入数据库信息, 就可以使用了
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值