LAMP stands for Linux, Apache, MySQL and PHP. It is the most widely used combination for setting up a Web Server. By far, the easiest way to install LAMP server is simply installing the Ubuntu Server Edition itself. However, many of us have installed the Ubuntu Desktop edition, only to find that we need to set up a LAMP server later on. In the following tutorial, I am going to show you how to install and configure a LAMP server in your Ubuntu Hardy Heron in less than 10 minutes.
Installing Apache, Php and MySql
In your Ubuntu desktop, go to “System -> Administration -> Synaptic Package Manager”.
Scroll down the list to search for “apache2”. Check the box beside it and select “Mark for installation”. This will also install other dependency packages. When prompted, click “Mark”.
Next, scroll down the list and search for “php5”. Similarly, place a check beside the box and select “Mark for installation”.
Do the same for “mysql-server” and “phpmyadmin”.
Once you are done, click “Apply” on the top icon bar.
The Synaptic Package Manager will now fetch all the files and install it in your Ubuntu.
When installing MySQL, you will be prompted to enter and reconfirm your password. Make sure that you enter a password that you can remember.
Also, the “phpmyadmin” will ask you which version of apache to use. Select “apache2”.
Testing your installation
Once you have finished installing the LAMP, you will need to test if it is working.
Open your browser and point the URL to http://localhost
If you see the words “It works”, then apache is working fine.
Next, you want to create a php file to test your “php” setting.
paste the following line to the file
Save and close the file.
In your browser, point the URL to http://localhost/testphp.php. You should see all the php information on the browser. If it prompt you to download the file, then your php configuration is not successful. Go to Synaptic Package Manager and reinstall “php5”.
Testing of phpmyadmin
On your browser, go to http://localhost/phpmyadmin. It should loads up the phpmyadmin login page. Log in with the user name “root” and the password you supplied when installing.
This will bring you to the main screen of phpmyadmin.
Putting it all together
To test if the “apache, php5, MySQL” and “phpmyadmin” are working together, we can test it out by installing WordPress.
Download WordPress here.
Extract the “wordpress” folder to your home folder.
Inside the folder, open up the “wp-config-sample.php” file. Edit the following information.
Remember to change the “yourpasswordhere” to the password that you supplied during the MySQL installation.
Save the file as “wp-config.php”.
Next in your phpmyadmin, create a new database call “wordpress”.
Open a terminal, copy the wordpress folder to the apache working directory (the working directory is located at “/var/www”)
Once done, on your browser, go to http://localhost/wordpress. The famous 5 minutes installation will show on screen. Follow the instructions. If is your LAMP configuration is good, your WordPress will be up in 1 minute.
That’s it. Enjoy!
Our latest tutorials delivered straight to your inbox