Installing LAMP Stack on Ubuntu and Debian in Just 3 Steps

In this post you’ll learn how to setup LAMP Stack on Ubuntu and/or Debian in just 3 easy to follow steps. I’m not making the post fatter, thinner and filled with a lot of theory. I’ll just go straight forward towards the installation process. But if you want to learn a little bit of theory behind the seen then you must read my blog Understanding Root Directory, Testing PHP Engine and Installing PHP Extensions on Ubuntu after this post. For now, let’s get started!

First of all let’s define LAMP Stack for those of you who don’t know about it. LAMP Stacks means: “Storing/retrieving data in/from MySQL DBMS, on Linux Operating System, using PHP Server Side Scripting Language running on Apache Server”.

Please Note: some may say ‘P’ in LAMP is for Python and it might be, but we’ll focus on PHP.

Well you’ve already completed the ‘L’ part of the LAMP as you are running Linux Kernel on your Ubuntu or Debian dsitro.

Step 1 – Installing Apache Server

  • Open Terminal
  • Run the following commands one by one in your Terminal
1. sudo apt-get update
2. sudo apt-get upgrade
3. sudo apt-get install apache2

The above given commands will:

  1. Update the list of available Packages and their versions from the repository (Please do note: It just updates not downloads and installs new packages).
  2. Upgrade the the packages on the bases of the list updated by update command (It actually installs new versions of packages).
  3. Installs PHP5 Engine on your machine.

The above given commands will download Apache2 from the Ubuntu Application Repository or Debian Application Repository and will install it on your Ubuntu or Debian dsitro.

After installing Apache let’s check it. Type localhost in your browser and hit enter, you should see the following page if every thing is going right!


Step 2 – Installing MySQL

1. sudo apt-get install mysql-server
2. sudo apt-get install mysql-client
3. sudo apt-get install php5-mysql

The above give commands will install:

  1. MySQL Server.
  2. MySQL Client.
  3. MySQL Module Extension for PHP5 Engine.

Step 3 – Installing PHP Engine

  • Open Terminal
  • Type following command one by one
1. sudo apt-get install php5
2. sudo apt-get install libapache2-mod-php5

The above give commands will install:

  1. PHP5 Engine from the repository.
  2. PHP5 Module for Apache Server.

You’ve successfully installed PHP5, to check whether the installed PHP5 Engine is working properly, see Testing PHP Engine and if you want to make some configuration settings read Configuring php.ini. To know about and install PHP extension modules read my blog Learning about and Installing PHP Extensions on Ubuntu.

That’s all! you’ve completed the installation of LAMP Stack on your Ubuntu and/or Debian Machine. Quite easy? I hope your answer is Yes!


3 thoughts on “Installing LAMP Stack on Ubuntu and Debian in Just 3 Steps

  1. Dear I installed phpStorm 9 on my Ubuntu 14.04 LTS, and successfully installed Lamp stack (Apache2, Mysql and Php engine) and it’s working fine, my problem is when I locate the php interpreter path in phpStorm setting, no php interpreter installed error popping up..and setting of phpstorm requires php executable..can u help plz.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s