Featured image of post WordPress Setup on a VPS Server

WordPress Setup on a VPS Server

Ready to take your WordPress hosting to the next level? Discover what VPS hosting really is and find the ultimate guide to installing WordPress on a Virtual Private Server.

Choosing a hosting plan for the first time can feel overwhelming. Shared hosting, dedicated servers, managed services, and even Virtual Private Servers—the options seem endless. The real challenge is figuring out which type of plan suits your needs best.

VPSs offer a logical step up from shared hosting, but their name might make them sound intimidatingly complex. In this article, we’ll break down VPSs in simple terms and explain when you should think about switching to one. We’ll then guide you through installing WordPress on a VPS in four straightforward steps. Let’s dive in!

Understanding VPS and When to Upgrade

With shared hosting, your website shares a server with other users. This means sharing resources, which can lead to performance problems if your site needs more power. While a VPS still involves sharing a physical server, you get your own dedicated virtual instance for your website. Let’s see why this is advantageous and explore WordPress installation on a VPS.

  • Dedicated Resources: When you subscribe to a VPS, you receive a set allocation of memory, storage, and bandwidth that you don’t have to share.
  • Effortless Upgrades: In most cases, you can easily request your hosting provider to increase your VPS resources whenever needed.
  • Complete Server Control: Although you’re working with a virtual server, you still have full control over it.
  • Affordability: You can easily find powerful starter VPS plans for under $10 per month.

In our view, when your WordPress website outgrows shared hosting, you have two main upgrade options: switching to a VPS plan or exploring managed WordPress hosting.

Managed WordPress hosting prioritizes convenience. However, when it comes to performance, a VPS can potentially match or even surpass it. The main difference is the steeper learning curve of manually setting up a VPS. This involves configuring the server, optimizing it for WordPress, and installing the platform—all of which we’ll cover later in the WordPress VPS host installation section.

WordPress Installation on a VPS: Using Your Hosting Control Panel

Numerous excellent VPS services cater specifically to WordPress. We have a soft spot for Vultr due to its affordable pricing and impressive performance. While you’re free to choose any provider for your website, we’ll use Vultr as an example in this tutorial. Before we start, make sure your host allows VPS setup through your account dashboard. If not, skip ahead to the next section where we discuss manual WordPress installation via the command line.

Assuming you’ve signed up for a Vultr account, log in and navigate to the Servers tab on your dashboard.

Click the blue Plus icon on the right side of the screen. On the following page, select the location for your VPS.

The ideal server location depends on the primary source of your your traffic. For instance, a US-based server makes sense if your website primarily targets American users. Next, scroll down to the Server Type section and switch to the Application tab. Locate the WordPress option at the bottom and click on it.

This will automatically install WordPress on your VPS using the latest 64-bit CentOS release as the Operating System (OS). While other distributions are available, CentOS is the default for new Vultr VPSs due to its stability.

Scrolling down further reveals the available VPS plans

We suggest starting with the $5 per month plan.

This should suffice for a single medium-sized WordPress website. Remember, you can easily scale up your VPS with a few clicks if needed. Downgrading is more complicated, so starting with a plan that provides room to grow offers more flexibility.

The Additional Features section presents some compelling options. For an additional 20% of your base plan’s cost (which translates to $1 in this case), you can enable automated backups. Denial of Service (DDoS) protection, on the other hand, will cost an extra $10 per month.

While the choice of features depends on your needs, remember that you can manage backups using plugins without any extra cost. Finally, scroll to the bottom of the screen and give your VPS a name.

This name is only for internal identification, so choose whatever you prefer. When you’re ready, click the Deploy Now button. Once Vultr finishes the installation, your new VPS is ready! Access its settings from the Servers tab.

Within your VPS’s main settings, you’ll find instructions for completing the setup process.

By accessing the provided URL and using the login credentials from Vultr, you can finalize your WordPress installation (which is similar to the standard method).

Once done, your new website is ready for anything! Simply point your domain to your VPS’s IP address, and you’re all set!

Manually Installing WordPress on a VPS Using the Command Line (4 Steps)

Virtual Private Server - WordPress Installation Guide
Virtual Private Server – WordPress Installation Guide

If your VPS doesn’t offer one-click setup options for apps like WordPress, you can always opt for a manual installation. In this example, we’ll demonstrate the entire setup process on a fresh VPS running CentOS 7.

Step 1 – Connecting to Your VPS via SSH

Once your VPS is up and running, you’ll need two things to proceed with the WordPress VPS installation:

  1. Your server’s root password to execute the required commands.
  2. An Secure Shell (SSH) client such as Putty.

Install Putty and open the application to access your VPS. In Putty, you’ll find a section for specifying the connection destination:

Enter your VPS’s IP address in the Host Name (or IP Address) field, set the Port option to 22, choose SSH under Connection type, and click Open. A command window will appear, prompting you for the username. Type root and enter your password when requested:

If you entered the correct password, your VPS’s name should appear, and you’re ready to go!

Step 2 – Installing the Necessary Software for WordPress

Running WordPress requires an HTTP server, a database, and PHP. For this tutorial, we’ll install Apache, MariaDB, and the latest PHP version. Thankfully, you can do this all at once with a single command:

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 instructs your server to download and set up all the necessary files. The process might take a few minutes based on your server’s speed. Once completed, you can enter more commands.

After installing the software, you need to initialize it and configure your server to start it on every boot. Use the following commands to install WordPress VPS:

sudo systemctl start httpd
sudo systemctl start mariadb
sudo systemctl enable httpd
sudo systemctl enable mariadb

Now, there’s just one more step before you can install and use WordPress: configuring your database.

Step 3 – Configuring MariaDB and Creating a WordPress Database

Before creating a database, you need to secure your MariaDB installation to prevent unauthorized remote access. Start by entering the following command:

sudo mysql_secure_installation

MariaDB will prompt you for the root user password, which should be blank. Press Enter. You can then set a new root password. For all other settings, press Y for each of the remaining four options, particularly option three, which disallows remote logins.

To further secure your MariaDB installation on your VPS host and restrict remote access, begin by entering:

mysql -u root -p

Once in, execute the following four commands one by one. Each line below represents a separate command. Remember to replace the user and password placeholders with a more secure combination for your database:

CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES on wordpress.* to 'user'@'localhost' identified by 'password';
FLUSH PRIVILEGES;
exit

Your new database is ready! Let’s move on to using it.

Step 4 – Installing and Running WordPress on Your VPS Server

With the infrastructure in place, the final step is downloading, installing, and configuring the WordPress software. Let’s begin by running a series of commands to download the latest platform version, extract its files, and move them to your root directory. Each line below represents a separate command:

wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
sudo cp -avr wordpress/* /var/www/html/

Now, create an Uploads folder for your WordPress VPS host installation and set the correct permissions for your files and folders using the following two commands:

sudo mkdir /var/www/html/wp-content/uploads
sudo chown -R apache:apache /var/www/html/
sudo chmod -R 755 /var/www/html/

Finally, rename your WordPress wp-config-sample.php file…

cd /var/www/html/
sudo mv wp-config-sample.php wp-config.php
sudo nano wp-config.php

…and configure it to connect to your database. The last command will open the file using the nano editor within the command line. While it might seem tricky at first, navigate the file using your keyboard arrows and replace the following fields with the same information you entered during step three of installing WordPress on your VPS host.

define('DB_NAME', 'wordpress');
define('DB_USER', 'user');
define('DB_PASSWORD', 'password');

After updating these fields, press CTRL+O and CTRL+X on your keyboard. This will save your changes to the file and close the nano editor. All that’s left is to configure your VPS to allow HTTP and HTTPS connections using these commands:

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

Once executed, you can access the WordPress installer by visiting your VPS at http://yourvpsipgoeshere, replacing the placeholder accordingly.

That’s it! We’ve covered numerous commands, but the process is relatively simple. It mainly involves copying, pasting, and following instructions. With this guide, you can confidently install WordPress on any VPS.

Conclusion

Transitioning to a VPS from shared hosting is a significant step. Fortunately, most reputable web hosts streamline the experience. If you prefer not to use the command line for customizing your VPS, your provider likely offers tools to simplify the process.

Ultimately, there are two approaches to setting up WordPress on a VPS: using the one-click setup options provided by most VPS services or opting for a manual installation. While the latter requires familiarity with the command line, it’s not complicated if you follow the steps outlined in this WordPress VPS host installation guide.

Have questions about installing WordPress on a VPS? Feel free to ask in the comments section below!

Licensed under CC BY-NC-SA 4.0