BLOG

A Complete Guide for WordPress Installation on a VPS

Having a website can certainly boost the visibility of your business on the internet. However, there’s a huge difference between setting up a WordPress website and managing one. Choosing the hosting plan can be quite confusing when you are starting out. However, it’s never too late to shift to the right hosting plan that suits your needs.

Virtual Private Server (VPS) allows you to share a single physical server, but you get a virtual instance to host the website. On the other hand, you need to share the server and its resources with others in a shared hosting plan, which often affects the performance of the website.

When Should You Consider Upgrading to VPS Hosting?

Even though a majority of the websites begins their journey with a shared hosting plan, they need to upgrade to VPS or other hosting plans at some point. Shared hosting is good for websites with low traffic. However, if your website experiences growth and starts to generate more traffic, it will face certain performance issues unless you upgrade your hosting plan.

Why VPS, you ask? Well, there are a number of reasons to upgrade to Virtual Private Server hosting plan, including the following:

Offers full control over the server:

It is a virtual server; there’s no denying in that. But you do get full control over it.

Comes with a particular amount of resources:

With a VPS hosting plan, you get a certain amount of storage and bandwidth, which you don’t have to share with anyone.

Easily upgradable:

With VPS, you can ask the hosting provider to add more resources to the server whenever you want.

Reasonably priced:

It is easier to find VPS hosting plans at a reasonable price. The starter plans are available at below $10 per month.

While there are several ways to handle the growing traffic of a WordPress website, moving to a VPS hosting plan is easier.

How to Install WordPress on a VPS?

If you are willing to upgrade your hosting plan to VPS, you will find a number of WordPress-friendly VPS options. The pricing and the resources may vary from one provider to the other. Whatever you choose, there are two different ways to install WordPress on the VPS. In this blog, I’ll discuss both the methods.

Installing WordPress on a VPS using the hosting control panel:

This method may not work for a few VPS hosting options. So, before you try this method, check whether your host lets you set up a VPS through the account dashboard. If not, you have the option to set it up manually (which I’ll discuss later in this blog). If the host lets you set up VPS through the account dashboard, follow these steps mentioned below to proceed with the setup:

  • Login to the VPS account and go to the “Servers” tab on the dashboard. Once you get there, click on the blue plus sign on the right side of the screen.
  • As you get redirected to the next page, you will be prompted to choose the location for the VPS. The server you select will depend on where you expect most of your visitors to come from. In case you are targeting the UK audiences, you should choose a UK-based server.
  • In the next step, scroll down to the “Server Type” section and go to the “Application” tab under it. Find the WordPress option at the bottom and click on it. This will initiate the installation of WordPress on your VPS.
  • If you scroll down further, you can find the VPS plan that you want to use. Depending on the size of the website and the traffic, make the right choice. You can also enable some additional features on the VPS option.
  • Once you are done with enabling the features, scroll down and find the field where you need to set a name for the VPS. The name will be used for internal identification only. So, pick any. When you are done naming the VPS, click on the “Deploy Now” button to complete the installation.
  • In the VPN’s main setting screen, you will find the instructions for the rest of the setup process.

When you are done with the installation process, you can do what you intended to with the website in the first place. However, you must point your domain towards the VPS’s IP address for seamless functioning.

Installing WordPress on a VPS manually:

If your VPS does not include one-click setup options for WordPress or other apps, you need to use the manual installation. Here is how you can set up WordPress on a VPS manually, in just 4 steps:

Connect to the VPS via SSH:

  • Before you start installing WordPress on a VPS, you’ll need to gain access to the VPS through Secure Shell (SSH). Choose an SSH client such as PuTTY and install it to proceed.
  • Once you open the SSH client, type in your server’s IP address, set the port option to 22 and select SSH as the connection type. Click on “Open” once you are finish typing.
  • A command window will pop up and ask what user you want to login as. Type root and then enter the password when prompted. If you enter correct details, you will see your VPS name on the display screen.

Install a LAMP stack:

  • In order to run WordPress on VPS, you need an HTTP server, a database, and PHP. You can choose Apache for the HTTP server, MariaDB for the database, and the latest version of PHP. You can install all these elements with the following command line:

sudo yum install httpd mariadb mariadb-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt php-xmlrpc unzip wget –y

  • This command will download the necessary files. This software bundle is called LAMP stack, which is used for site and application management. The acronym LAMP has come from:
  • Linux: the operating system of the server
  • Apache: the preferred webserver
  • MariaDB: a database system
  • PHP: the preferred programming language
  • Input the following commands to initialize the server, boot up the applications, and keep them running continuously.

sudo systemctl start httpd

sudo systemctl start mariadb

sudo systemctl enable httpd

sudo systemctl enable mariadb

Configure the database:

Before creating a database for the website, you need to secure the MariaDB installation. It will keep people from accessing it remotely.

  • Enter the following command to get started:

sudo mysql_secure_installation

  • After this, MariaDB will prompt you for its root user password. Leave it blank and press enter key so that you can set a new root password. Tap “Y” key for all other options, particularly the number three, which bars remote logins.
  • In the next step, log into your MariaDB account using the following command. You will have to enter the password you have set just recently.

mysql -u root –p

  • Once you get in, you need to use four commands to run in sequence. Remember to place the default username and password mention the following command:

CREATE DATABASE wordpress;

GRANT ALL PRIVILEGES on wordpress.* to ‘user’@’localhost’ identified by ‘password’;

FLUSH PRIVILEGES;

exit

Now that your new database is ready to get to the final step and run WordPress.

Install and run WordPress:

  • To deploy WordPress, enter and run the following commands in the given sequence. In order to download the latest version of WordPress, and extract it to the root directory, use these commands:

wget http://wordpress.org/latest.tar.gz

tar -xzvf latest.tar.gz

sudo cp -avr wordpress/* /var/www/html/

  • In the next step, create an “Uploads” folder for your installation and assign the right permissions to it. This will ensure that WordPress doesn’t run into privilege issues. Use the following command lines:

sudo mkdir /var/www/html/wp-content/uploads

sudo chown -R apache:apache /var/www/html/

sudo chmod -R 755 /var/www/html/

  • In the next step, rename the WordPress wp-config-sample.php file with these following commands:

cd /var/www/html/

sudo mv wp-config-sample.php wp-config.php

sudo nano wp-config.php

  • The final command will open the wp-config.php file using the nano editor within the command line. It can be a bit confusing, but you only need to navigate the file using your keyboard arrows and replace the following fields with the same information you entered in step #3.

define(‘DB_NAME’, ‘wordpress’);

define(‘DB_USER’, ‘user’);

define(‘DB_PASSWORD’, ‘password’);

  • After updating the fields, type Ctrl+O and Ctrl+X to save the changes and exit the editor, respectively.
  • With this final set of commands, configure the VPS to allow both HTTP and HTTPs connections using the commands:

sudo firewall-cmd –permanent –zone=public –add-service=http

sudo firewall-cmd –permanent –zone=public –add-service=https

sudo firewall-cmd –reload

  • Once you run these commands, you will be able to access the WordPress installer by using your preferred browser and entering your VPS’ IP address, like http://yourVPSIP.

That’s all you need to do to complete the WordPress setup on VPS. It is recommended to complete the setup as early as possible, as anyone with your VPS IP can use the installer before you. The possibility of this kind of incident is very slim, but it is always better to take precautions.

Author bio: Nionica Starc is a web designer who is currently employed at a reputed MNC in Australia. He also serves as an expert at MyAssignmenthelp.com, where he serves assignment help to students on their requirements.

Comments

  1. Nice post, Very useful. Thanks for sharing such an informative blog post.
    https://bestassignmentexpert.co.uk

Leave a Reply

Comment policy: We value comments and the time that visitors to our blog spend to give feedback. Please note that all comments are manually moderated and any deemed to be spam or promotional will be deleted.