[Note: In this post I'll be showing how to install Apache, php, MySQL and phpMyAdmin (one by one) on Ubuntu 8.10 using Terminal. If you want to install them all at the same time with minimal fuss, I recommend you to read my post on installing LAMP.]
Installing Apache
1. Open Terminal (Application -> Accessories -> Terminal) and execute the following command:
sudo apt-get install apache2
2. When the setup is complete you can check if the Apache is working properly by pointing your browser to http://localhost. If you see the text “It works!”, it means Apache is working just fine.
3. Towards the end of the installation if you see a message like this inside Terminal, “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName“, you can fix this by executing the following command. It will open Gedit (text editor).
gksu gedit /etc/apache2/conf.d/fqdn
4. When Gedit opens, type “ServerName localhost” inside the file and click Save. Then close the file.
Installing php5
1. Inside Terminal, execute the following command:
sudo apt-get install php5 libapache2-mod-php5
2. When setup is complete, you have to restart Apache so that php5 will work on Apache. Execute the following command in Terminal:
sudo /etc/init.d/apache2 restart
3. You can now test to see if php5 works with Apache. To do this you can create a new php file inside your /var/www/ folder. (The text in red is the filename. You can put any name.)
sudo gedit /var/www/nass.php
4. The command above will open Gedit. Just type in the following php code, save and close the file:
<? phpInfo(); ?>
5. Now point your browser to “http://localhost/nass.php” and see if you can see the text “yoo hooo!” and a lot of information about your php5 installation. If you see that, it means your have successfully installed php5.
Installing MySQL
1. Inside Terminal, execute the following command:
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
2. Towards the end of the installation you will be prompted to set your root or admin password (see pic below)
Installing phpMyAdmin
1. Inside Terminal, execute the following command:
sudo apt-get install phpmyadmin
2 During the installation you will be asked to select the webserver that would be used to run phpMyAdmin. Select Apache2 (see pic below).
3. After the installation is over execute the following command to copy the phpmyadmin folder into the /var/www/ directory. (By default it is installed in /usr/share/phpmyadmin/ directory.)
sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin
4. Now you can go to the phpMyAdmin login page by pointing your browser to: http://localhost/phpmyadmin/index.php
The username for MySQL and phpMyAdmin is “root”. The password will be what you set in step 2 (under installing MySQL).
That’s it! Now you’ve successfully installed Apache 2 webserver, php5, MySQL and phpMyAdmin on Ubuntu.
UPDATE (28-Jan-09)
After installing Apache, PHP, MySQL and phpMyAdmin, you can install support for ASP.NET files in Ubuntu. Don’t worry, you will be able to work with php and aspx files on the same Apache server without any problems.
[References: Ubuntu Community Docs & HowToForge]


November 16, 2008 at 2:16 am
Thank you for the information it was very helpful. My next step is to get tomcat running.
-Ray
November 17, 2008 at 2:06 am
hmm..all installed succesfully..but I have an error!!
“cannot load MySQL extension, please check PHP Configuration”.
November 19, 2008 at 1:51 pm
hello Mechanism. have you edited the php.ini file. do a
sudo gedit /etc/php5/apache2/php.ini
look for the line that says extension=mysql.so and uncomment it by removing the ; in front of the line. restart the apache service and hold your breath.
November 19, 2008 at 4:11 pm
I’ve installed it and logged in. Thanks!
However, there were two problems:
1. In step 4 of Installing PhP, we are to put in:
I had to change the quotation marks from whatever is here to whatever they are in Gedit. Then it worked.
2. With reference to MechanisM’s problem, Lawal’s solution does not quite work. In the php.ini file, there appears to be an error. In the file, I can find:
extension=msql.so
but not:
extension=mysql.so
Uncommenting:
extension=msql.so
does not work. It must be uncommented and changed to:
extension=mysql.so
then it works fine.
One final comment. The instructions are clear about making a new password for MySQL for the “root” user. However, it might be noted that in logging into phpMyAdmin, the user name is root, then the password as given. Perhaps this is obvious, but perhaps it is worth mentioning; I thought the username would be the user name I log into my ubuntu machine with.
Thanks for this! After these minor glitches, it works so far. Glad to have it!
Cheers,
Adam
November 19, 2008 at 4:50 pm
@Adam
I’ve removed that bit in the quotes as it’s not even necessary.
As you’ve mentioned, some users may not know what to use as the username. So I’ve put that in as well.
Thanks for the comment.
November 26, 2008 at 4:26 am
thanks, there are no problem
for those who have problems, please restart apache to function properly
December 2, 2008 at 8:58 pm
Worked perfectly, thanks.
December 3, 2008 at 9:25 am
Awesome! So easy to follow! I really appreciate the time you put into this.
To anyone getting the same error as MechanisM with phpmyadmin, follow Adam’s instructions, and then make sure you type localhost/phpmyadmin/index.php again in the address bar. I stupidly kept hitting reload and it kept reloading the error page even though the problem was solved.
Thanks everyone!
December 13, 2008 at 7:28 am
[...] assumes you’ve already installed Apache and MySQL, for notes on installing these I found this article to be a great [...]
December 15, 2008 at 7:27 am
@MechanisM
When making any changes to Apache a restart is required.
sudo /etc/init.d/apache2 restart
That should fix’r up.
December 17, 2008 at 6:48 am
After each change, restart fixed the php problem.
sudo /etc/init.d/apache2 restart
December 18, 2008 at 10:05 am
Thanks a lot!!!
December 24, 2008 at 2:52 am
I have to do this every time I format. I’m glad there are people on the net like you that document everything. Thanks a lot man. Happy holidays.
December 24, 2008 at 9:04 pm
Thank You it’s the Perfect guide for PHP MYSQL APACHE installation processes. it’s the easiest that i have seen .
Thanks again
December 26, 2008 at 9:05 am
thanks a lot, everything is working perfectly!
December 29, 2008 at 3:05 am
This Worked Out Great Thank You.
January 9, 2009 at 3:25 pm
Worked properly. Thanks
January 14, 2009 at 9:29 am
thanks you! i am very happy when read this document.
January 15, 2009 at 12:09 am
Thank you very much, it is great producre to follow. it work perfect for me
January 17, 2009 at 5:39 am
Thank U. It.s very useful.
January 22, 2009 at 1:13 am
Excellent … I have got it all working. Thankyou.
February 4, 2009 at 7:32 am
thanks for the very nice tutorial..
February 5, 2009 at 8:49 pm
The tutorial is awesome

I was searching for this kind of Cristal clear instructions for two days and thank God that at last I found it
I’ve become a fan of this site
February 6, 2009 at 4:14 am
Thanks for the comments everyone
February 6, 2009 at 12:21 pm
hai. i’m a total noob when it comes 2 linux let alone running a server on it. i was able to install apache using your guide (thanks a bunch by the way) but i was unable to customize so to say my webpage layout. i only know how to edit html pages. i tried editing the index.html file thats on /var/www but i don’t have permission. could anyone help me….
February 6, 2009 at 7:42 pm
Thanks nass. Its very useful.
February 6, 2009 at 10:33 pm
hello waver… type “sudo nautilus” in your terminal and then press enter… it will open the root file browser… from this browser right click on the folder /var/www and select properties from context menu… then select permission tab and then edit the owner and group
thats all
February 9, 2009 at 12:14 pm
Thanks nass. I installed apache and php5. It worked great. But when running my php scripts, it ignores all the “\n” line feeds. (The HTML works.) Any idea why the “\n” doesn’t work? I don’t think I changed any settings.
February 10, 2009 at 11:40 pm
Hello! I’m new on Ubuntu Intrepid Ibex and I want to Know if it is necesary to install Ubuntu Server? Or all discussed above is usefull on Ubuntu Desktop?
February 11, 2009 at 7:54 pm
Thanks a lot for this extremely simple yet funcional and working tutorial!!!
Great job!
February 13, 2009 at 5:25 pm
Help me I forgot my password for phpmyadmin, any way to recover username and pass both
- arun
February 14, 2009 at 6:18 pm
Exelent work my friend…
I installed everything whitout problems..
thanks and keep the way!…
Greatings
February 16, 2009 at 8:15 pm
Worked like a charm. Did have to edit php.ini file as indicated in other comment but this is by far the simplest explanation out there
February 17, 2009 at 1:14 am
i was try and it work
goot info
thank you
regards
February 23, 2009 at 11:24 am
Thanks a lot!!!!!!!!!!
February 27, 2009 at 3:07 am
Excellent Article.You rock man. Thanks…
March 9, 2009 at 12:43 pm
Awesome article!!! Thank you
March 12, 2009 at 4:30 am
Awesome tutorial, thank you so much.
March 12, 2009 at 6:38 am
thank you.. it works perfectly
March 12, 2009 at 8:58 am
Terima kasih, sangat membantu. Segalanya sekarang menjadi terang. Bravo!
March 12, 2009 at 8:13 pm
Thanx for your document,it helped me very much in installing my apache,php and mysql.
March 12, 2009 at 8:23 pm
wow wow,its wrong time I was finding the solution for “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName“,now got it. Thanx alot.
March 12, 2009 at 10:45 pm
Sir,
i installed the XAMPP in my ubuntu 8.10 sucessfully,but sir i cant able to copy any of the file to /opt/lampp/htdocs/ folder why this happening
i am a beginner in both PHP and Linux, can u explain me…plz….waiting for your response
March 13, 2009 at 9:24 am
wwwwwwwwwwowwwwwwwwwwwwwwwwwwwwww great tutorial
!!!! 
greets from Guatemala
March 15, 2009 at 3:48 am
A very clean and precise set of instructions, I could install all of it without any problems. Extremely good job done.
March 16, 2009 at 5:55 am
Newbie to Ubuntu 8.10.
Perfect & clear instructions. Everything worked.
Thank you.
March 16, 2009 at 6:02 pm
Let me join the many others in thanking you for this great tutorial! Your instructions were so good even a Micro$oft guy like me can follow them
March 26, 2009 at 7:06 am
Great tutorial. Reads like you are a technical writer. It’s rare! I’ve been spending hours on forums since I’ve installed Linux and usually it’s ambiguous or cryptic. Nice change.
March 31, 2009 at 10:42 pm
Its tutorials like this that pop up #1 on a google search that will make ubuntu a dominant operating system. That and apt-get.
April 1, 2009 at 2:22 pm
Very nice work on the tutorial friend.
Keep up the good work!! Thnx ^^
April 3, 2009 at 10:15 am
one of the cleanest how-to’s out there, everything worked as expected w/ no surprises…very nice work
April 4, 2009 at 12:38 am
Nice, very nice! : )
April 13, 2009 at 9:43 pm
Tks guy, You help me a lot!
April 15, 2009 at 4:57 am
Thanks a lot…everything works perfect…
Chears Mate
April 23, 2009 at 4:35 am
Thanks very much friend! Excellent tutorial!
April 28, 2009 at 12:07 am
Thank you very much for your effort
but unfortunately i have a small problem that when i click on the link http://localhost/phpmyadmin/index.php
it gives me an error
“Cannot load mysql extension. Please check your PHP configuration. – Documentation”
could any one please answer me and tell me what to do
any answer will be highly appreciated
May 4, 2009 at 6:06 pm
Thanks a lot
May 12, 2009 at 10:10 am
All, I have the error when i’ll try to LogIn to PHPmyAdmin the error was “Error
#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured)”,
any suggestion?
vegalinux@yahoo.co.id
May 12, 2009 at 4:27 pm
i get an error as well!
Cannot load mysqli extension. Please check your PHP configuration. – Documentation
i went to the file that you said, uncomented the thingy and also changed it to mysql insteat of msql but is not working.
Also i think that could be because after step
Installing phpMyAdmin
it asked me for something else that is not mentioned here.
About if i want to use a dbcommon about a database or if i want to do it myself afterwards…and because i said yes then it was a couple of more passwords asked. :/
So now it resulted to this.
Can somebody help?
Thenx
May 12, 2009 at 5:03 pm
p.s. restart php again and now it works and i log in
But still there is this error bellow where the login credentials are asked!
Can i do smthing about that?
Thank you again in advance!
May 27, 2009 at 4:24 am
Ubuntu 8.10 Using Firefox 3.0.10
Apache works html file says “It Works”
http://localhost/rick.php – Firefox wants to Open File or Save it. Will not run it. Is this a Firefox problem or a php5 problem?
Great tutorial !!
May 27, 2009 at 5:08 am
Sorry people. I messed around with the apache2.conf, httpd.conf files and Firefox now works.
Thanks for listening!!
R
May 29, 2009 at 7:59 am
Thanks lot……….its also working properly in ubuntu 9.04
Hats off to provide such a good and simple tutorial
May 31, 2009 at 3:56 pm
I just installed the whole stuff, using the great tutorial you wrote, LAMP is now working on my side
.
Thanks for sharing the skills.
June 5, 2009 at 3:22 am
Rick,
I am having the same problem with firefox wanting to open file or save the php file. Can you tell me what did you do to fix it please.
Roger
June 9, 2009 at 10:41 am
Ya……….
Really great………
Instructions are extremely suitable & perfect.
I’d done job quickly & eaisly.
Thanxs a lot…………..
June 13, 2009 at 9:24 am
Just followed your walkthrough on Ubuntu 9.04 and it worked like a charm!
Many thanks!
June 13, 2009 at 8:09 pm
Hey! Thanks man. Your article was a great help. Do you have something similar for Ruby? Thanks anyways
June 18, 2009 at 10:46 am
OK, thanks for your tutorial. I’m Newbe and your experiment is usefull.
Thanks a lot
June 19, 2009 at 9:41 am
Thank you. This worked perfectly for me.
July 5, 2009 at 9:03 am
thanX…u help me very much from this
July 5, 2009 at 8:54 pm
[...] by Administrator on Jul.05, 2009, under How-To Installing Apache, PHP, MySQL and phpMyAdmin on Ubuntu 8.10 [...]
July 16, 2009 at 10:24 pm
To this list of innumerable thank yous, I add another one.
Thanks a lot.
July 18, 2009 at 6:17 pm
Thanks for the tip. It worked wonderfully.
August 13, 2009 at 2:58 pm
assumes tutorial… its works successfully…thanks
August 15, 2009 at 6:06 pm
[...] seguindo os passos do site http://ubuntuexperiment.wordpress.com/2008/11/10/installing-apache-php-mysql/ [...]
October 12, 2009 at 8:12 pm
[...] Visit link: Installing Apache, PHP, MySQL and phpMyAdmin on Ubuntu 8.10 « the ubuntu experiment [...]
October 15, 2009 at 2:30 pm
Perfect article. It helped me a lot!!!!
Thanks!!!!!!!!!!!!
October 16, 2009 at 3:59 pm
What an absolute star you are. I have been playing around with php now for some months and newly installed ubuntu on my desktop. This is such an easy guide to follow.
Thanks ever so much
October 23, 2009 at 8:21 am
Thanks a lot. I just installed Ubuntu 9.04 and installed LAMP on it. It works like a charm. Thanks again.
October 31, 2009 at 2:59 pm
Thank you very much for posting this article……..
October 31, 2009 at 4:20 pm
thanks for your article, its help me to install AMP in ubuntu
November 3, 2009 at 4:33 pm
Thank you Nass, you’re a star. I like you have been a dedicated follower of Windows but find myself inexplicably intreagued by the Ubuntu thing and the ease of the installs (anyone who has installed this same software on Windows will know what I mean.) So many thanks for the advice
November 11, 2009 at 2:24 pm
Hörrö du din jävla fittunge. Dedär mösskl installhelvetet funkar fan skit. Dra åt helvete, lögnar jävel
Det finns ett ord för personer som dig, ljugfittögakukjävlahirnegerskit.
Alla ni som s äger att han är bra kan fan brinnna, era judeslavsnegrer