WordPress is a blog platform developed using PHP. This document describes how to manually build WordPress on a CentOS 7.6 Tencent Cloud CVM.
To build WordPress, you must be familiar with common Linux commands, such as Installing Software via YUM (CentOS) and know how to use the software involved and their version compatibility.
NoteIt's recommended that you can configure a personal blog by using a Tencent Cloud marketplace image. It may take a long time to set up WordPress manually.
The following software is involved in building WordPress:
Log in to Linux instance (Web Shell). You can also use any of the following login methods you are comfortable with:
LNMP, an acronym for Linux, Nginx, MariaDB, and PHP, is one of the most common runtime environments for web servers. After you create and log in to a CVM instance, you can build the LNMP environment by referring to Manual Setup of LNMP (CentOS 7).
NoteThe user authentication method varies depending on the MariaDB version. For details, visit the MariaDB official website.
Run the following command to enter MariaDB:
mysql
Run the following command to create a MariaDB database, named wordpress
in this example:
CREATE DATABASE wordpress;
Run the following command to create a user, user
with the password 123456
in this example:
CREATE USER 'user'@'localhost' IDENTIFIED BY '123456';
Run the following command to grant user
all permissions to the wordpress
database:
GRANT ALL PRIVILEGES ON wordpress.* TO 'user'@'localhost' IDENTIFIED BY '123456';
Run the following command to set a password for root
.
NoteMariaDB 10.4 for CentOS allows the
root
account to log in without a password. Run the following command to set a password forroot
and record it so you can remember it.
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD('Enter your password');
Run the following command to apply all configurations.
FLUSH PRIVILEGES;
Run the following command to exit MariaDB.
\q
NoteYou can download the latest WordPress version from the official WordPress website.
Run the following command to delete the index.php
file that is used to test PHP-Nginx configuration from the root directory of the website:
rm -rf /usr/share/nginx/html/index.php
Run the following commands to navigate to the /usr/share/nginx/html/
directory and download and decompress the WordPress installation package:
cd /usr/share/nginx/html
wget https://cn.wordpress.org/wordpress-5.0.4-zh_CN.tar.gz
tar zxvf wordpress-5.0.4-zh_CN.tar.gz
wp-config-sample.php
file to the wp-config.php
file, and save the original configuration file for backup:cd /usr/share/nginx/html/wordpress
cp wp-config-sample.php wp-config.php
Run the following command to open and edit the new configuration file:
vim wp-config.php
Press i to enter the editing mode. Find the MySQL part in the file and change related configuration to content in Configuring the WordPress database.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'user');
/** MySQL database password */
define('DB_PASSWORD', '123456');
/** MySQL hostname */
define('DB_HOST', 'localhost');
http://domain name or the public IP address of the CVM instance/wordpress folder
, for example:http://192.xxx.xxx.xx/wordpress
Press Enter to switch to the WordPress installation page and configure WordPress.
2. Enter the installation information as described in the following table based on the WordPress installation wizard and click Install WordPress.
Required Information | Description |
---|---|
Website title | WordPress website name |
User Name | WordPress administrator name. For security purposes, use a name other than admin because admin can be easily cracked. |
Password | Use the default strong password or a custom password. Do not use existing passwords and ensure that the password is saved in a secure place. |
Email address | Email address used to receive notifications |
You can set a domain name for your WordPress website. In this way, users can use the domain name instead of a complex IP address to visit your website. If you build a website just to learn the process, you can use an IP address. However, this method is not recommended.
If you encounter a problem when using CVM, refer to the following documents for troubleshooting:
Was this page helpful?