Installation of Apache / MySQL / PHP / phpMyAdmin on Ubuntu for PHP / MySQL Development

After resolving to coming to Linux, the first task was to install PHP development environment on my Linux distribution, Ubuntu 10.04 .

The first step in this direction was to install Apache / MySQL / PHP on Ubuntu 10.04 . On Windows Example has supported me very faithfully and initially, I intended to install Xampp on Ubuntu as well. However, since one of the reasons for coming to Linux was to know better about the server environment, I decided that I should try to install Apache / MySQL / PHP package lamp-server which is used in the Linux production environment. Though learning something new would be an adventure as well.

However, installing lamp-server turned out to be rather easy and definitely cannot be termed as an adventure. I entered only the following command from Terminal:

sudo apt-get install lamp-server^

Please note that the ^(caret-sign) after lamp-server is not a type and is required to make the command work properly.

You will see output on Terminal which packages will be installed during the process. Entering a 'y' will start the process of installation. Within a few minutes (depending on your Internet connect, could take longer), you will get a prompt to change your MySQL 'root' password. After this you will get a prompt for confirming the password. After this, the installation process will proceed and complete by itself and run the Apache / PHP / MySQL after installing them as services.

You can test that Apache is working by entering http://localhost in your browser. This should opne a web-page that shows "it Works!".

The default location of your localhost is 'var\www\' . If you like, you can create a file e.g. testing.php and put a call to phpinfo() as under:

<?php phpinfo(); ?>

The next step after installing the lamp-server was installing phpMyAdmin so that you can administer your MySQL databases using a nice GUI interface. I issued the following commands at the terminal:

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

During installation, you will be prompted for an option for web server for automatic configuration. You will need to press 'Tab' key to reach 'Apache', select it using the 'spacebar' and press 'Enter'. After this on the 'debug-common' screen, select 'Yes' and press 'Enter'. Thereafter on all password screens / prompts, keep on providing the MySQL password and your phpMyAdmin installation should complete.

For testing phpMyAdmin, enter 'http://localhost/phpmyadmin' in your browser and provide the password for MySQL root upon being prompted.

You should have a working installation of Apache / MySQL / PHP / phpMyAdmin on your Ubuntu. Have Fun!

After installation, I would like to warn you that if you want to remove lamp-server, please do not enter this command:

sudo apt-get remove lamp-server^

This command, though seems like the logical way for uninstalling the lamp-server, will actually disrupt your Ubuntu desktop. I will write separate detailing the method to remove lamp-server and phpMyAdmin in a later post.