WordPress is a free open source blogging software and CMS( Content Management System). It is one of the most popular blogging platform which is used by more than 22.0% of the top 10 million websites. The best thing about wordpress is that anyone with basic knowledge of web hosting can create a very good website with tons of feature. WordPress has a very big community of developers who regularly release new plugin and themes.
In this post i am going to explain How to setup wordpress on Ubutu VPS with step by step instruction.
Before i start i am assuming you have done all the necessary setup for hosting any dynamic website. First thing you need is a VPS server, there are lot of hosting company which provide you VPS service but very few of them provide reliable service and guaranteed uptime. My personal favourite VPS hosting company is DigitalOcean . They provide monthly basis and hourly basic package and all plans are having SSD( Solid State Drive), which is a added benefit for faster server response. If you are thinking of setting up your server i will recommend DigitalOcean $5 Monthly plan which is more than enough for setting up a basic wordpress blog.
WordPress is based on PHP and it requires database to store all the information. So you need to have Apache, MySQL and PHP installed and configured on your VPS(Virtual Private Sever). If you have done these steps then lets start installing wordpress. Log in your VPS server using any SSH client, Putty recommended and follow these steps one by one.
1. Create a MySQL Database and User for WordPress
As i said wordpress requires database to store all the information and we have already setup MySQL for this task. Now lets create a Database and User to work with wordpress. To do that log into MySQL using root access by issuing below command
mysql -u root -p
After entering your root password you will be given MySQL prompt to run the commands. Now lets create a separate database for wordpress blog, i will give this database name wordpressdemo . You can give your database name whatever you want. Now enter this command
CREATE DATABASE wordpressdemo;
Now we are going to create a new user for wordpress, its a good practice to create separate user for each wordpress installation due to security reasons.
GRANT ALL ON wordpressdemo.* TO [email protected] IDENTIFIED BY 'qwerty';
Above command will create a new MySQL user
demouser which is having password
qwerty and has all the privilege on newly created database
wordpressdemo. After running above command flush the privilege so that current instance can know the recent changes in the user privilege and to do that enter
Now we have done setting MySQL Database and User for WordPress, you can close the MySQL command prompt by typing
2. Download WordPress Setup
In the next step we will download the latest version of WordPress CMS . First change the directory to where you will place all website’s files. In Apache generally it will be
public_html, in my case i have created public_html, so change directory to
After that we will download the latest version of WordPress cms by typing below command
Above command will download compressed file of wordpress cms, to uncompress it type
tar --strip-components=1 -xvf latest.tar.gz
Once you uncompressed the wordpress setup, remove the compressed file using below command
3. Install WordPress Using Web Interface
Next step will be configuring the wordpress with MySQl database and user name. It can be done in two ways, one is manually editing wp-config.php file and other one is using wordpress web interface. Second option is very easy and i am going to explain that one.
Open your browser and enter the blog url, it will open the wordpress installation wizard and ask you to create a configuring file, simply click on the button and then it will ask you MySQL Database Name, User Name, Password, Database Host and Table Prefixes.
Enter the Database name, User Name and Password which we have created in the first step. For Database Host and Table Prefixes you can keep the default value. If your Database server is on different host then you need to enter the Database Host Detail. Click on submit for the next step. If you got an error saying that the wizard can’t write the wp-config.php file. Its because wordpress does not have a write privilege, you can solve this error by entering below command in terminal
sudo chown -R www-data:www-data /var/www/domain.com/public_html
Above command will give www-data permission to wordpress and now wordpress will be able to write to files, install plugin, themes and update without any error.
After making above changes, click on run the install button again and after that wordpress will ask you to enter Website title,Admin User name, password and email id.
Enter all the detail and after that click on Install WordPress, you will be given the WordPress login screen.
Enter your Admin User Name and Password which you just created and after that you will get your wordpress blog dashboard. Now install themes and plugins to add more functionality.
So now we have completed the WordPress Installation on Ubuntu VPS. I hope you liked the tutorial, please like, share and give your opinion in the comment box.
- Password Less Login Using ssh-keygen and ssh-copy-id - March 21, 2020
- How To Use Rsync to Backup Local and Remote Directories on Linux - August 20, 2016
- Data Loading Using Teradata Fastload Utility and its Limitation - July 24, 2015