Sélectionner une page

How to Install WordPress on a Virtual Private Server (VPS)

How to Install WordPress on a Virtual Private Server (VPS)

The first time you sign up for a hosting plan can be very confusing. There’s shared hosting, a dedicated server, managed services, and even a Virtual Private Server (VPS) to choose from. There are a lot of options to take in, and the problem lies in knowing which type of plan you really need.

VPSs are a natural progression from shared hosting, but the name makes them sound overly complicated. In this article, we’re going to give you a full breakdown of what a VPS is and when you should consider using one. Then, we’ll teach you how to install WordPress a VPS in four simple steps. Let’s get to it!

What a VPS Is (And When You Should Consider Upgrading to One)

With shared hosting, you occupy the same server as other users do. This means you share resources with everyone else, which often leads to performance issues if your website requires a bit more juice. In contrast, a VPS enables you to still share a single physical server, but you get a virtual instance to host your website. Let’s break down why this is good news for you:

  • You get a set amount of resources. When you sign up for a VPS, you get a set amount of memory, storage, and bandwidth, and you don’t need to share those resources with anyone else.
  • They are easy to upgrade. In most cases, you can ask your hosting provider to add more resources to your VPS at a moment’s notice.
  • You get full control over your server. Even though you’re dealing with a virtual server, you still get full control over it.
  • They’re often reasonably priced. To be more specific, you can easily find powerful starter VPS plans at below $10 per month.

In our opinion, once your WordPress website outgrows shared hosting, you have two options when it comes to upgrading. You can either sign up for a VPS plan, or alternatively try managed WordPress hosting.

As you may know, managed WordPress hosting plans are all about convenience. However, when it comes to performance, you can probably do just as well if not better with a VPS. The only difference is, a VPS has a longer learning curve if you decide to set it up manually. This means configuring your server, tweaking it to run WordPress, and installing the platform itself. We’ll cover how to do this later.

How to Install WordPress on a VPS Using Your Hosting Control Panel

There are a lot of great options when it comes to WordPress-friendly VPS services. However, we’re partial to Vultr thanks to its accessible prices and excellent performance. You’re free to choose any provider you want to host your website, but for this tutorial, we’re going to use Vultr as an example. You may need to check whether your host will let you set up a VPS through your account dashboard. If not, you’ll want to skip to the next section, where we talk about how to install WordPress manually via the command line.

Assuming you’ve already signed up for a Vultr account, your next step will be to log into it and go to the Servers tab on your dashboard:

The Vultr Servers tab.

Once you’re there, click on the blue Plus icon at the right of your screen. On the next page, choose your VPSs location:

Choosing a location for your VPS.

The server you choose will depend on where you expect most of your traffic to come from. If your website mainly targets American users, for example, you’ll want to go with a US-based server. Next, scroll down to the Server Type section and jump to the Application tab. Now look for the WordPress option at the bottom and click on it:

Install WordPress on a VPS.

This will automatically install WordPress on your VPS using the latest 64-bit CentOS release as its Operating System (OS). There are other ‘distros’ available for use, but CentOS is the default choice for new Vultr VPSs due mainly to its stability.

If you scroll further down, you can choose which plan you want to use for your VPS. Initially, we recommend choosing the $5 per month plan:

Choosing a plan for your VPS.

This should be enough for a single medium-sized WordPress website. More importantly, you can always scale your VPS with a few clicks, but downgrading your plan is a lot more complicated. Doing things this way gives you a lot more maneuverability.

Moving on, there are a couple of interesting options under the Additional Features section. For example, you can enable automated backups for an extra 20% of your base plan’s cost, which works out to $1 for this example. Denial of Service (DDoS) protection, on the other hand, will run you an extra $10 per month:

Configuring additional features for your VPS.

It’s up to you which features you want to enable, but keep in mind you can always take care of backups using plugins at no extra cost. Finally, go to the bottom of the screen and set a name for your VPS:

Setting a name for your VPS.

Whatever name you choose is for internal identification only, so pick anything you want. When you’re ready, click on the Deploy Now button below. Once Vultr completes the installation, your new VPS is ready to go! You can access its settings from the Servers tab:

Your Servers tab.

Within your VPS’s main settings screen, you’ll find instructions for the rest of the setup process:

Setup instructions for WordPress.

By accessing the URL using the login details provided by Vultr, you’ll be able to finish installing WordPress (which is similar to the usual method):

The WordPress installer.

When that’s done, you can use your new website for anything you want. Just remember to point your domain towards your VPSs IP address and you’ll be all set!

How to Install WordPress on a VPS Manually (In 4 Steps)

In case you’re using a VPS that doesn’t include one-click setup options for apps such as WordPress, you can always opt for a manual install. For this example, we’re going to do the entire setup on a brand new VPS running CentOS 7.

Step #1: Connect to Your VPS Via SSH

Once you have a VPS up and running, you’ll need two things to follow these instructions:

  1. Your server’s root password so you can run the necessary commands.
  2. A Secure Shell (SSH) client such as Putty.

To access your VPS, you’ll need to install Putty and open the application. Once you do that, you’ll see a section where you can specify the destination you want to connect to:

Configuring Putty to connect to your VPS.

Now type your VPSs IP address within the Host Name (or IP Address) field, set the Port option to 22, choose SSH under Connection type, then click Open. A command window will pop up, asking what user you want to login as. Type root, then enter your password when prompted:

Accessing your VPS via SSH.

If you typed your password correctly, your VPSs name should display, and we can get down to business!

Step #2: Install the Software You Need to Run WordPress

To run WordPress, you need an HTTP server, a database, and PHP. For this tutorial, we’re going to install Apache, MariaDB, and the latest version of PHP. Fortunately, you can do so in one fell swoop 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 tells your server to download all of the necessary files and set them up. The process might take a few minutes depending on how fast your server is, and when everything’s ready, you’ll be able to type in more commands.

Once the underlying software is ready, you need to initialize it and tell your server to boot it up every time. Here are the commands you’ll need to use:

sudo systemctl start httpd

sudo systemctl start mariadb

sudo systemctl enable httpd

sudo systemctl enable mariadb

At this stage, there’s only one step left to go before you can install WordPress and start using it, and that’s to configure your database.

Step #3: Configure MariaDB and Create a WordPress Database

Before you can create a database for your website, you need to ‘secure’ your MariaDB installation so people can’t access it remotely. To get started, enter the following command:

sudo mysql_secure_installation

Afterward, MariaDB will ask you for its root user password, which should be blank, so just hit the enter key. Then, you’ll be able to set a new root password. For the rest of the settings, hit for all of the remaining four options, particularly number three, which disallows remote logins.

Now, login into your MariaDB account using the following command, and keep in mind you’ll need to enter the password you set a moment ago:

mysql -u root -p

Once you’re in, there are four commands you need to run in turn. Each line below is an individual command, so keep that in mind. Also, remember to replace the user and password placeholders with a more secure pair for use with your database:


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



There you go! Your new database is ready for use, so let’s not keep it waiting.

Step #4: Install and Run WordPress

Now we have setup our infrastructure, the final step is to download the software, and install and configure it. Let’s kick things off with a quick series of commands to download the latest version of the platform, extract its files, and move them to your root directory. Keep in mind each of the lines below is an individual command you need to run separately:

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

tar -xzvf latest.tar.gz

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

So far so good. Now let’s create an Uploads folder for your installation and assign the correct permissions to 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, let’s 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 so it can connect to your database. The last command you ran will open the file using the nano editor within the command line. It’s a bit tricky to use, but just navigate the file using your keyboard arrows and replace the following fields with the same data you entered during step number three:

define('DB_NAME', 'wordpress');

define('DB_USER', 'user');

define('DB_PASSWORD', 'password');

After updating those fields, type CTRL+O and CTRL+X on your keyboard. The former will save the changes you made to the file while the latter will close the nano editor. All that’s left to do now is to configure your VPS to allow HTTP and HTTPS connections, with 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 you run them, you’ll be able to access the WordPress installer by visiting your VPSs at http://yourvpsipgoeshere, replacing the placeholder accordingly.

That’s it! We went through a lot of commands, but the process itself is quite simple when you realize it’s mostly copying, pasting, and following instructions. With this guide, you’ll be able to install WordPress on any VPS you want.


Using a VPS is a big jump if you’ve only experienced shared hosting before. Fortunately, most reputable web hosts keep the experience simple. If you don’t want to deal with using the command line to customize your VPS, chances are your provider will have the tools to help you.

With that in mind, there are two ways to go about setting up WordPress on a VPS. Most VPS services provide you with one-click setup options for popular platforms such as WordPress or you can do so manually. The latter method requires you to be comfortable using the command line, but it’s not difficult if you know what steps to follow.

Do you have any questions about install WordPress on a VPS? Ask away in the comments section below!

Article thumbnail image by Aa Amie / shutterstock.com.

Source link

Poster le commentaire

Votre adresse e-mail ne sera pas publiée.