WordPress 最初是一个简单的博客系统,但已经发展成为一个著名的内容管理系统。 它也是最受欢迎的开源项目之一。 此外,很容易在您的 Fedora 系统。
安装软件包
Fedora 提供了一套预打包的软件,使安装变得容易。 打开终端,在命令提示符下,使用 sudo 安装以下软件包。
sudo dnf install @"Web Server" wordpress php-mysqlnd mariadb-server
这 example 假设您将在同一台机器上运行 Web 和数据库服务器。 学生和开发人员经常遇到这种情况。
使 Web 和数据库服务在引导时启动,然后立即启动它们:
sudo systemctl enable httpd.service mariadb.service sudo systemctl start httpd.service mariadb.service
设置数据库服务器
如果这是您第一次使用 MariaDB,您应该为您的 root 用户创建一个密码。 将其存放在安全的地方,以防您忘记它。 不要使用 系统自己的root(管理员)密码。
sudo mysqladmin -u root password
接下来,创建一个数据库。 您可以在一台机器上托管多个 WordPress 站点。 因此,您可能想为自己选择一个与众不同的名称。 例如,这个 example 使用 mywpsite。 -p 开关提示您输入密码。 您将需要它,因为您已经为 root 添加了密码。
sudo mysqladmin create mywpsite -u root -p
接下来,为数据库设置一个特殊的特权用户和密码。 Web 应用程序使用这些凭据运行。 此步骤使用标准的 mysql 客户端程序。 -D mysql 选项附加到存储特权的内置 mysql 数据库。
您的输入显示在 黑体字 在里面 example 以下。 确保使用强密码而不是密码本身。
$ sudo mysql -D mysql -u root -p Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 6 Server version: 10.1.18-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [mysql]> GRANT ALL PRIVILEGES ON mywpsite.* TO 'sqluser'@'localhost' IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) MariaDB [mysql]> QUIT; Bye
设置网络服务器
接下来,调整 SELinux 参数,以便 Web 服务器可以执行必要的功能。
sudo setsebool -P httpd_can_network_connect_db=1 sudo setsebool -P httpd_can_sendmail=1
接下来,编辑 Web 服务器的配置文件以允许连接。 要编辑的文件是 /etc/httpd/conf.d/wordpress.conf。 更改以下行:
Require local
相反,编辑它如下:
Require all granted
接下来,配置防火墙,使其允许端口 80 (HTTP) 上的流量:
sudo firewall-cmd --add-service=http --permanent sudo firewall-cmd --reload
配置 WordPress
接下来,编辑 /etc/wordpress/wp-config.php 文件。 提供所需的数据库设置,以便 WordPress 可以使用您提供的数据库。 这是要更改的行。 搜索每个并编辑所需的设置:
// ** 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');
如果您在与 Web 服务器相同的系统上提供数据库,则 DB_HOST 设置应保持 localhost。
最后,重启网络服务器:
systemctl restart httpd
访问 WordPress 网站
接下来,您已准备好配置 Web 应用程序本身。 在系统或连接的系统上打开 Web 浏览器。 然后浏览到您的 WordPress 主机的 IP 地址,然后是 /wordpress。 例如,您的 URL 可能是 https://192.168.122.210/wordpress。 如果你在同一个盒子上,你可以使用 https://localhost/wordpress。 此步骤开始设置过程:
填写所需信息。 请记住为此帐户使用强密码,因为它具有对整个 WordPress 博客的管理员访问权限。 完成后,选择底部的安装 WordPress。
将出现一个登录屏幕,以便您验证刚刚输入的 WordPress 用户名和密码。 登录,出现如下画面:
您现在已准备好创建内容。 有数以千计的主题和插件可用于自定义您的网站。 有关如何继续的更多信息,请访问 WordPress 网站.