Installing LAMP on Ubuntu 10.04 and 10.10 (Lucid Lynx, Maverick Meerkat)
If you're developing websites, it's nice to be able to test your code in the privacy of your own computer rather that out in the public internet. In order to do that, you'll need to install a web server on your development computer. LAMP (Linux, Apache, MySQL, php) is one of the most common web hosting platforms, so it's a perfect environment for you to build and test your website code. If you carefully follow these step by step instructions, you'll have your own Ubuntu LAMP web server on installed, configured, and running in no time.
Install LAMP Web Server on Ubuntu
The Ubuntu developers have made it easy to install and configure the LAMP server packages with a single command. Simply open a terminal window and enter the following.
No, that's not a typo. Please make sure to include the caret (^). The command will not work without it.
The apt package manager will show all the packages that need to be installed. Hit <Enter> to confirm that you want to install them.
You will then be prompted to change the password for the root user on the MySQL database.
Enter the password you want. You'll be prompted to enter it a second time to confirm.
After you confirm your password, apt will continue to install the rest of the packages.
Congratulations, your LAMP installation is now complete! That was the easy part, now you need to get a few things configured to make your system easy to work with.
Test Apache
Open a web browser and enter the address http://localhost/. You should see a web page that says "It Works!"
Test php
Now that you know Apache works, you'll want to test the php installation. You'll need to create a file in /var/www called testing.php. Open a terminal and enter:
Enter the following line into the text editor, save the file and exit.
Next, restart Apache with the following terminal command:
Now go back to your web browser and enter the address http://localhost/testing.php/. You should see a page displaying version information for your php installation.
Configure MySQL
Since I'm installing LAMP for a web development environment, I want the MySQL database to be bound to the localhost IP address. This should be 127.0.0.1 for your system. You can verify it with this terminal command.
You'll now want to verify that the correct bind address is set up in MySQL's my.cnf file.
You should see a line that looks like this:
bind-address = 127.0.0.1
If the IP address doesn't match the one for your system, you'll need to edit the my.cnf file to correct it.
Install phpMyAdmin
You don't need to install phpMyAdmin, but it's a much easier way to get in and adjust things in your MySQL database if you're not familiar with MySQL's commands. You can install phpMyAdmin from the command line with:
The installation will prompt you to select a web server for automatic configuration.
This is important! Use the space bar on your keyboard to select apache2. Make sure there's a * next to apache2 like the picture below and then hit <Enter>. (Click the picture to enlarge it and see what I'm talking about.)
The next screen will explain some information about database configuration. Hit the <Enter> key to move on.
Another screen will come up asking if you want to configure a new database called dbconfig-common. Since this is a fresh installation, use the <Tab> key to select Yes and hit <Enter>.
You'll be prompted next to enter the MySQL root password. Enter the MySQL root password that you created earlier, hit <Tab> to select Ok and hit <Enter>.
You'll then be prompted to enter a MySQL application password for phpmyadmin. You can hit <Enter> and a random password will be generated. I chose to use the same password that I used for the root MySQL password.
If you enter your own password, a password confirmation screen will come up. Confirm your password.
Your phpMyAdmin installation and configuration is now complete.
Testing phpMyAdmin
Open your web browser and enter the address http://localhost/phpmyadmin/. You should see a page like this.
You can log in with the username root and the root password that you created earlier.
Congratulations, you're now ready to start building your local website. If you're only working on one site you can put all of your files into /var/www. If you'll be working on multiple sites you may want to consider some additional Apache configuration to keep things neat and clean on you system.

















Installed on Ubuntu 11.04 - the Natty Narwhal.......... worked perfectly! Thx!
thank YOU!!
Very useful article, thank you very much.
loveit!!!! thanks work like a charm
It just does it ! Cool !
Next step --> the apache conf.
THANKS......SIMPLE AND VERY USEFULL.
THANKS,.........
thanks, perfect tuto!
You have saved me a lot of time and effort. I used to install everything manually and was not aware of the auto command. Your instructions are extremely clear.
Thank you very much.
This was brilliant, thanks a lot
.
My VPS doesn't have a GUI so I installed Lynx to perform the tests. Lynx is a command line, text based browser.
You're welcome.
Yeah I've used Lynx a bit in the past. http://tuxtweaks.com/2010/05/lynx-a-text-only-web-browser/
Worked a charm. Thank you so much!
Works great on 11.10 as well. Thanks!
Thank U! Very good explanation! Thumbs Up!
Thank a lot, Very good explanation. It woks perfectly.
thank you, the tutorial is perfect, ubuntu 10.04!
now how can I update the phpmyadmin version?
can I configure a dyndns.org to my address?
thank you again!
perfect and clear explaining
D
thanks a lot!
Works perfectly.
Thanks
Don't leave field blank when it asks password for mysql: it's necessary! without pass for 2 times I got error during phpmyadmin login. At the 3rd time I put same password for both and now finally it's work!
Thanks a lot for your work