How To Install LAMP In Ubuntu

How To Install LAMP In Ubuntu

In today’s tutorial I will show installing lamp in ubuntu, lamp stands for Linux, Apache, MySQL, and PHP.

Installing Lamp In Ubuntu

Apache is your actual webserver. It can handle serving files, directory indexing, serving HTML files, etc.

sudo apt-get install apache2

PHP is what most web scripts run on and is part of a lamp server. To install php properly you need to install the php5 package and then the php5 apache module. Then you need to restart but if you want to add mail to this I suggest simply restarting after the next step.

sudo apt-get install php5
sudo apt-get install libapache2-mod-php5

Send/Recieve Emails (sendmail)
If you want to send or recieve emails its easiest just to install the sendmail package and restart Apache, this step is optional. After you restart your web scripts should be able to send emails.

sudo apt-get install sendmail

Install MySQL and MySQL PHP/Apache Module
MySQL is what most servers and sites use for their databases, web hosts should definitely install this. You can install MySQL and its PHP module by running the following command.

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

Restart Apache
After you have installed lamp in ubuntu you need to restart Apache to make sure everything is loaded correctly. You can do so by running the following command.

sudo /etc/init.d/apache2 restart

Installing php
Also if you want to make life easier when working with MySQL you can also install php.

sudo apt-get install php

This should install all the software needed for your basic server. Your web servers files should be located in “/var/www/“.

You can access your php from


I hope this tutorial helped with installing LAMP in Ubuntu. More tutorials are on the way so stick around and don’t forget to bookmark!

Recent Incoming Guest Searches:

15 Responses to “How To Install LAMP In Ubuntu”

  1. Wavatar

    A friend of mine advised this site. And yes. it has some useful pieces of information and I enjoyed scaning it. Therefore i would love to drop you a quick note to express my cheers. Take care

  2. Wavatar

    Really like the modern layout. I really enjoyed this content. Bless you for the helpful post.

  3. Wavatar
    Hamisi Jabe

    Thanks for the tutorial, i have managed to install and configure lamp server on my ubuntu 12.04 box


  4. Wavatar

    Thanks great tutorial…now I only need to install drupal and uninstall windows :)

  5. Wavatar

    A shorter option is simply:
    apt-get install lamp-server^

    where the carat at the end is intentional.

  6. Wavatar

    Helped a lot…saved my time….and the steps are upto the point.

  7. Wavatar

    Does sendmail need to be configured or is just installing sendmail enough to send emails

    • Wavatar

      I simply installed, restarted Apache and then everything worked fine as far as sending goes.


Leave a Reply

Please type the characters of this captcha image in the input box

You must type in the above characters to post a comment