Ubuntu LogoLAMP (Linux, Apache, mySQL and PHP) is a popular open source web development platform that uses Linux as its operating system, Apache as the web server, mySQL as the relational database management system and PHP as the server-side scripting language.

This quick tutorial is going to explain how to go about installing a LAMP server on your Ubuntu 9.04 Jaunty Jackalope desktop. We’ll start out by first installing Apache, then PHP, then mySQL and finally we’ll round off by throwing in phpMyAdmin, the nifty little web-based administration tool for mySQL.

So let’s get started:

Apache2 Installation:

Run: sudo apt-get install apache2

Once complete, check that Apache has indeed been installed without problems by going to your browser and typing in ‘http://localhost’. if everything is correct you will see the message: “It works”

PHP5 and dependencies installation:

Run: sudo apt-get install php5 libapache2-mod-php5

Once done, we now need to restart of apache2, this time by running the command: sudo /etc/init.d/apache2 restart

mySQL Installation:

Run: sudo apt-get install mysql-server

During the installation you will get the following screen (package configuration), prompting you to set the root password for mySQL. To continue, simply enter your password and then retype it when requested.

Set Up LAMP Server1

If you don’t get the screen to set up the root password for mySQL then you have to do it manually:

mysql -u root
mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘#yourpassword#’);

(Optional) phpMyAdmin Installation:

Run: sudo apt-get install phpmyadmin

During the installation a blue screen will appear asking you which server you want to use. Select Apache2 and click OK:

Set Up LAMP Server2

Once everything is done, point your browser to http://localhost/phpmyadmin you should get this screen indicating that all is well in the world:

Set Up LAMP Server3

If however you per chance didn’t receive any configuration screen during the installation of phpMyAdmin then you will have to manually set it up by editing the Apache config file: sudo gedit /etc/apache2/apache2.conf and add in the following line: Include /etc/phpmyadmin/apache.conf, followed by an Apache restart: sudo /etc/init.d/apache2 restart