August 18, 2009

LAMP Installation On Ubuntu 9.04

An Insight Into LAMP

LAMP is an acronym that is expanded as Linux, Apache, MySQL and PHP/Python/Perl. LAMP is a software bundle that comes to aid when creating dynamic web sites or servers. In other words, LAMP is a popular Open Source web platform that establishes a foundation for development of high performance web applications. It deals with the definition of a web server infrastructure, creation of a programming paradigm and creation of a software distribution.


1. Linux is the Operating System
2. Apache is the Web Server
3. MySQL is the Database Management System
4. PHP/Python/Perl is the scripting language

Installation of LAMP

1. Open a terminal and type

varsha@varsha-laptop:~$ sudo apt-get install lamp-server^

Press Enter. This might take a lot of time, depending on your internet connection speed.

2. When you are prompted to do the package configuration, enter a password of your choice for the user root. Re-enter the password in the confirmation screen. This will take you back to the terminal.

After some time the installation is completed.

But, we need to test whether the installation is indeed successful. For this do the following.

Testing Apache

Type http://localhost in the address bar of your browser. If the page displays a 'It works!', then successful.

Testing PHP

1. Create a file test, or name it whatever you want, by typing in the terminal

varsha@varsha-laptop:~$ gksudo gedit /var/www/test.php

In case you are naming your file something else, be sure to replace it with the name 'test' in the code above.

2. The gedit text editor opens with a new file wherein you are to type

<?php phpinfo(); ?>

3. Save and close the file.

4. Restart Apache.

varsha@varsha-laptop:~$ sudo /etc/init.d/apache2 restart

5. Open your browser and type http://localhost/test.php in the address bar, replacing 'test' with the name of your file. If Apache has been successfully installed, you should be able to see the details of the version of PHP you are using currently, displayed on a page.

Configuring MySQL

1. MySQL has to be binded with the localhost IP address, as we are to deal with web development. Verify your localhost address. For this,

varsha@varsha-laptop:~$ cat /etc/hosts | grep localhost

2. Edit the my.cnf file.

varsha@varsha-laptop:~$ gksudo gedit /etc/mysql/my.cnf

3. Check whether bind-address has your localhost address. In my case it is

Installing phpMyAdmin(Optional)

phpMyAdmin is required to admininster MySQL database with ease.

1. Open a terminal and type

varsha@varsha-laptop:~$ sudo apt-get install libapache2-mod-auth-mysql phpmyadmin

2. When prompted, select the web server apache2 by pressing the spacebar and press enter.

3. In the next screen, you will be asked if you would like to configure the database for phpMyAdmin with dbconfig-common. By default, Yes will be selected, and if not, use arrow keys to select Yes and press enter.

4. Next, you will be asked for the administrator password. Enter the password for the user root that you had entered during installation. Use tab to select OK, and press enter.

5. Next, you will require to enter a password for phpMyAdmin. Enter a password (You may use the same password in case you have the habit of forgetting passwords). Leave it blank if you want a random password to be generated.

6. To verify that your phpMyAdmin works, open your browser and enter http://localhost/phpmyadmin/. You should be able to see the phpMyAdmin welcome page.

7. You can log in using root as your username, and the root password that you had created earlier.

LAMP installation complete!

No comments:

Post a Comment