Many people want to focus on building their Drupal sites and prefer to host their sites with companies that manage the servers and software environments for them. However, sometimes people might need or be interesting in setting up their own server. Recently on LinkedIn there was a discussion of what a 'home brew' Drupalist needs to know to move from shared hosting to a do-it-yourself virtual private server (VPS).

With a VPS you have administrative control over your server (software, not the hardware). This gives you a lot of flexibility and freedom that you might not have with some shared hosting plans, but it also involves more work. If you want to administer your own VPS you should be committed to keeping your site up to date and current with patches, upgrades and security releases, things that a shared hosting service might take care of for you.

This discussion is an attempt to list the typical components and approaches to setting up a VPS for hosting Drupal sites. It does not attempt to provide a step-by-step recipe, but rather a high-level overview of what is involved and some common choices. Mentions of specific programs or companies are given as examples of common choices, but are not endorsements. Also, it should be noted that there are installation scripts such as Aegir, Barracuda/Octopus, and LAMP packages which will automate some or all of the process. Think about and research the options before getting started with your install.

To setup and administer your own virtual server you should already be familiar with Linux or have a strong desire to learn it. The Linux learning curve is at least as steep as Drupal’s.

  • Domain Name: You will need a domain name for your website and you will need access to the domain name server so that you can make entries and changes. There are many domain registration sites that provide these services.
  • Email Server: You will want an email server so that you can send out emails from your Drupal site and so that your server can send you emails regarding updates. You can do this from your own VPS, but a popular approach is to use Google Apps for your email. You can have email handled by Google while your website is on your VPS.
  • Hosting Company: You will need a hosting company that provides virtual private servers. There is VPS hosting for Windows servers and for Linux servers. Linux servers are usually less expensive. A Linux server is what is assumed below.
  • Linux Distribution: You will need to select a Linux distribution. Some hosting companies only have a few options while others offer a lot of choices. Debian, Ubuntu Server, or Cent OS are popular choices. There are a lot of tutorials and blog posts providing how-to instructions for these platforms.
  • SSH Server: When you install your server you will typically install an SSH server that gives you command line access.
  • Web-based interface for common admin tasks (optional): A program like Webmin or Virtualmin will give you a web-based GUI. Webmin and Virtualmin can be configured to email you when there are updates for your server. Aegir and Barracuda/Octopus provide a web-based control panel type of interface for your Drupal site administration.
  • Firewall : You will need to install a firewall. Also, a program like Fail2Ban will monitor your logs and ban IP addresses that attempt repeated scanning of your server. A good practice is to configure your SSH server to use non-standard ports as this cuts down on malicious scanners.
  • Web Server: You will need to install a web server. Apache and Nginx are the most common. Both are supported by Drupal. There may be more documentation and examples for Apache, but Nginx may be faster and use less memory.
  • Database Server: You will need a database server. This is usually MySQL, but Postgres or MariaDB are also typical options.
  • Local Mail Server: Even though you may be using Google Apps for email, you will still need a mail server to forward mail from your server to your Google mailbox. This server need only accept internal connections from programs running on your server. Postfix or EXIM are two options.
  • Virtual Hosts: You will need to know how to create, delete, and modify Apache or Nginx virtual hosts for each website on your server.
  • Drush: Installing Drush will help with common Drupal-related tasks, such as updating modules and core.
  • Caching: If you expect a lot of traffic to your site you may also want to install Varnish, Memcache, or other caching programs to optimize performance.
  • Backups: Some hosting companies provide a backup service that will make a backup of your entire VPS. You can use the Backup and Migrate module to backup your Drupal database. The type of backup plan you go with should take into account the level of service that you have to provide.

Your hosting provider may provide tutorials, documentation and even scripts to help you get started. If you select popular choices for your Linux distribution and the various programs then you can search the Internet to find tutorials and blog posts. Drupal.org is also a good place to look for help and advice. Be prepared for some frustration as tutorial and blogs may not be referring to the exact same versions of the various components that you are using.

Do you have experience setting up a virtual private server for use with Drupal? If so, please fill in the gaps of things that were missed!

Comments

John Bert’s picture

Hello Everyone,

Today I have order a vps from Phi 9 web host. Also I have read all the points.

BTW, Thank you for your great article. I really appreciate that.

michilin’s picture

Even though it might have gotten a bit dated, I appreciate this article. To me at least, the question has been often whether or not I could use drush, which is a huge time saver. It's a bit of a tradeoff, the extra administration effort that a VPS requires, versus the time saved by drush. It seems that drush may be used with some hostings but I don't know much about these.