Use WordPress to build your own blog

WordPress is a blog platform developed in PHP language. Users can set up their own websites on servers that support PHP and MySQL databases.


  • Install WordPress independently
  • CentOS common commands
  • Install themes and plug-ins on WordPress

1. Environmental preparation

ECs, LAMP environment

2. Terminal login to ECS

xshell and other terminal software log in to the ECS.

@The following is the ECS IP address

3. Install WordPress Chinese version

one   Install WordPress.

     a.   Execute the following command to obtain wordpress Chinese installation package. Because the installation package is pulled from the official website, the speed is slightly slow. Just wait patiently.


     b.   Execute the following command to unzip.

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/

two   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 above figure, wordpress needs to be manually copied and configured.

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

# Enter WordPress directory
cd /var/www/html/wp-blog/
# Copy template file as 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 user name 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

three   Start the Apache server.

systemctl start httpd

four   The browser accesses http: / / < ECS public IP > / WP blog / WP admin / install.php to complete wordpress initialization configuration.

five   Visit http: / / < ECS public IP > / WP blog / WP admin / index.php to log in to the WordPress management console.

4. Customize the site theme

The powerful function of WordPress is largely due to its good expansion and the support of many themes and plug-ins.

WordPress can generally be installed through two installation methods.

Method 1: online search and installation

a. The browser accesses the WordPress administration console.

b. Click appearance > theme.

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

Method 2: upload the theme directly to wordpress server.

a. Browser access Enter the WordPress theme list page.

b. Click function filter.

c. Check the menu bar in the layout column, check accessibility friendly in the feature column, check blog in the theme column, and then click Apply filter.

d. Choose your favorite theme. For example: Markiter.

e. Right click download, and then click Copy link address.

f. Connect the ECS server.

g. On 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 topic selected in the previous step
# Unzip the installation package using the unzip command
# View all topics

The execution result of the command is similar to the following.

h. Return to the Wordpress management console and enter the theme page. You can see that the Markiter theme has been installed.

i. Click enable to apply the theme.

5. Add custom widget

1. Connect the ECS server.

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

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

3. Add the following code in front of the file < / body > label 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. Visit http: / / < ECS public IP > / WP blog /, and enter the homepage of the blog to view the component effect.

5. So far, the interface settings are all completed.

6. Installing the MarkDown plug-in

WordPress installs plug-ins in a similar way to installing themes. They are divided into online installation and offline installation. This step mainly introduces offline installation.

one   Connect the ECS server.

two   Execute the following command to enter the wordpress plug-in directory.

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

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


four   After downloading, execute the following command to unzip the installation package.

five   Return to the WordPress administration console and click plug ins > installed plug ins

six   Click enable to enable the MarkDown plug-in.

When enabled, the effect of editing an article is as follows.  

 seven   At this point, the MarkDown plug-in installation is complete. For more plug-ins, please visit WordPress plugin | China simplified Chinese see.

7. (optional) purchase domain name

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

one   Query domain name.

    a.   Sign in Alicloud domain name registration page.

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

two   Click Add to the list, then confirm the added domain name in the domain name list, and click settle now.

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

    a.   On the confirm order page, select the purchase age and holder type of the domain name.

    b.   Add the owner information of the domain name.

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

four   After selecting the payment method, click pay now.

8. (optional) domain name filing

According to the provisions of the measures for the administration of Internet domain names in China, domain name registration applicants shall submit true, accurate and complete domain name holder information. During 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 material for authentication, batch authentication can be carried out. See Universal domain name real name authentication.

9. (optional) domain name resolution

By associating the domain name with the IP address of the ECS, users can access the server with the IP address according to the domain name.

one   Sign in Cloud resolution DNS console.

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

three   On the parsing settings page, click novice guide.

four   Enter the IP address of the website space and click OK. Cloud resolution DNS will automatically help you create two website resolution records.

10. (optional) configure wordpress domain name

one   Configure the Apache server access address.

    a.   Connect 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 default access path of the server. The default access path is / var/www/html /. Here, we modify the WordPress project path to / var/www/html / WP blog /.

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 as follows.

    e.   Press Esc to exit editing mode, and enter: wq save to exit.

two   Log in to the WordPress management console and click settings to enter the WordPress settings interface.

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

four   Click save when the modifications are complete.

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

(you can build a blog system for automatic test learning)

Tags: wordpress

Posted on Wed, 10 Nov 2021 15:46:28 -0500 by buckit