Install Apache, MySQL, and PHP on Ubuntu

In this post I will be showing you how to install a LAMP stack (Linux, Apache, MySQL, and PHP) server on Ubuntu.

Step 1: Update Repositories:

sudo apt-get update

Step 2: Install LAMP Package Group

sudo apt-get install lamp-server^

Ubuntu Install LAMP Stack

If you are running the desktop editionĀ of Ubuntu then you can test your LAMP stack by visiting in Firefox or if you are running Ubuntu Server edition by running the following command:

sudo /etc/init.d/apache2 status

Ubuntu Test LAMP Stack


To start, restart, and stop the Apache service enter one of these lines, by default it will start.

Start Apache Service:

sudo /etc/init.d/apache2 start

Restart Apache Service:

sudo /etc/init.d/apache2 restart

Stop Apache Service:

sudo /etc/init.d/apache2 stop


If you want to install phpMyAdmin then just run the following command:

sudo apt-get install phpmyadmin

You can test your new install by running:




Ubuntu’s web directory and default index.html file is located inĀ /var/www/html/.


I hope you all enjoyed this short and easy tutorial, more are always on the way so please don’t forget to share and like! Thanks!