Jul 19, 2019

9 min read

Install A LAMP Stack On Your VPS (Tutorial)

Written by

Vippy The VPS

LAMP is still the most popular software stack for setting up a web server. In this tutorial, we’ll show you how to install a LAMP stack on your VPS, so that you can start hosting your sites right away.

What is LAMP?

LAMP is a software stack designed to host web content, like websites and web apps. It’s called LAMP because it’s built on Linux (L), Apache web server (A), a MySQL database (M), and the PHP scripting language (P).

In some modern installations, another programming language can be plugged into that “P” position. And some developers substitute MariaDB for MySQL. But the MySQL/PHP version is the classic LAMP stack, so that’s what we’ll show you how to install here.

Why is it called the LAMP stack?

LAMP is referred to as a software stack, because each of the pieces builds on top of the other.

Linux is your operating system, which creates the base layer. Apache sits on top of Linux because it needs Linux to operate. MySQL sits alongside Apache to store all the information it needs.

And PHP sits atop the stack to drive the actual display of the website, pull info from the database and create your user experience.

How to install LAMP on your server


  • A VPS running any of our OS options— CentOS 6/7, Ubuntu 16.04/18.04.
  • A non-root, sudo-enabled user. If you only have a root user, see our SSH Tutorial for details on creating new users.


This tutorial requires the use of IP addresses. Whenever you see the IP_ADDRESS variable, replace it with your server’s IP address.

Ubuntu 16.04/Ubuntu 18.04

The easiest and fastest way to install LAMP stack in Ubuntu 16.04 is to use tasksel, a tool that installs each element of LAMP stack with a single command.

Tasksel is installed by default in Ubuntu 16.04, If tasksel is missing in your system, then install it by issuing following command from the terminal:

$ sudo apt-get install tasksel

To run tasksel from the command line, type:

$ sudo tasksel 

Now tick LAMP Server and press the Tab key once, followed by the Enter key. You will be prompted to provide a root

Continue reading this article
by subscribing to our newsletter.
Subscribe now

A note about tutorials: We encourage our users to try out tutorials, but they aren't fully supported by our team—we can't always provide support when things go wrong. Be sure to check which OS and version it was tested with before you proceed.

If you want a fully managed experience, with dedicated support for any application you might want to run, contact us for more information.

Leave a Reply