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

Last Updated on April 25, 2023 by 24 Comments

Editorial Note: We may earn a commission when you visit links on our website.
How to Install WordPress on a Virtual Private Server (VPS)
Blog / Tips & Tricks / 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 Virtual Private Server (VPS) hosting 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:

CREATE DATABASE wordpress;

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

FLUSH PRIVILEGES;

exit

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 <a class="wpil_keyword_link" href="https://www.elegantthemes.com/blog/tips-tricks/wordpress-wp-config-php"   title="wp-config.php" data-wpil-keyword-link="linked">wp-config.php</a>

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.

Conclusion

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.

Divi Cyber-monday Sale

It's The Divi Cyber Monday Sale! Save Big For A Limited Time 👇

Save big on Divi and Divi products for a limited time.

Access The Sale
Divi Cyber-monday
Premade Layouts

Check Out These Related Posts

Splice Video Editor: An Overview and Review

Splice Video Editor: An Overview and Review

Updated on March 10, 2023 in Tips & Tricks

Video is a valuable form of content for social media. Unfortunately, creating quality videos is usually a long process that involves moving mobile footage to a desktop app for editing. However, mobile editing is on the rise. Apps such as Splice Video Editor make it possible to efficiently create...

View Full Post
How to Use Font Awesome On Your WordPress Website

How to Use Font Awesome On Your WordPress Website

Updated on September 16, 2022 in Tips & Tricks

When given the choice between using a vector icon or a static image, it’s a good idea to go with the vector. They’re small and fast to load, and they can scale to any size without a loss of resolution. Font Awesome is a superb library of vector icons that you can use on your websites,...

View Full Post

24 Comments

  1. Cloud services were initially designed for use by developers where they could build and destroy instances of their apps as needed. That’s why you see these providers having an hourly price. The reason they are fast is because they don’t have the overhead of a resource heavy control panels like cPanel or Plesk. Any of these services such as Vultr, Digital Ocean or Linode require some technical expertise as you’re limited to SFTP or SSH access. Cost and performance wise, if you add a control panel you may be just as well off to stick with a traditional VPS solution. Specially if you’re not too inclined to dig down into your server. I agree that for the vast majority of users they should stick to a managed provider like SiteGround.

  2. VPS is better but those who have no technical knowledge, shouldn’t go for a VPS. For a small blog, shared hosting is enough.

  3. Just use Siteground and don’t bother with some of these other hosts. Their support is amongst the best I’ve ever encountered.

  4. I use ServerPilot. They are awesome!

  5. I think that for small to medium WordPress sites good shared hosting (php 7+) is more than enough. Here in Slovenia, we have a shared hosting that for 20€ first year and later 40€ per year you get 1CPU, 1GB RAM, and 3GB SSD storage. If you have large websites or multiple sites then VPS is a good choice, but there is no way that I will ever have VPS without CPANEL. Those 14$ per month for VPS Cpanel license makes your life a LOT easier if you are managing multiple sites.

    • Digging deeper I would also vote for cPanel functionality with VPS. Just seems so much easier to manage content and advanced features.

  6. Hello,

    Could you illustrate the same process as in Putty but in Windows 10? 🙂

    Win 10 has a SSH client built-in.

    Thanks

  7. Serverpilot is a great option for installing and managing also. Although in theory you can set up a mail server also, much better off to use Zoho, Microsoft, Google or other providers, always less email issues then as well.

    • I recommend serverpilot as well and webmail should be hosted on other platforms like Ian suggested.

  8. There is no mention of Java installation, which is required for some plugins.

    Is this separate installation, or does it install with apache or wordpress

    • Hello Marc. Thanks for your enquiry. You will not be required to install Java prior to installing WordPress.

  9. With so many affordable options, moving to VPS is a no brainer. Less headaches compared to shared hosting.

  10. Curious – do you have any website examples using Vultr and can note which plan it is using so I can compare Page Speeds?

    I’m looking to get away from Shared Hosting finally from InMotion Hosting. Lately it just seems so damn slow.

    • InMotion sucks. Moved from them awhile back. Servers constantly going down.

    • We were having hosting speed issues a few months back. After checking into a number of hosting options we decided to try Flywheel. To be honest I really did not understand VPS at the time. The folks at Flywheel assured me VPS would have all of the advantages described in this article! Page load times improved by a factor of 5X. Thank you John for this really well done explanation!

      • Hello Dave. You’re very welcome.

    • Also – with Vultr – as you noted it does not look like there is a cPanel option, so how would one host email accounts through them as well? It looks like they’re a good option if you just want a site to function but with no options beyond that, it’s a tough sell. Unless I’m missing something?

      • Inside my US$5/mo DigitalOcean VPS, next to the Nginx web server, I installed the Dovecot / Postfix / Spamassasin mail server software bundle. It works fine although is complex to configure (it’s Linux command line).

        In my opinion the VPS is a big step forward in terms of benefits, but as a counterpart it requires you to become a Linux Systems Administrator (VPrivate Server), to work on a diary basis, in addition to manage the blog and WordPress obviously (shared hosting).

      • You can have cPanel on Vultr for an extra $15. I think most people would use a 3rd party email service like sendgrid or even zoho.

        • Appreciate the response! I have only always used the email service provided by the hosting solution simply for the @yourdomain.com email service, and option for unlimited accounts.

          It looks like those other services are a “per user” service and there’s a fee per account. Makes sense though…

  11. After configuring WordPress from installation , i recommend everyone to add following command in .htaccess file for blocking people accessing your wp-uploads and other folders directly with link

    Before #END WordPress add the following Line

    Options -Indexes

    • Hello Krishna. Thanks for the comment. However, Option -Indexes can go after #END WordPress.

  12. Interesting article, I have dabbled with a Cloudways Vultr instal in the past and the speed was a real step up from shared hosting for the WooCommerce store I tested with.

    Being a bit of a novice I was unclear on how security on the server would compare to my current hosting.

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

👋 It's The Divi
Cyber Monday Sale!
Get The Deal
Before It's Gone!
Get Started With Divi