Install LAMP on Ubuntu

The last week I re-installed LAMP on Ubuntu 11.10 to try somethings.

I post you the simply instructions to install all fine. In the future I’ll post you something about the sites configuration.


First, install apache. Open a terminal and write:

sudo apt-get install apache2

Test Apache opening this URL: http://localhost/
If apache works correctly you can see a page with the message: “It Works!”


Now, we must install PHP. Open a terminal and write:

sudo apt-get install php5

Restart apache using this command (remember it):

sudo service apache2 restart

To make sure that PHP doesn’t have problems, you can open a new php file with some stuff:

sudo echo "<!--?php phpinfo(); ?-->" > /var/www/testphp.php
See if PHP works opening the page in this URL: http://localhost/testphp.php


Now, let install MySQL:

sudo apt-get install mysql-server php5-mysql

We must change php.ini too:

gksudo gedit /etc/php5/apache2/php.ini

Uncomment the following line (removing the ‘;’ ):



To manage the databases you can install PHPMyAdmin too:

sudo apt-get install phpmyadmin

To enable it, you must change apache configuration:

gksudo gedit /etc/apache2/apache2.conf

Add the following line to this configuration file:

Include /etc/phpmyadmin/apache.conf

Restart apache and try to open the URL: http://localhost/phpmyadmin


You can install SQLite too, which you can use like an alternative database:

sudo apt-get install php5-sqlite


Now you can try and re-try what you want. Good work!

8 responses to “Install LAMP on Ubuntu

  1. Caitlyn Plowman

    Very useful! Thank you.

  2. sesli sohbet

    Heya i’m for the first time here. I found this board and I to find It truly useful & it helped me out a lot. I’m hoping to offer one thing back and aid others like you helped me

  3. sesli sohbet

    Thank you for the good writeup. It if truth be told was a leisure account it. Look advanced to more brought agreeable from you! However, how could we be in contact?

    1. Sohaib

      At work with sql files i usually use next sarowtfe-,tool is free as far as i know,it repair data from corrupted databases in the MS SQL Server format (files with the *.mdf extension),supports data extraction via the local area network,can save recovered data as SQL scripts, it is also possible to split data into files of any size,compatible with all supported versions of Microsoft Windows, such as Windows 98, Windows Me, Windows NT 4.0, Windows 2000, Windows XP, Windows XP SP2, Windows 2003 Server, Windows Vista,tool supports the following database formats: Microsoft SQL Server 7.0, 2000, 2005,also can repair .mdf files of Microsoft SQL Server 2005, repair mdf file of Microsoft SQL Server 2005 (64-bit).

    2. Hester

      That insight solves the prebolm. Thanks!

  4. John

    Please email me with some tips on how you made your website look this awesome , I would be thankful!

  5. Eliane

    great post & good information. i would like to see more of these.

Leave a Reply

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