LAMP stack development image

One of the most popular uses for a VPS is to host websites. In order to begin doing this, a few things have to be installed and configured. This is where the LAMP stack can be useful.

The common development term LAMP stands for Linux (operating system), Apache (server), MySQL (database), and PHP (programming language). First, we should point out that not all websites require each of these components. Websites should be configured according to their functions and the correlating requirements. As a side note, if your site is running on a content management system, such as WordPress, it absolutely requires each of these components in a full LAMP stack.

Every component of the stack will be installed via command line. Linux can be installed automatically on most VPS, so this shouldn’t present any challenges.

Linux Operating System

We’ve decided to run you through this install on the Ubuntu operating system because of its popularity. This represents the Linux portion of our stack. The applications and software that will need to be installed are the same on whichever operating system you choose. Keep in mind, the commands will vary depending on which flavor of Linux you’re using.

To begin, you’ll need to be able to remote connect into your server by SSH. This information should be provided by your server provider. This can be accomplished with a terminal or command prompt.

Apache Server

To host a website, the first step is installing a web server. In this particular stack, Apache is the web server of choice. Apache is the world’s most popular web server.

To install Apache, type in the following command into the terminal or command prompt:

sudo apt-get install apache2

Hit enter and your VPS will begin to install the Apache web server. Upon completion, Apache will start automatically.

You may choose to edit the Apache configuration file to optimize it for your specific application. The standard configuration will work fine for most, but if changes are needed the configuration file can be accessed by entering the following command in the terminal or command prompt:

sudo nano /etc/apache2/apache2.conf

If changes are made to the configuration file, Apache will need to be restarted to . This can be accomplished by typing in the following command into the terminal or command prompt:

sudo service apache2 restart

MySQL Database

Databases store data in an organize structure that is quickly and easily accessed by different applications. There are many database platforms available, but most programmers prefer MySQL.

Install MySQL by entering the following command into the terminal or command prompt:

sudo apt-get install mysql-server

As the install begins you will be asked for a password for the MySQL root user. Be sure to choose something you can easily remember, but that will keep your data safe. After the installation is complete, MySQL will start running automatically.


PHP is a scripting language that facilitates dynamic production. There are many applications that are written in PHP, as well as most content management systems. In order to use PHP in your development, you must first install the PHP package and supporting modules.

The base PHP package must be installed first. This can be done by entering the following command in the terminal or command prompt:

sudo apt-get install php5 php-pear

In this case, the only supporting module that needs to be installed for now is for MySQL support. To do so, enter the following command in the terminal or command prompt:

sudo apt-get install php5-mysql

After this installs, you will be asked to restart Apache to load PHP.


Lamp Stack Complete

With Linux Ubuntu, Apache, MySQL, and PHP installed, the LAMP stack is ready to use! This is a great start to using a VPS to host a website.

Once your LAMP stack is installed, databases can be created or imported, DNS can be set up, and files can be uploaded! We will be creating guides for all of these in the future.

We’d love to hear about your project. Tell us about it in the comments below!



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>