The scene is introduced

An ECS (cloud server) instance with a CentOS base environment is used, and the LAMP environment has been built in the server. Install WordPress on your server to help you quickly build your own blog on the cloud. Aliyun cloud server resources free experience

Background knowledge

This scenario mainly involves the following cloud products and services:

Cloud server The Elastic Compute Service (ECS) is an IaaS (Infrastructure as a Service) cloud computing Service provided by Ali Cloud with excellent performance, reliability, and Elastic expansion. Cloud server ECS eliminates the need for you to purchase IT hardware and allows you to use the server as conveniently and efficiently as you use public resources such as water, electricity, and natural gas, realizing out-of-the-box and flexible scaling of computing resources. Ali Cloud ECS continues to provide innovative servers to solve a variety of business needs and help your business development.

WordPress WordPress is a blogging platform developed using THE PHP language. Users can set up their own websites on servers that support THE PHP and MySQL databases. You can also use WordPress as a content management system (CMS).

The final result of this scenario is similar to the following: blog home pageBlog Edit page

Step 1: Connect to the ECS server

The specific operation can be seen in the steps of aliyun Experience Laboratory connection

If you have not purchased and operated ECS, you can experience aliyun ECS server for free here. Source address: developer.aliyun.com/adc/scenari…

Step 2: Install the WordPress Chinese version

1. Install WordPress. A. Run the following command to obtain the Chinese wordpress installation package.

wget https://cn.wordpress.org/latest-zh_CN.tar.gz

Copy the code

B. Run the following command to decompress the decompression package.

tar -zxvf latest-zh_CN.tar.gz

Copy the code

C. Run the following command to move wordpress to the Apache root directory.

mkdir /var/www/html/wp-blog
mv wordpress/* /var/www/html/wp-blog/
Copy the code

2. Initialize wordpress.

A. Run the following command to view the wp-config-sample. PHP file:

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

Copy the code

B. From the figure above, you can see that wordpress needs to be manually copied and configured. Run the following command to copy wp-config-sample. PHP to wp-config. PHP and modify the database configuration.

PHP # database_name_here: sed -i 's/database_name_here/wordpress/ PHP /var/ WWW/HTML /wp-blog/wp-config. PHP /var/ WWW/HTML /wp-blog/wp-config. /var/ WWW/HTML /wp-blog/wp-config. PHP # password_here: sed -i 's/password_here/NewPassWord1. /var/www/html/wp-blog/wp-config.phpCopy the code

3. Start the Apache server.

systemctl start httpd

Copy the code

4. Visit http://<ECS public IP address >/wp-blog/wp-admin/install. PHP to complete the initial configuration of wordpress.

5. Log in to the WordPress management console through http://<ECS public IP address >/wp-blog/wp-admin/index.php.

Step 3: Customize the site theme

The great power of WordPress is largely due to its excellent extensions and extensive support for themes and plug-ins. WordPress can be installed in one of two ways.

  • Method 1: Search for the installation online

A. Use a browser to access the WordPress management console. B. Choose Appearance > Topics.C. Click Add. Choose your favorite theme to install.

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

A. Browser accessSettlement cn.wordpress.org/themes/ into… B. Click Function filtering. C. In the Layout column, select Accessibility in the Features column, select Blogs in the Topics column, and click Apply Filter.D. Choose a theme you like. For example: Markiter.E. Right-click download and click Copy link address.F. Connect to the ECS server. G. On the CLI, run the following command to download and install the theme:

Wp-blog /wp-content/themes/ # run the wget command to download the themes selected in the previous step https://downloads.wordpress.org/theme/markiter.1.5.zip # use unzip command unzip the installation package unzip markiter. 1.5. Zip # ll see all themesCopy the code

The result is similar to the following:H. Return to the WordPress administration console and enter the Theme page. You can see that the Markiter theme has been installed.I. Click Enable to apply the theme.

Step 3: Add custom widgets

1. Connect to the ECS server. 2. Run the following command to edit the blog theme footer. PHP.

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

Copy the code

3. Add the following code before the file label.

< script SRC = "https://cdn.jsdelivr.net/npm/[email protected]/lib/L2Dwidget.min.js" > < / script > < script type="text/javascript"> L2Dwidget.init(); </script>Copy the code

4. Visit http://<ECS public IP address >/wp-blog/ to view the component effect on the homepage.5. The interface Settings are complete.

Step 4: Install the MarkDown plug-in

The way to install a plugin in WordPress is similar to the way to install a theme, including online installation and offline installation. This section describes the offline installation. 1. Connect to the ECS server. 2. Run the following command to go to the wordpress plug-in directory.

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

Copy the code

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

Wget HTTP: / / https://downloads.wordpress.org/plugin/wp-editormd.10.1.2.zipCopy the code

4. Run the following command to decompress the installation package.

Unzip wp - editormd. 10.1.2. ZipCopy the code

5. Return to the WordPress administrative console and click Plug-ins > Installed Plug-ins6. Click Enable to enable the MarkDown plug-in.The editor looks like this.7. At this point, MarkDown plug-in is installed. More plug-ins are availableCn.wordpress.org/plugins/ view.