Installing LAMP stack (Apache, MySql, PHP) in Ubuntu

Notes;

  • The steps in this tutorial require the user to have root permission.
  • There are many different ways to achieve the same result but I found the following steps simpler than other methods.
  • This tutorial has been tested on a fresh copy of Ubuntu 14.04 on a Virtual Machine (VM)
  • To restart apache web server you can run the following command:
  • sudo /etc/init.d/apache2 restart

  1. instal Apache2 by running the following command in command line (Ctrl + Alt + T):
  2. sudo apt-get install apache2

  3. your default browser and navigate to http://localhost. If Apache is installed correctly you should be able to see “It works!” page which is the content of index.html file located in /var/www/
  4. Apache installed successfully

  5. Install MySql by running the following command in command line (Ctrl + Alt + T):
  6. sudo apt-get install mysql-server

  7. Before installation is complete you will be asked to provide the root password:
  8. lamp_mysql

  9. Install PHP5 and libapache2-mod-php5 packages:
  10. sudo apt-get install php5 libapache2-mod-php5

Congratulations, you have now installed a fully functional Ubuntu web server!