yum安装wordpress
时间: 2024-03-07 07:45:01 浏览: 80
当使用yum安装WordPress时,需要先确保已经安装了LAMP(Linux、Apache、MySQL、PHP)环境。以下是使用yum安装WordPress的步骤:
1. 更新系统软件包:
```
sudo yum update
```
2. 安装Apache服务器:
```
sudo yum install httpd
```
3. 启动Apache服务并设置开机自启动:
```
sudo systemctl start httpd
sudo systemctl enable httpd
```
4. 安装MySQL数据库服务器:
```
sudo yum install mariadb-server
```
5. 启动MySQL服务并设置开机自启动:
```
sudo systemctl start mariadb
sudo systemctl enable mariadb
```
6. 运行MySQL安全脚本以提高安全性并设置root密码:
```
sudo mysql_secure_installation
```
7. 安装PHP及相关扩展:
```
sudo yum install php php-mysql php-gd php-xml php-mbstring
```
8. 重新启动Apache服务:
```
sudo systemctl restart httpd
```
9. 创建WordPress数据库和用户:
```
sudo mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
```
10. 下载并安装WordPress:
```
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvzf latest.tar.gz
sudo mv wordpress/* .
sudo chown -R apache:apache /var/www/html/
```
11. 配置WordPress:
```
sudo cp wp-config-sample.php wp-config.php
sudo vi wp-config.php
```
在wp-config.php文件中,修改以下内容:
```
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'password');
```
12. 设置文件权限:
```
sudo chmod -R 755 /var/www/html/
sudo chown -R apache:apache /var/www/html/
```
13. 访问WordPress网站:
在浏览器中输入服务器的IP地址或域名,即可访问WordPress安装页面。按照页面上的指引完成安装过程。
阅读全文