Setting up LAMP on your Ubuntu desktop

Many of you must be wanting to try some web development and would like to setup their own LAMP(Linux, Apache, MySQL, PHP/Perl/Python) stack. Ubuntu has a special Server Edition for setting up your own LAMP server, most of you may want to install it on your desktop (I like it that way).

This involves installing Apache, PHP, Python and MySQL. I think
Python will be installed by default and we only need to install
mod_python for Apache. I use Ubuntu Edgy Eft 6.10.

Apache 2

Apache is the most popular web server and I use it for my
development work. Apache 2 can be installed by running this command in
the terminal.

sudo apt-get install apache2

All your files should be placed in the /var/www/ folder to be viewed from your server.


PHP is on version 5 and can be installed by running

sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart

You can easily test whether you have correctly installed PHP by writing a simple test file.

gksudo gedit /var/www/testphp.php

This will open a text editor and here insert this line. There should
be no space between < and ?. WordPress inserts a space in between.
< ?php phpinfo(); ?>

Point your browser to http://localhost/testphp.php

MySQL Server

Next install MySQL server

sudo apt-get install mysql-server

MySQL by default allows connections only from i.e., only
from your own computer. This is ok if you are developing only on your
own system. If you want to access your MySQL server from a network,

gksudo gedit /etc/mysql/my.cnf

Find the line bind-address = and comment it. Comments start with ;(semicolon).

If you want to set a different password to your MySQL server (than the default none),

mysqladmin -u root password your-new-password
mysqladmin -h root@local-machine-name -u root -p password your-new-password
sudo /etc/init.d/mysql restart

Install MySQL for Apache

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

After this, you have to enable the MySQL extension in your php.ini. Edit the file

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

Here uncomment the line “;

After this restart Apache 2

sudo /etc/init.d/apache2 restart


Python for Apache can be installed by installing the libapache2-mod-python package.

sudo aptitude install python
sudo aptitude install libapache2-mod-python

powered by performancing firefox


8 thoughts on “Setting up LAMP on your Ubuntu desktop

  1. I was trying to install LAMP on my Ubuntu 6.06 Desktop but when I tried the first installation i.e Apache2, I got the following error message.
    ” Some Packages could not be installed. This means that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.

    Since you only requested a single operation it is extremely likely that the package is simply installable and a bug report against that package should be filed the following information may help to resolve the situation

    The following packages have unmet dependencies
    apache : Depends: apache2-mpm-worker (= 2.0.55-4ubuntu2.1) but it is not going to be installedor.
    apache2-mpm-prefork (= 2.0.55-4ubuntu2.1) but it is not going to be installedor
    apache2-mpm-perchild (= 2.0.55-4ubuntu2.1) but it is not going to be installed.

    E: Broken packages”

    What should I do?

  2. Can you help me install lamp on ubuntu desktop using free cds as my home pc does not have a connection to the internet.

  3. Yes,

    We need internet connection to setup the LAMP.
    you can download ubuntu server CD and install from it.


    search for xampp for linux which is a combined bundle of LAMP.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s