Installing LAMP on Ubuntu 10.04 and 10.10 (Lucid Lynx, Maverick Meerkat)
Page 1 Page 2
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.
Page 1 Page 2








Thanks a million!!!
It was really helpful..... keep up the good work...
Howdy,
I do website development, and I prefer my Linux machines, don't get me started on Bill. However, I followed this through but it puts the files in /var/www/ file which can only be access by the root user. Is there some way to have the www file located where it is read/write capable from regular user not the root? If I just don't understand, I will accept that.
Figured it out from another of your posts, thank you so much!
What a super How To - Thanks so much.
Would someone mind linking the referenced post about user privileges for the var/www folder? That'd be super helpful.
Never-mind, I just changed the permissions on the folder via sudo nautilus, that seems to have had the desired effect. :- )
Really good article! Thank you very much!
Really a very useful information and it really helpful to create local web page.........
Its was very useful to know how to install and to work through the server...thanks a lot...
Just to say thanks, it was soo easy
Excellent tutorial....:) Thank you so much....
I have contact problem i don't have access or permittion to write on the WWW folder, did any body had that problem? and how to solve it please?
Excellent tutorial, it really helped mi
@Hector
Create the "www" folder in "var". You probably don't have it thus the problem ur experiencing
Im unableto install phpAdmin when im entering this address "http://localhost/phpmyadmin/." im getting this message
//
Not Found
The requested URL /phpmyadmin/ was not found on this server.
Apache/2.2.16 (Ubuntu) Server at localhost Port 80
//
What should i do?
And if i have to reinstall it how should i ?
You probably forgot to mark "apache2" during the phpMyAdmin installation. Yo can fix it with this procedure: http://tuxtweaks.com/2010/04/installing-lamp-on-ubuntu-10-04-lucid-lynx/comment-page-1/#comment-2952
thank you very much. It's a really good explanation!
Thanks so much for including the part about using space to select an item. I've been trying to do this using a couple of other articles, and as a newbie I simply didn't know this. Rally great article, thanks!
[...] a nice guide for installing and checking a basic LAMP setup on Ubuntu Share this:TwitterFacebookLike this:LikeBe the first to like this [...]
That was very helpful.Thanks
During install I got:
"Creating config file /etc/php5/apache2/php.ini with new version
* Reloading web server config apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName"
Does this mean //localhost is on 127.0.1.1 rather than 127.0.0.1 ?
And a really strange thing is I can access the page from almost any IP address: These all work:
http://127.222.222.222/testing.php
http://127.2.2.2/testing.php and http://127.0.1.1/testing.php
Shouldnt it only work with http://127.0.0.1/testing.php ???
Thats odd?
In phpAdmin I also get this error:
$cfg['Servers'][$i]['tracking'] ... not OK [ Documentation ]
Tracking: Disabled
Is that normal?
I need a bit of clarification on the /var/www folder.
Normally this is a folder with root perms that mirrors "/htdocs" (for MAMP and WAMP) or "/public_html/" on linux servers.
Norrmally one does not put the web page files in /www but in /htdocs or /public_html ... leaving /www to serve the mirrored content.
Is this not the case with LAMP ?
Thanks a bunch, great how to =)
Great and thanks for sharing