Preparation:

1. A cloud server

2, a domain name (you can first set up a blog and then to get a domain name)

This topic mainly covers basic Linux commands and basic mysql operations

steps

I. Server construction

To buy a network cloud server, you can consider Ali Cloud, Tencent cloud, Baidu cloud, etc., here to Ali cloud server for example. The share price is about 170 yuan for half a year. There will be occasional activities, the first half price, etc. System configuration Ubuntu16.04

You can view the configuration of the purchased server in the administrative console

Two, network environment deployment

After the purchase is complete, change the remote login password in more Settings in the background of the management terminal

Reset password is to reset the password of the server after remote login (user name root).

Add an access rule to the security group to allow port 80 and port 22 access

3. Setup of Ubuntu Lamp installation environment

(Copy the previous code CTRL + C, then xshell login cloud host directly Shift+Insert copy, -y indicates that the installation needs to be determined, enter Y.)

1. Upgrade the system and update the source

sudo apt-get update
sudo apt-get upgrade
Copy the code

(There will be words like “config” in the middle for you to choose, just enter by default)

2. Configuration apache2

apt-get install apache2 -y
Copy the code

On the local computer (open the browser on your own computer), enter http://< CLOUD host IP address >. The IT Works page is displayed. Apache2 is successfully installed.

3. Install PHP components

Apt-get has PHP7.0, so we can install php7.0 directly.

Sudo apt-get install PHP7.0-yCopy the code

Sudo apt-get install libapache2-mod-php7.0

4. Install the mysql database

sudo apt-get install mysql-server -y
Copy the code

Install PHP mysql related components:

Sudo apt - get the install php7.0 - mysqlCopy the code

5. Install phpmyadmin

Use apt-get to install phpMyAdmin. During the installation process, you need to select Apache2 as prompted, and then enter the root password and database password:

sudo apt-get install phpmyadmin -y
Copy the code

Mysql: /var/ WWW/HTML: /var/ WWW/HTML: /var/ WWW/HTML: /var/ WWW/HTML: /var/ WWW/HTML: /var/ WWW/HTML

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
Copy the code

7. Restart mysql and Apache2

sudo service mysql restart
sudo systemctl restart apache2.service
Copy the code

4. Download and install wordpress

1. Download the wordpress

Wget HTTP: / / https://cn.wordpress.org/wordpress-5.0.3-zh_CN.zipCopy the code

2. Install the decompression tool

sudo apt-get install zip
Copy the code

3. Decompress the wordpress installation package

Sudo unzip wordpress - 5.0.3 - zh_CN. ZipCopy the code

4. Configure a database for wordpress

Enter the following code in mysql:

mysql -u root -p
Copy the code

Then enter your MySQL password as prompted

5. Create a database for wordpress called wordpress

CREATE DATABASE wordpress;
Copy the code

6. Set a user for this database as wordpressuser:

CREATE USER wordpressuser;
Copy the code

7. Configure a password password123 for this user.

SET PASSWORD FOR wordpressuser= PASSWORD("password");
Copy the code

You’d better set your own password here

8. Configure database access permissions for this user:

GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser IDENTIFIED BY"password123";
Copy the code

Remember to use the same password as in step 7

9. Take effect

FLUSH PRIVILEGES;
Copy the code

10. Exit mysql

exit;
Copy the code

5. WordPress

1. Since PHP access /var/www/html/ by default, we need to copy all the files in wordpress folder to /var/www/html/

sudo mv wordpress/* /var/www/html/
Copy the code

/var/ WWW/HTML /

sudo chmod -R 777 /var/www/html/
Copy the code

3. Specify Apache to index.html

sudo mv /var/www/html/index.html /var/www/html/index~.html
Copy the code

Restart the Apache service.

sudo systemctl restart apache2.service
Copy the code

Vi. WordPress construction completed

On the local browser, enter the server IP address to go to the wordpress installation page. Enter the database password on the wordpress installation page to complete the installation. On the local server, enter the IP address /wp-admin to go to the wordpress background


Possible problems

Sudo apt-get upgrade E: /var/lib/dpkg/lock-frontend – open (11: resource temporarily unavailable) ‘cannot be obtained

Enter the following command:

sudo rm /var/cache/apt/archives/lock  
sudo rm /var/lib/dpkg/lock
Copy the code

The cause of this problem may be: In Ubuntu termial, when installing software with apt-get Install, if the terminal is closed before the download is completed. The apt-get process may not end at this point. As a result, the above error occurs when you run apt-get install again. That is, another program is occupying the apt-get install process. Because it will occupy the system lock when the software source is updated (referred to as “system update lock”) when it is running, the resources are locked.

2. FTP server cannot be connected after wordpress is set up

WordPress adds a layer of FTP authentication when installing plug-ins or themes for security purposes. However, the FTP server often fails to connect, so how do we correctly through FTP authentication? Sorry, as a beginner, I haven’t found a solution yet. But found a way to block FTP authentication.

Solution: Open the basic configuration file wp-config.php and add the code in the last line:

if(is_admin()) {
        add_filter('filesystem_method', create_function('$a'.'return "direct"; ' ));
        define('FS_CHMOD_DIR', 0751);
}
Copy the code

Then the plug-in is installed without verification.

3, in the establishment of the database wordpress database name, account name setting error solution.

Drop database drop database name;

To drop an account, run the drop user command.

(Note: Searching online for articles about deleting an account may ask you to type “drop user account name @’%’; Drop user User name @localhost; It doesn’t have to be so complicated here.


Refer to the link

Ubuntu16.04 wordpress Site setup tutorial

Fix ubuntu16.04 ‘E: Failed to obtain lock /var/lib/dpkg/lock-frontend – open (11: Resource temporarily unavailable)

WordPress problem -FTP server cannot connect

WordPress installation theme failed to connect to FTP server solution