A Complete Guide for WordPress Installation on a VPS
BLOG

A Complete Guide for WordPress Installation on a VPS

Table of Contents

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

A 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 website’s performance.

When Should You Consider Upgrading to VPS Hosting?

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

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

Offers complete control over the server:

It is a virtual server; there’s no denying that. But you do get complete 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 upgradeable:

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 a WordPress website’s growing traffic, moving to a VPS hosting plan is more accessible.

How to Install WordPress on a VPS?

If you are willing to upgrade your hosting plan to a VPS, you will find several WordPress-friendly VPS options. The pricing and resources may vary from one provider to the other. Whatever you choose, two different ways to install WordPress on the VPS exist. In this blog, I’ll discuss both 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 can 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 the 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 are 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 visitors to come from. If you are targeting 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 you want to use. Make the right choice depending on the website’s size and traffic. You can also enable some additional features on the VPS option.
  • Once you are done 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.
  • The instructions for the rest of the setup process are located in the VPN’s main settings screen.

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

Installing WordPress on a VPS manually:

You must install it manually if your VPS does not include one-click setup options for WordPress or other apps. Here is how you can set up WordPress on a VPS manually in just four steps:

Connect to the VPS via SSH:

  • Before 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 finished typing.
  • A command window will pop up and ask what user you want to log in as. Type root and then enter the password when prompted. You will see your VPS name on the display screen if you enter the correct details.

Install a LAMP stack:

  • 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, called LAMP stack, is used for site and application management. The acronym LAMP has come from:
  • Linux: the operating system of the server
  • Apache: the preferred web server
  • 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. Please leave it blank and press enter to set a new root password. Tap “Y” key for all other options, particularly the number three, which bars remote logins.
  • Log into your MariaDB account using the following command in the next step. You will have to enter the password you set recently.

mysql -u root –p

  • Once you get in, you must run in sequence with four commands. Remember to place the default username and password and 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, run WordPress to the final step.

Install and run WordPress:

  • To deploy WordPress, enter and run the following commands in the given sequence. 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 correct 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 the 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 unclear, but you must only 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.
  • 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 can access the WordPress installer using your preferred browser and enter your VPS IP address, like http://yourVPSIP.

That’s all you need to do to complete the WordPress setup on VPS. You should 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, providing 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.