Lamp Server And Phpmyadmin Installation on UBUNTU

LAMP stands for Linux Apache MySql PHP server. It’s native to a Ubuntu Server edition install but has to be installed separately in a Ubuntu Desktop edition. In this tutorial, we will go through the steps to install the LAMP server on any Ubuntu Desktop edition PCs. I will also add the step of installation of phpmyadmin, a nice tool for PHP newbies for dealing with the MySql database. The following tutorial is relevant for installation on Ubuntu Hardy (8.04), Intrpid (8.14), Jaunty (9.04), Karmic (9.14) and Lucid (10.04)

LAMP-Server installation

The canonical maintains the latest LAMP and phpmyadmin builds on its servers. So the first step is to install the LAMP server via aptitude. Type this at command line:

sudo apt-get install lamp-server^

Note the “^” has to be there.

During the process of installation, you will be prompted to setup the root password for MySql. Enter the password and hit OK (you can browse through the page navigation options by hitting Tab key).

Now the last step is to check that MySql database is correctly binded to the http://localhost. Type this in a Terminal:

cat /etc/hosts | grep localhost

You should see something like “127.0.0.1 localhost” . This means that localhost is at IP http://127.0.0.1

Now lets check that Mysql is correctly bound to this IP. Type this on Terminal:

cat /etc/mysql/my.cnf | grep bind-address

You should see soemthing like this bind-address = 127.0.0.1

If you dont see 127.0.0.1 (or the IP for localhost that you saw when you did cat /etc/hosts | grep localhost ), then you will need to correct it (you can correct it by: gksudo gedit /etc/mysql/my.cnf )

This completes the LAMP server installation.
phpmyadmin installation

Now also install the phpmyadmin. Type this at command line:

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

During the installation, you will be first prompted to select a web server for automatic configuration. I am putting this step in caps as most people goof it up (and later have problems with accessing phpmyadim via Apache). USE YOUR KEYBOARD’S SPACE-BAR FOR SELECTING APACHE2 AND THEN HIT ENTER .

After this, you will be asked to configure a new database called dbconfig-common . This being a new installation, use the Tab key to select Yes and then hit Enter .

Now, you will be asked to setup MySQL root password. Use the same root password for MySql that you created while doing LAMP installation. Then use Tab to highlight Ok and hit Enter .

After this, you will be prompted to setup a MySQL application password for phpmyadmin. Use the same root password for MySql that you created while doing LAMP installation. Hit Enter . Then confirm the password and again hit Enter . This will complete the phpmyadmin installation.
Test Apache webserver installation

Now you need to make sure that your webserver (Apache) is working correctly. Type this on a terminal:

firefox http://localhost .

You should see firfox web-browser display “It works!” in bold. This means that the Apache web-server is up and running.
Test PHP and phpmyadmin installations

OK, in ubuntu, the webserver looks at /var/www directory by default for any web-page accessed like this http://localhost/my_first_web_page.php . Of course “my_first_web_page.php” is just a file-name that I am using for demo to test php installation. You can use whatever file name you like (but retain the .php file extension).

So, now type this in a terminal:

gksudo gedit /var/www/my_first_web_page.php

(you can see my earlier blog on configuring gedit http://absolutebeginnerubuntulinux.blogspot.com/2010/02/configuring-gedit-on-ubuntu-linux.html )

Copy-Paste the following lines into the text-editor gedit:

<?php
phpinfo();
?>

Save and close gedit. The reboot Apache webserver by typing this on Terminal:

sudo /etc/init.d/apache2 restart

After this, again type this on Terminal:

firefox http://localhost/my_first_web_page.php

You should see firefox diplaying info about php-engine. This means that the install went perfect for php.

Now again in the terminal, type this:

firefox http://localhost/phpmyadmin/

ou should see a web-page prompting you to enter user-name and password. Enter root as username and the password as the one you gave when doing MySql setup during LAMP server installation. You will be greeted my the phpmyadmin home screen. This means the phpmyadmin installation went perfect.
Uninstallation of LAMP server and phpmyadmin

Okay, so you bungled something when doing either installation or during active developemt and want to start aftersh. So here’s how to remove everything.

Removing LAMP server: Type on a Terminal:

sudo apt-get purge lamp-server^

Removing phpmyadmin: Type on Terminal:

sudo apt-get purge libapache2-mod-auth-mysql phpmyadmin

source: http://www.webrichsoftware.com/?p=16

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: