How to install Linux, Apache, MySQL, PHP (LAMP) on Debian

How to install Linux, Apache, MySQL, PHP (LAMP) on Debian
In this tutorial we will show you how to install Linux, Apache, MySQL, PHP (LAMP) on Debian VPS.


The acronym LAMP refers to first letters of the four components of a solution stack, composed entirely of free and open-source software, suitable for building high-availability heavy-duty dynamic web sites, and capable of serving tens of thousands of requests simultaneously.

The meaning of the LAMP acronym depends on which specific components are used as part of the actual bundle:

  • Linux, the operating system (i.e. not just the Linux kernel, but also glibc and some other essential components of an operating system)Apache HTTP Server, the web server
  • MySQL or MariaDB, the database management system
  • PHP, Perl, or Python, the scripting languages (respectively programming languages) used for dynamic web pages and web development.


Apache is a free open source software which runs over 50% of the world’s web servers. To install Apache, you will need to log in to your VPS as ROOT via SSH. Once you are in the first thing you need to do is to downloads the package lists from the repositories and “update” them to get information on the newest versions of packages and their dependencies. It will do this for all repositories and PPAs. To do that just type:

apt-get update

The next step/command will actually update all the software on your VPS. It is not necessary for installing LAMP but it is always a good practice. So, type:

apt-get upgrade

Now we can install Apache. To do that type:

apt-get install apache2

To check if Apache is installed, open your web browser and open your server IP address. The page should display the words “It works!”.


To start with the MySQL installation while you are in the terminal type this command:

apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

During the installation, MySQL will ask you to set a ROOT password. If you miss the chance to set the password while the program is installing no worries as you will be able to set the password later from within the MySQL console.

Once the installation is done you can activate the MySQL service with the following command:


After that we will need to set some basic security the MySQL service. To do that just run the following script.


It is recommended to accept the default action for all questions which is yes.


To do that type:

apt-get install php5 php5-mysql php5-common php5-cli

It is simple as that. Please note that you will need to restart the Apache service for the changes to take effects. To do that just type:

service apache2 restart

If you’re one of our Linux VPS Hosting customers we can help you install and configure the LAMP stack on your virtual server for you free of charge. Just contact us and some of our experts will complete your request immediately.


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>