lamp stack

Installing LAMP Stack on Ubuntu 16 in Just 3 Steps

In this post, you’ll learn how to setup LAMP Stack on Ubuntu on Ubuntu 16.04 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 scene 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 distro.

Installing LAMP Stack on Ubuntu 18.04 in Just 3 Steps

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 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 distro.

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

sudo apt-get install mysql-server
sudo apt-get install mysql-client
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!

Leave a Reply

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