Install LAMP on Ubuntu 9.10 Karmic Koala
Why install LAMP on your desktop computer?
Why would I want to install and set up a LAMP (Linux, Apache, MySQL, php) stack on Ubuntu 9.10? It’s useful if you want to set up a private web development environment. Perhaps you want to develop your own WordPress theme. If you are developing websites and experimenting, it’s nice to do it in the privacy of your own computer, rather than out on the public internet.
Install LAMP
The Ubuntu developers have created a very easy way to install a LAMP server on an existing system. It's all kicked off with this one simple terminal command.
Note: Please make note of the caret (^) in the above command, it's not a typo, it's required to make the command work.
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 complete! That was the easy part, now you need to get things configured to make the 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!"
Testing php
Now that you know Apache works, it's time 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.
Configuring MySQL
Since I'm installing LAMP for a web development environment, I want to bind the MySQL database 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 the my.cnf file.
You should see a line that looks like
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 muck around with things in your MySQL database if you're not familiar with the MySQL commands. You can install phpMyAdmin from the command line with
The installation will prompt you to select a web server for automatic configuration. Use the space bar on your keyboard to select apache2 and then hit <Enter>.
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.
The phpMyAdmin installation 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 the 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.















[...] on how to install LAMP on your operating system. I personally use Ubuntu and the following post on Tux Tweaks really helped me [...]
Great tutorial indeed.
I just used it to install LAMP on my notebook running ubuntu 10.04 and i had no problems at all.
Thank you great... tutorial.. i could install without any hiccup.. only phymyadmin..gave trouble... anyway it is extra..
I also just installed LAMP using this great guide. Thank you!
However, I also had problem with http://localhost/phpmyadmin/ not working.
I solved this by changing the Apache configuration file slightly. First open it by entering this in a terminal window:
sudo gedit /etc/apache2/apache2.conf
Then add the following line at the end of the file:
Include /etc/phpmyadmin/apache.conf
Then save it, close it, and restart Apache from the terminal window by writing:
sudo /etc/init.d/apache2 restart
Then phpMyAdmin also worked for me.
This information I got from a more detailed installation guide in Danish (http://jesperjarlskov.dk/blog/lamp-linux-apache-mysql-php-pa-dit-ubuntu-desktop/).
thanks for the correction. It works for me after i read ur correction and applied it.
how to work with lamp?
because newbie
i have project but in win**** and I want to work in ubuntu
thanks to answer
please answer to my email
This worked for me ... except for the phpmyadmin part. I added a line at the end of /etc/apache2/apache2.conf:
Include /etc/phpmyadmin/apache.conf
then everything worked perfectly.
Thank you for a wonderful tutorial. This is the simplest and fastest way to add LAMP and Phpmyadmin.
very helpful thanks!! But how can I restart lamp after shut down?
The installation process creates startup scripts in /etc/init.d. LAMP starts automatically when you boot your computer.
thanks!!
Nice post,but for getting phpmyadmin to work i need to follow the post give below anyway thanks for the correction nice post dude...its simply superb...
installed phpmyadmin but get 404 file not found error any help welcome!
Doogie
sorry people the above correction worked, just forgot to restart apache!
silly me
Doogie
Thanks so much, it is a pleasure working with clear and concise tutorials such as this.
Dick
it's a great tutorial.
Thanks. Worked like a charm.
Great tutorial............. was configure lamp in a single go!!
thankx
Thanks, this was a great help.
I struggled with this over a week and only after reading this, did I get my problem solved
Nice post. but if I want to install php 5.2.10 on my fedora server then whats the way out ?
What a great tutorial...I was using xampp and once i got mysql login, several times re-installed. finally i decided to do away with xampp, this tutorial is a big help.I book marked it.
Kudos...
I got this error message at the 'Testing PHP' phase:
"Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName"
Found a fix for it here:
http://mohamedaslam.com/how-to-fix-apache-could-not-reliably-determine-the-servers-fully-qualified-domain-name-using-127011-for-servername-error-on-ubuntu/
You can also find the solution at the end of this post: http://tuxtweaks.com/2009/07/how-to-configure-apache-linux/
Thanks for the great guide, use it on all my developer installs....setup is nice and easy, again thanks alot!!!!!!
Thanks very much for tutorial, but ... where (in which folder) I should copy and extract lamp archive ...
I have now lamp in a folder in Documents and nothing happend:
lenny@lenny-Ub:~$ sudo apt-get install lamp-server^
[sudo] password for lenny:
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias
Leyendo la información de estado... Hecho
0 actualizados, 0 se instalarán, 0 para eliminar y 0 no actualizados.
E: No se pudo encontrar la tarea lamp-server
THAAAAAAAAAAAAAAAAANKS for the tutorials!!!!
My LAMP and myphpadmin works!!
Now I can dump Windows.