Use WordPress to build an exclusive blog - Alibaba Cloud Lab study notes

1. Connect to the ECS server

ssh [username]@[ipaddress] and press enter on the keyboard. You need to replace username and ipaddress with the login name and public address of the ECS server

2. Install the Chinese version of WordPress

1. Install WordPress.

a. Execute the following command to get the wordpress Chinese installation package. Because the installation package is pulled from the official website, the speed is a little slow, just wait patiently.


b. Execute the following command to decompress.

tar -zxvf latest-zh_CN.tar.gz

c. Execute the following command to move wordpress to the Apache root directory.

mkdir /var/www/html/wp-blog
mv wordpress/* /var/www/html/wp-blog/

2. Initialize wordpress.

a. Execute the following command to view the wp-config-sample.php file.

cat -n /var/www/html/wp-blog/wp-config-sample.php

b. As can be seen from the figure above, wordpress needs to be manually copied and configured.

Execute the following command, copy wp-config-sample.php to wp-config.php (this file is WordPress configuration file, including database configuration), and modify the database configuration in it.

# Go to the WordPress directory
cd /var/www/html/wp-blog/
# Copy the template file as a configuration file
cp wp-config-sample.php wp-config.php  
# database_name_here is the database name
sed -i 's/database_name_here/wordpress/' /var/www/html/wp-blog/wp-config.php
# username_here is the username of the database
sed -i 's/username_here/root/' /var/www/html/wp-blog/wp-config.php
# password_here is the login password of the database
sed -i 's/password_here/NewPassWord1./' /var/www/html/wp-blog/wp-config.php

3. Start the Apache server.

systemctl start httpd

4. Visit http://<ECS public network IP>/wp-blog/wp-admin/install.php with the browser to complete the wordpress initialization configuration.

5. Visit http://<ECS public network IP>/wp-blog/wp-admin/index.php to log in to the WordPress management console.

3. Customize the site

The power of WordPress is largely due to its good extensions and support for numerous themes and plugins.

WordPress can generally be installed through two installation methods.

Method 1: Search and install online

a. Browser to access the WordPress admin console.

b. Click Appearance>Themes.

c. Click Add. Choose your favorite theme to install.

Method 2: Upload the theme directly to the wordpress server.

a. Visit with your browser to enter the WordPress theme list page.

b. Click Feature Filter (Attribute Filter).

c. Select Single Column in the Layout column, Accessibility Friendly in the Featured column, and Blog in the Subject column, and then click Apply Filter.

d. Select your preferred theme.

. Right-click the download and click Copy Link Address.

f. Connect to the ECS server.

g. At the command line, execute the following command to download and install the theme.

# First enter the WordPress theme directory
cd /var/www/html/wp-blog/wp-content/themes/
# Use the wget command to download the theme selected in the previous step
# Use the unzip command to decompress the installation package
# view all topics


h. Go back to the Wordpress management console, enter the theme page, and you can see that the Markiter theme has been installed.

i. Click Enable to apply the theme.

4. Add custom widgets

1. Connect to the ECS server.

2. Execute the following command to edit the footer file footer.php of the blog theme (it needs to be changed to the theme name enabled in the previous step).

vim /var/www/html/wp-blog/wp-content/themes/markiter/footer.php

3. Add the following code before the </body> tag of the file, and click i to edit. After editing, press ESC to exit and enter: wq to save and exit.

<script src=""></script>
<script type="text/javascript">

4. Access http://<ECS public network IP>/wp-blog/ with a browser, and enter the homepage of the blog to check the component effect.

5. At this point, the interface settings are all completed.

5. Install the MarkDown plugin

The way WordPress installs plugins is similar to the way to install themes, both are divided into online installation and offline installation. This step mainly introduces offline installation.

1. Connect to the ECS server.

2. Execute the following command to enter the wordpress plugin directory.

cd /var/www/html/wp-blog/wp-content/plugins/

3. Execute the following command to download the MarkDown plug-in.


4. After the download is complete, execute the following command to decompress the installation package.


5. Go back to the WordPress admin console and click Plugins > Installed Plugins

6. Click Enable to enable the MarkDown plugin.

The editor effect is as follows.

7. At this point, the installation of the MarkDown plug-in is complete. For more plugins please visit WordPress Plugins | China Simplified Chinese Check.

6. Purchase a Domain Name

After completing all the above operations, you can complete the purchase and binding of the domain name through the following steps.

1. Query the domain name.

a. Login Alibaba Cloud Domain Name Registration Page.

b. Enter the domain name you want in the query box, select the domain name suffix, and click Search Domain Name.

2. Click Add to List, then confirm the added domain name in the domain name list, and click Settle Now.

3. Add the domain name holder information and confirm the domain name terms of service.

a. On the order confirmation page, select the purchase period and holder type of the domain name.

b. Add domain name holder information.

c. Read and select the terms of service, click buy now.

4. After selecting the payment method, click Pay Now.

7. Domain name filing

According to the "China Internet Domain Name Management Measures", domain name registration applicants should submit true, accurate and complete domain name holder information. For domain name real-name authentication, it is recommended that you prepare the required materials according to the authentication requirements. When multiple domain names need to use the same materials for authentication, batch authentication can be performed. See Universal domain name real-name authentication.

8. Domain name resolution

1. Login Alibaba Cloud DNS Console.

2. On the domain name resolution page, click the domain name to enter the resolution setting page.

3. On the Analysis Settings page, click Beginner's Guide.

4. Enter the IP address of the website space, then click OK, Alibaba Cloud DNS will automatically create two website resolution records for you.

Nine, configure wordpress domain name

1. Configure the Apache server access address.

a. Connect to the ECS server.

b. Execute the following command to edit the Apache configuration file.

vim /etc/httpd/conf/httpd.conf

c. Enter i to enter edit mode.

d. Modify the server default access path. The default access path is /var/www/html/. Here we modify it to the WordPress project path /var/www/html/wp-blog/. The modified file is shown below.

DocumentRoot "/var/www/html/wp-blog/"

<Directory "/var/www/html/wp-blog/">
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    # The Options directive is both complicated and important.  Please see
    # for more information.
    Options Indexes FollowSymLinks
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    AllowOverride None

    # Controls who can get stuff from this server.
    Require all granted

The modified file is shown below.  

e. Press the Esc key to exit the edit mode, enter: wq to save and exit.

2. Log in to the WordPress management console, click Settings to enter the WordPress settings interface

3. In the setting interface, modify the WordPress address (URL) and site address (URL) to your registered domain name.

4. Click Save when the modification is complete.

5. So far, a complete WordPress blog system has been built.

Tags: server Alibaba Cloud

Posted by machiavelli1079 on Thu, 17 Nov 2022 12:11:54 +1030