In this article, we will guide you how to install WordPress in Ubutu VPS.
Installation conditions
Before I start, you must have your own VPS server. Nowadays, various clouds are quite popular. You can consider them by yourself. I personally use Alibaba Cloud VPS, which is a little expensive and stable. It seems that you are engaged in an activity recently. You can check it yourself. If you are a single small website, you are advised to buy a virtual host. It should be more than enough to create a small WordPress blog. You can adjust the server by yourself as the traffic increases in the future.
WordPress stores all information based on PHP and Mysql databases. Therefore, you need to install some configuration environments, such as June's LNMP one-click installation package, or some integration panels such as wdcp. If you do not like these, you can go and check out what I posted earlier: recommended VPS Management Panel: 18 open-source/commercial Linux server control panel. There are many excellent foreign host panels.
If the environment and configuration are complete, you can use any SSH client to log on to your VPS server, and then install the following operations.
1. Create a MySQL database and user for WordPress
As I mentioned above, WordPress requires a database to store all the information. We have installed the MySQL database. Now let's create a database and a user for the WordPress program.
Run the following command to obtain the root access permission for MySQL:
Mysql-u root-p
After entering your root password, you will get the MySQL prompt to run the command. Now, you can create a WordPress blog Database. I will name this database wordpressdemo. You can customize your database name. Enter the following command:
Create database wordpressdemo;
Now, we want to create a new user for the WordPress database. It is a good practice to create a single database user for data security considerations.
After creating a MySQL user, you must grant all the privileges of related data:
Grant all on wordpressdemo. * TO deshortname @ localhost identified by 'qwerty ';
The above Command will create a "qwerty password" database user deoffset, and this user has all the permissions of the database wordpressdemo. Mysql needs flush privileges to refresh the MySQL system permission table after setting a user or changing the password. Otherwise, access is denied. Run the following command:
Flush privileges;
Close the MySQL command prompt:
Exit
2. Download the WordPress installation package
In the next step, we will download the latest version of the WordPress program. First, change the directory to the file directory where your website is located. In Apache, it is usually the public_html of the htdocs Directory. Now, I have created public_html, so I changed the directory.
Change the directory to the WordPress file location:
Cd/var/www/domain.com/public_html/
Run the wget command to download the WordPress installation package:
Wget http://cn.wordpress.org/wordpress-3.9-zh_CN.tar.gz
Enter the decompression command to decompress the installation package to the current directory:
Tar -- strip-components = wordpress-3.9-zh_CN.tar.gz
After decompression, you can delete the WordPress installation package:
Rm wordpress-3.9-zh_CN.tar.gz
3. Install WordPress on the Web interface
Next, configure the MySQL database and user name of WordPress. There are two solutions:
One is to manually edit the wp-config.php file and the wordpress web interface that others are using.
The second option is very easy. I will explain it.
Open the browser and enter the blog URL. It will open the WordPress installation wizard and ask you to create a configuration file. Just click the button and it will ask you to enter the MySQL database name and user name, password, database host and table prefix.
Enter the database name, user name, and password. For Database hosts and table prefixes, you can retain the default value (if you have multiple WordPress websites, we recommend that you change the database prefix ). If your database server is on a different host, you need to enter the database host details. Click submit next step. If you receive an error message, the wizard cannot write the wp-config.php file. The reason is that WordPress does not have the write permission. You can run the following command on the terminal to solve this error:
Added the data write permission for WWW.
Sudo chown-R www-data: www-data/var/www/domain.com/public_html
After the change, click the "re-run installation" button and "WordPress" button, and you will be asked to enter the website title, administrator username, password, and email id. After entering the information, you can continue the installation until the installation is complete.
Finally, you are prompted that the installation is successful, as shown in the figure above.
Now we have completed the installation of the Ubuntu VPS WordPress program. This is a simple tutorial. If you find it useful, share it.