在这一步中,您将下载 WordPress 软件并设置配置。
首先,在您的终端中运行以下命令,下载并解压软件:
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
如果运行“ls”来查看目录的内容,您将看到一个 tar 文件和一个名为 wordpress 的目录,其中包含已解压的内容。
$ ls
latest.tar.gz wordpress
转到 wordpress 目录,然后使用以下命令创建默认配置文件的副本:
cd wordpress
cp wp-config-sample.php wp-config.php
然后,运行以下命令,使用 nano 编辑器打开 wp-config.php 文件。
您需要编辑两个配置区域。
首先,通过更改以下几行来编辑数据库配置:
// ** 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' );
值应为:
● DB_NAME:“wordpress”
● DB_USER:您在上一模块的数据库中创建的用户的名称
● DB_PASSWORD:您在上一模块中创建的用户的密码。
● DB_HOST:您在上一模块中找到的数据库的主机名。
另一个需要配置的配置部分是身份验证唯一密钥和盐验证。它在配置文件中如下所示:
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );
转到此链接,为此配置部分生成值。您可以将该部分中的所有内容替换为该链接中的内容。
您可以通过依次按下 CTRL+O 和 CTRL+X 进行保存并退出 nano。
更新配置后,您已基本完成部署 WordPress 网站的准备工作。在下一步中,您将使 WordPress 网站上线。