Installing LAMP On Ubuntu For Newbies

In this guide, I will show you how to install a LAMP system. LAMP stands for Linux, Apache, MySQL, PHP. The guide is intended to help those who have very little knowledge of using Linux.

** UPDATE **

The tutorial below is for Ubuntu 11.x and 12.x. If you are seeking for a LAMP tutorial for the current Ubuntu version, then please use this guide:


Install Apache

To start off we will install Apache.

1. Open up the Terminal (Applications > Accessories > Terminal).

2. Copy/Paste the following line of code into Terminal and then press enter:

sudo apt-get install apache2

3. The Terminal will then ask you for you're password, type it and then press enter.


Testing Apache

To make sure everything installed correctly we will now test Apache to ensure it is working properly.

1. Open up any web browser and then enter the following into the web address:


You should see a folder entitled apache2-default/. Open it and you will see a message saying "It works!" , congrats to you!


Install PHP

In this part we will install PHP 5.

Step 1. Again open up the Terminal (Applications > Accessories > Terminal).

Step 2. Copy/Paste the following line into Terminal and press enter:

sudo apt-get install php5 libapache2-mod-php5

Step 3. In order for PHP to work and be compatible with Apache we must restart it. Type the following code in Terminal to do this:

sudo /etc/init.d/apache2 restart


Test PHP

To ensure there are no issues with PHP let's give it a quick test run.

Step 1. In the terminal copy/paste the following line:

sudo gedit /var/www/testphp.php

This will open up a file called phptest.php.

Step 2. Copy/Paste this line into the phptest file:

<?php phpinfo(); ?>

Step 3. Save and close the file.

Step 4. Now open you're web browser and type the following into the web address:


The page should look like this:

Test PHP Page

Congrats you have now installed both Apache and PHP!


Install MySQL

To finish this guide up we will install MySQL. (Note - Out of Apache and PHP, MySQL is the most difficult to set up. I will provide some great resources for anyone having trouble at the end of this guide.)

Step 1. Once again open up the amazing Terminal and then copy/paste this line:

sudo apt-get install mysql-server

Step 2 (optional). In order for other computers on your network to view the server you have created, you must first edit the "Bind Address". Begin by opening up Terminal to edit the my.cnf file.

gksudo gedit /etc/mysql/my.cnf

Change the line

bind-address =

And change the to your IP address.

Step 3. This is where things may start to get tricky. Begin by typing the following into Terminal:

mysql -u root

Following that copy/paste this line:

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

(Make sure to change yourpassword to a password of your choice.)

Step 4. We are now going to install a program called phpMyAdmin which is an easy tool to edit your databases. Copy/paste the following line into Terminal:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file entitled php.ini. To open it type the following:

gksudo gedit /etc/php5/apache2/php.ini

Now we are going to have to uncomment the following line by taking out the semicolon (;).

Change this line:


To look like this:

Now just restart Apache and you are all set!

sudo /etc/init.d/apache2 restart


The End

Quick note to anyone who encountered problems with setting up the MySQL password, please refer to this page: MysqlPasswordReset

I applaud everyone who has taken the time to read this guide. This guide is also my first ever so I would love to hear back from the public on what you guys think! Just don't be too harsh. ;)

If you have questions about installing any part of LAMP just drop them in the comment box and I will do my best to help you out.

Share this page:

Suggested articles

496 Comment(s)

Add comment


By: Rajat

Great work man. material really helped.

By: nguy

Great Help

By: Parag

Thank you, very good tutorial, now I have LAMP set up on Ubuntu 9.



By: Laurence

Great guides. Used it for Ubuntu 8.1 desktop.

 couple of slight differences:

1. It will auto ask you for a password for the mySQL database - so you dont need to manually enter the commands

2. the ";" section isnt needed - because it now starts as ""

 HOWEVER: if you want to use mysqli (<- see the "i" extension) commands you need to:

gksudo gedit /etc/php5/apache2/conf.d/mysql.ini

and add the line

 Restart the apache server and it will work


By: guru katre

hi above document is really very good. i really thank. i have installed apache php and mysql in my pc

thanks :)

By: Mike

While I realize the article was published quite a while ago, I just wanted to add that I also found this extremely helpful and I thank you for adding it. Wonderful job!

By: Anonymous

Great Tutorial....

By: harry


 I followed the above steps in installing lamp server but when I tried to connect to mySQL.. the below error occurs


ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

addition info:

apache works fine

php works fine

I have changed my bind address

I have changed php.ini file to get PHP to work with MySQL


plz help

By: muscle boy

Thanks for the very great guide.i almost finish all of your instructions but i encountered some problem on ubuntu 8.10 which may be related to get php work with mysql.

the line ; doesn't exist,i just found ;

after i read the comment above,i can find line  extension=mysql in /etc/php5/apache2/conf.d/mysql.ini

typing gksudo gedit/etc/php5/apache2/conf.d/mysql.ini into terminal will find line

great tutorial,thanks a lot.




Just went through and it worked wonderful.
As a small advice. Maybe you should explain why some things are changed and maybe what other options one has depending on the purpose.

Great tutorial!
Thanks! :)


I am running the 64bit version of Ubuntu 7.04 and I found that I could not log in with phpMyAdmin. It refused me with an error #1035. A little googling reveals that loading the mcrypt package fixes it.

sudo apt-get install php4-mcrypt


Now I'm in and running fine! 

By: sudarshan

It is so nice that you took time to write such an awesome exaustive tutorial by doing everything in command line. It saved a great deal of time

Thank you

By: Anonymous

I always thought there was a magical one liner to get LAMP up and running.

 Was it 

sudo tasksel install lamp-server


By: Joe

Great Tutorial,

 A few additions if you are hosting a site on this,

Enable Apache Rewrite = ># a2enmod rewrite

nano /etc/apache2/sites-available/default

<Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all


i followed your guide with my new installation of ubuntu server 7.04 (feisty) and everything worked exactly as you said.

one small correction in the part where you edit:  /etc/php5/apache2/php.ini

 it seems, they moved "" to /etc/php5/apache2/conf.d/mysql.ini so we dont really need to bother editing php.ini after all.

thanks for the guide, saved me the trouble of figuring out the correct sequence of packages to install 


    sudo apt-get install apache2 php5 mysql-server phpmyadmin

Worked for me. 


 Great article! Easy to follow. Now what?


Thanks for the comments everyone.

@ IronHide - Now just do whatever you want with your brand new installation!

@locutus_of_borg - I re-installed LAMP and it still seems to be in php.ini, but you are right it is also in mysql.ini. I am not sure it if makes a difference though.

@mihai331 - I think I might edit the guide to explain more the purpose of what people are doing. Like what they are downloading, and why they would edit this and that. Also maybe a few pictures for extra clarification.


First off, thanks a ton for the awesome how-to. My only question is:

Do I have to be connected to the internet to get all of this started? I ask because I plan to set this up on a separate machine & I haven't picked up a router/nat yet. So I just want to make sure if I need that in place for everything to work properly w/out having to re-do it again if I start w/out internet connectivity.


@DJ_Maiko - Nope you do not need an internet connection to get LAMP to work.

By: Phil

My first go with linux and it worked great hope it is all as easy as this now I am off to netbeans


Excelent How-to, very usefull, very simple and efficent. Thanks a lot.

By: ionoff

Don't follow this guide, just run

sudo tasksel install lamp-server



Hi Great howto - thanks! A newbie would not know to type 'exit' after step 3(MySQL section)to get to step 4. Cheers


Hi cargoship. I had problems, I'm afraid, and did not manage to get lamp operational. I've posted my questions on the forum, as requested by the admin. I'm new to Linux so I suspect I'm the problem, not your procedure.



one can also add the desktop GUI to the server installation by following this guide on Enjoy your new LAMP server! 


Thanks very much for the howto. i installed on Oct 5 and the php.ini you refered to near the end has no ; line to uncomment. Not able to log in using the root and password  set earlier but i haven't spent any time troubleshooting yet.


Thanks!  This worked very well, with one minor glitch for my particular case.  After installing mysql, I needed to start mysql with:

sudo /etc/init.d mysql start

Then everything else worked. 


First: Excellent work dude!

Second: I had to copy phpmyadmin into my document root directory to work http://localhost/phpmyadmin, with this command in shell:

sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin

# /usr/share/phpmyadmin/ is the directory where phpmyadmin installed
# /var/www/ is your document root directory

By: Hélio Évora

Thank you for this tutorial.

It's very good and it's help me to solve all my problems...

Hélio Évora

By: ZP

Thanks for the wonderful guide.

I also didn't need to edit php.ini for it was already edited but I couldn't restarting web server apache2.

it says: Unable to resolve host ... and  fails !

I'm totally a newbie and I'd appreciate it if you tell me if there is anything wrong.

Thanks in advance

By: Lagavulin

Thanks a lot, this was really helpful.  However, I encountered some problems on Ubuntu 7.04 which may be related to previous Apache installations, configurations and deinstallations.

 1.  Apache complained: "Could not reliably determine the server's fully qualified domain name, using for ServerName"

Solution:  Add a directive "ServerName myserver" to apache2.conf and add "    myserver" to /etc/hosts.

 2.  http://localhost did not work.

Solution:  Apache is listening on port 8081.  See ports.conf. 

 3.  Apache did not execute the php testscript but simply served the file.

Solution:  I had to activate the php module manually by creating a symbolic link:

$ cd /etc/apache2

$ sudo ln -s ../mods-available/php5.load mods-enabled/php5.load

By: Anonymous

Wonderful article. It helped me a lot! Thank you.

By: Anonymous

Everything worked perfectly fist time, thank you very much for a great tutorial.

By: jay

This actually worked for me. no hitch at all. Veru good tutorial. The problem is, when I accessed my www ( root folder )  folder i don't have permission to add, paste, delete or create folder. The ownership is on root. Is there a way I can modify this so I can add new files therein? Thanks

By: kyle

On the desktop, right-click, create launcher. Then application in terminal, then type in "sudo nautilus /var/www". Then just run the launcher from the desktop and you should be fine.

@Tutorial Writer

Worked great, thanks for the post :)

By: Bruno Silva

TOP 10


By: Sadiq

I am very thankful to this. I have installed lamp without any error.

By: Jonathan`

Straightforward and fast, an excellent guide for getting LAMP up quickly on *buntu. Many thanks and kudos!

By: Giovanni

very good guide, all done well!!!

By: JIm Lees

I'm new to Ubuntu. I've just installed 8.10 as experiment since I normally run PCLOS.

As with everything I've tried to do under Ubuntu, I've found nearly everything I've tried to do more complicated than it needs to be!

  Having said that-- I found your first effort to write a howto very clear and concise.

Thank you.


By: Lawal Adekunle

God i wish all guides were like this! I am so thankful for this, Its so easy and straight to the point. Thanks a Million. really.

By: Daf

Great Tutorial writing.

Easy to follow.

My problems are here:-

Option (2)INSTALLING MYSQL.... tell us how to find our IP address please!


mysql -u root


ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
bash: syntax error near unexpected token `('

Wonder whether you can help..?



By: cordlafond

Did you perhaps loose one of the ' marks when you changed the password?

By: Anonymous

a bit late?


[email protected]:/# mysql -uroot -p

 press enter and the shell will ask you for the password.

new mysql versions require the option -p (for password) when you login in.



By: Emil

When I follow your instruction on my Ubuntu Jaunty rootserver, I get this error message:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


any Ideas? is there a clearer tutorial anywhere?

By: Mihai

This really helped, i was used to windows xamp & wamp managers, having some files of their own and management ghizmos of their own.

I just set up my first Ubuntu Studio, (i have had previous linux installs, lurking quasi unused on my computer), now i permanently deleted windows and deffected from the ranks of windows users.

This guide was straight forward enough and simple enough to actually be done in 5 minutes.




By: Silvia

Muchisimas gracias por el tutorial...excelente

By: Hemant

It worked for me perfectly.. Thanks a lot

By: gearbox

Thx !

By: Brockley Steve


I also had the problem with " mysql -u root " as it had already prometed for a password when installing. mysql -u root -p got me in and "exit" got me out again.

Finaly came to a halt with "Couldn't find package phpmyadmin "

Now trying to fix repositories........

By: Anonymous

No trouble at all for this raw Linux newbie.  Thanks a bunch.


Wish there were more tutorials out there like yours... Awesome!

 In fact (I hope I'm allowed to post this part...) I was following your directions (but I was installing onto a fresh Kubuntu setup) and I had no problems.  Only difference (in case anyone uses KDE) was replacing which commands to run (SIMPLE, though):

  • Instead of typing gksudo I just typed sudo and
  • Instead of typing gedit I typed kate (although kwrite would have worked just as well...)

Either way, thanks VERY much for your help.


By: oscar

well just want to tell you that your tutorial works really great i tried it with ubuntu 8.10 intrepid, and i encounter no problems whatsover, thank you for taking the time to make such a great tutorial. thanks again.

By: Ken Nielson

Your how to guide for installing lamp on Ubuntu was great. Everything worked just like the instructions. The way it always should be.

 I did find that the password for mysql was automatically set in the script so I did not need to use the mysql command line to set the password.

 Great Job. Thanks

By: ushan

ur tutorial is great. but i hav a little prob with php.ini. actually i am new to ubuntu. in my php.ini the line was not like ";". it was like this ";". what should i do? please advice

By: stussy

Worked just fine!  Only had to add the servername.  Thanks mate!

By: ck

[sudo] password for ck:
sudo: nautilus/var/www: command not found
[email protected]:~/Desktop$





By: chepe263

There is a simply way


sudo nautilus, input password and go to /var/www


more easy can't be !

Works fine with ubuntu 9.04 (now i'm downloading mysql)+

sorry for my poor english


By: patv

I have not used Linux since 2001 and now I have a LAMP system running on my desktop.  Tutorial is good.

But what do I do now.  How do I start a web page for the world to see.

If anyone can point me to another great tutorial, thanks in advance.

Stay Cool.


By: frank

put any web page (a file built with html andending  with .html) in the directory '/var/www'

By: Jonathan

Great tutorial! Was able to install all without any issues.


By: mikkey

Hi I m configuring SIT, but i am facing some problems:

1) We couldn't find configuration defaults, this probably means your include_path is wrong. Your current include path is .:/php/includes:/var/www/sit/includes
SiT! Requires its libraries to be in the include path which is specified in your php.ini file, modify your php.ini and set the new include path to be .:/php/includes:/var/www/sit/includes:/opt/lampp/htdocs/xampp/sit/includes

2) DB connection problem

Configuration Problem: Could not find database connection information (, the php include path is probably wrong

How to create and connect to the data base.

Please Help

Thanks in advance

By: Steve

Great tutorial, worked through it ok with just one or two things which I was able to figure out myself (MySQL Password, and Selecting to install for Apache 2).

Perhaps it is time that you ran through the process again yourself  and made the appropriate changes.

Otherwise great job.

One thing which did come up at the end when I restarted Apache2 was the message

Could not reliably determine the server's fully qualified domain name using (IP Address) for ServerName.

Any pointers as to what is happening and how I can fix this if it's a real problem?


By: Anonymous

Good job. It helped a lot!


Thank you very much, it is very clear and help full article.


By: jgalapatt

The step by step instructions were very helpful. Thank You

By: Wouter

Dear Sir,

Happy to inform you your How-to works with Ubuntu 9.04.

A good and easy to follow how-to. Tanks a lot.



By: Anonymous

Very useful tutorial, thanks for writing it.

By: Anonymous


By: Jeremy

Thanks for the guide, I used it to manualy install LAMP on Ubuntu 9.04 Jaunty Server. If anyone is reading this and wants to install manualy as I have done simply follow the guide as written above replacing all references that contain

 sudo gedit <command here>


 gksudo gedit <command here>


 sudo pico <command here>

By: Bernald

Hey, this article has been great to me and I have really loved that straight to point idea.

 We are new users of UBUTU and very excited to be part of the family.



By: Anonymous

great and simple tutorial, does exactly what it does on the tin, worked fine and made me feel like I'm getting somewhere with this Linux jazz! Thanks for the help!

By: Felipe Silveira

great article!

By: Jeroen de Ruiter

Thanks for such an easy step by step tutorial. Installing LAMP this way was even easier than installing WAMP on my XP machine.

By: Kamal Nandan

very useful article..though had got stuck in between while using "mysql -u root", but made do with "mysql -p". Thanks a ton...:-)




By: Jiao.Zhang

Thanks for the clear tutorial, I had no trouble when installing LAMP in Ubuntu9.04 following the instructions.

By: Totte

Great guide, was really looking for a good one and just checked this out. Thanks a lot!

By: Jim

Thanks, this was great!  Worked on the latest Ubuntu.

By: Cata

Simple and at object. It was very helpfully for me.Thank you

By: Dinu

ya i installed successfully thanks man.but i was confused slightly in middle and in last.anyone i manage it. thanks a lot.

By: Kalpesh

Thank you very much. This is a great tutorial on installing LAMP on Ubuntu.

By: Alpha

Thanks, this LAMP instruction really help. Great help.

By: thameera

It was one of the best guides I've ever read! Works perfectly in Ubuntu 9.04. Thanks a lot! Good luck!

By: dinesh

thanks dear.this guide became v usefull to me.thanks a lot.

By: Unknown Hero

Thank you very much for this guide!


Works like a charm!

By: Micha

Great guide, thanks!

By: Anonymous

I was very new to the ubuntu and i was always afraid of using linux commands but after reading your steps to install LAMP on ubuntu, i tried installing it and i did it successfully. I can say that i cannnot find any thing better then the steps you have given to install LAMP on ubuntu. Thanks for such Precise and clean steps.

By: William

Excelent tutorial :)

It works on Ubuntu Netbook Remix.

By: Anonymous

Great guide!

Keep it up!


By: Alex(Kiev)

Thanks a lot!

It's very helpful tutorial!!


By: Ryan

That was the easiest setup that I have gone through. Now I just have to setup a page.


By: Akila

Thanks this is one of the simplest tutorial I found. Thank you very much. Worked on Ubuntu 9.04

By: notinterested

Followed the guide completely but as soon as i restart mysql will not start again unless reinstalled completely.


Whats the deal?

By: zackgigz

1st problem

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)


2nd problem

[Thu Jul 09 13:05:17 2009] [warn] NameVirtualHost *:0 has no VirtualHosts
 ... waiting [Thu Jul 09 13:05:19 2009] [warn] NameVirtualHost *:0 has no VirtualHosts
it is ok?

3rd problem

mysql> SET PASSWORD FOR [email protected]'localhost'=PASSWORD('abc123');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement


then i read explainaition in

but still i can't understand me


By: Jeff Long

I am not familiar with your third problem, but your first problem is that his tutorial does not include the specifying of the mysql password that you previously set.  So if that password was say "linuxrules" then you would run mysql with

 mysql -u root -p linuxrules

 I believe your second problem is no big deal, and just telling you you don't have any entries in the Virtual Host file.

 Hope that helps.


By: Jonathan Kramer

Your guide was an excellent source to walk me through what I thought would be a difficult exercise for this newbie!   I just used this guide to install AMP and PHPMYSQL on a new install of Ubuntu 9.0.4.

Many thanks.

Jonathan Kramer
Kramer Telecom Law Firm, PC
Los Angeles, CA

By: Bruce Edgar

These instructions are fantastic. You have a real knack for breaking complex instructions down to their basic form.



By: Sinan Saricinar

Best tutorial ever...

By: Ajay Singh

Thank you.

This worked perfectly on Mint 6 and I could install Apache, PHP, MySQL with phpMyAdmin.

During installation of MySQL, it asked to set root password. After setting root password MySQL password setup step was not required.

During installation of phpMyAdmin, it asked for default web server, and after selecting apache2, it configured phpMyAdmin.

Thanks again. 

By: Deepak

Thanks for this good clear post.  It made my install very straight forward.  I have one request though... are there any tests that could be added to confirm that the install is doing all the things it should be doing?



By: lostutopian

installing phpmyadmin requires a little more instruction to point the phpmyadmin folder from /var/www to /var/www/phpmyadmin

you would need to:

sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

I'm a newbie and i was trying to figure out what/where i went wrong with you instructions.

thanks by the way to the instructions above! :)

By: Anonymous

Nice one. Sorted.


BTW Life is easier when you use a password with MySQL (PHPMyAdmin doesn't like root user without passwords it seems)

By: ErikB

Great instructions, thanks. I also had to add the above.

By: golnaz

easy and helpful,thanks

By: Anonymous

This article is accurate and helpful. It is this type of articles that makes the Internet a worthy place to search for answers. Thanks!

By: Pieter den Toom

Worked like a charm, thanks

By: Brian UbuntuUser

Thanks for a great LAMP tutorial worked fine for me on Ubuntu 9.10

Setting up passwords where completed via the intall process so had to by-pass that point in your tutorial.


By: ronald schilperoort



Many thanks for the greate tutor you made how to setup a LAMP configuration in Ubuntu.

It helps me a lot to locally test Joomla packages


Thanks again


Best regards Ronald

By: Vikram TV

Thanks a lot.. I have been trying to configure my lamp server and succeeded now.. Nice explanation..



By: OFF732

I had that same problem and found out that I had not restarted apache. Once I... sudo /etc/init.d/apache2 restart it worked great

By: Nater

I had no trouble following this guide it was well written and very helpful.

By: Web design company

Thanks for the guide !

By: Jacques

minus the instruction on how to get phpmyadmin to work, this is A GREAT how-to! Thank you so much!

By: sam

Nice post ..very clear explanations... thanks man..


By: Ron

Great tutorial and lots of good tips in the posts.



By: singermaa

It's Better then i've seen.


thanks you 

I'd looking for just this one


Good luck to you for more

By: Ashish

Nice Tutorial, but please try considering need to execute this command below for changing phpMyadmin folder  to var/www

sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin




By: J Young

Thanks! This works great!

By: Anonymous

Thanks for the awesome tutorial, I come here all the time! :)

By: hema

that was reaaly help full thnq for tht

By: Anonymous

Thank you very much.It has been a very helpful article.


Superb Tutorial i have ever seen to install LAMP

Thank you dude

jus now i installed LAMP in my new ubuntu 9.10(Karmic Koala)

Installed finely except that restarting Apache 2 server

but atlast i edited Apche2.confg


vinopavit, what did you edit in the apache2.conf file?  I'm having the same problem restarting apache.

 Thanks in advance!

By: MIchael

I followed the install as noted and it was fine up to the mysql install. The install now asks for information not covered in the guide, overall the guide is good but it needs to be updated.


P.S. A nice little test Schema would be a nice touch to verify the mysql is working properly :)

By: Woodd

Had a few problems with  restarting the apache server: "

“Could not reliably determine the server’s fully qualified domain name, using for ServerName”

 But I found a solution to this issue here: 

Thanks again!

By: Claude

Instructions were very easy to follow. Anybody taking the time to thoroughly read the instructions will have no problem with the setup. Congrats on publishing these most helpful instructions. Great site!

By: bouchardpie

Thanks much.  This was a big help.

By: Kris

tU, Happy New Year and more guides like this one, plz. Very well done.

By: jellobelt

Thanks for this tutorial.  Everything is running smoothly now.  My only suggestion is to somehow improve search rank as I found this after three days of trolling.  Would have been great to find on day one. 


By: Benito Estrada

Despite minor details your guide really helps, solid gold!

Thanks 1,000! 


extremely useful. thanks

By: john


 Bro that was smoooth sailing for me!! Thanks a lot.

 For your first tutorial it was really good!


By: Anonymous

This was by far simple and easy to follow. thanks  you are the real boss.

By: joelotz

Great tutorial. I followed your instructions and sucessfully installed on Ubuntu 9.10

I used "sm1one" suggestion to add

ServerName localhost

to the httpd.conf file and it worked fine. The installation asked me for the MySQL password so I had no problems there also.

 Smooth installation - thanks!!

By: Anonymous

Thanks for the tutorial for installation...

Now I want to know how to run the php file in it?

Any one can guide me on that?

By: williambuell

Everything seemed to work like a charm!

Very clear instructions.

Now all I need to do is figure out how to get into mysql with some admin app.

My first try an any sort of installation was avg antivirus. I downloaded and installed the file, but I cannot figure out how to launch the app.

I will appreciate any tips on tutorials which will in crease my skills in installing and using apps in Ubuntu.

I suppose you could supplement this tutorial with a part 2 which then walks someone through the launching of these apps and creation of some simply application with table.


By: Emil

I have the same problem(using Ubuntu Jaunty 64bit).

No solution in sight?

and it has nothing to do with missing ' as there are no ' in mysql -uroot -p


Can anyone help?

By: J-man

My php.ini file doesn't have the ";extension..." line...

What should I do?

By: sofazen

I sorted this out just adding it (

Thanks to the autohor for this outstanding step by step guide !!!!

By: Anton Agestam

Thanks, phpMyAdmin refuses to work without that!

By: Ross

Hi - have just worked through this tutorial and apart from one place where I misread the request (setting up phpmyadmin), and the requirement to provide the IP address - everything went smoothly.  Am not sure yet however whether I have actually succeeded in installing all.  It would have been nice at the end to have had some kind of test to do which would have shown unarguably that it was done (plus reinforce my efforts!) 

I guess I will find out soon enought whether things have installed properly and will now work. If they haven't I'll be looking for help!!

Cheers  R

By: HungryTom

Outstanding job! Up and running in no time. Thanks!

 PHPMyAdmin did not work until the following was added to /etc/apache2/apache2.conf :

Include /etc/phpmyadmin/apache.conf

So thanks to the guy who posted that one too :)


By: sm1one

To fix that problem, you need to edit the httpd.conf file. Open the terminal and type,

sudo gedit /etc/apache2/httpd.conf

Now, simply add the follwing line to the httpd.conf file.

ServerName localhost

Save the file and exit from gEdit.

Finally restart the server.

sudo /etc/init.d/apache2 restart

By: StigMcSobol

Hard work, but a well paced guide.

Thanks for making the first effort.


By: dandellion

Great tutorial. Thanks a lot! Just one thing... please move the note about passwords from the end of the tutorial to the place where password should be changed ;)


By: Evgeny Ustimenko

[email protected]:~/Documents/jmonitor$ sudo /etc/init.d/apache2 restart

* Restarting web server apache2

apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName ...

waiting apache2:

Could not reliably determine the server's fully qualified domain name, using for ServerName [ OK ]

Hello, I have a problem.

I think that it isn't clear... What I should do?


P.S.: I have an Ubuntu 9.10

By: marsty5

the best guide i've ever read!! Thank you sooo much!

By: Anonymous

This is the quickest that I've ever setup a LAMP server thanks to your guide. You da man! :)

By: Anonymous

Excellent overview. Helped me a lot. However, I think you may have overlooked the need to add the following to apache2.config:

Include /etc/phpmyadmin/apache.conf

By: tskrich

Fabulous instructions!!!!

 I followed each instruction and was able to successfully setup this correctly for the first time.


By: Joseph

Thank you for the tutorial.  I have set up LAMP before, this is about as easy as I have ever had it. 

By: Ivaylo

The simplest way I know of installing a LAMP server in Ubuntu or Debian is to let Tasksel do it:

sudo tasksel

- select 'LAMP Server' and then follow the prompts.  You can make adjustments to the configuration as needed after the install but you will have a working LAMP server right out of the box!


By: Kavi

This tutorial has really been of great help to me. It was straight and forward for a newbie in Ubuntu.

 Thanks again.

By: Anonymous

This is a tutorial, how tutorials should be!!!

By: mik047

while testing for php, the browser asks me to download that file...

 Is my installation for php is correct?

 It does not show the content shown in your tutorial... It directly asks me to download the file... :(

By: Steffen

Thanks a lot for this tutorial, I followed it and it did exactly what I expected it to do (installing LAMP on Ubuntu 9.04 Desktop on a G4 Apple Mac).



By: Pooja

Thanks a lot !!!!!!!!!!

It is the simplest and easiest tutorial I've ever a terrific help for the beginners....

thanx again n keep helping us!!

By: afal


an excellent article. everything worked well all the way through.

I have encountered one last problem, on the last step of restarting apache

after i typed      sudo /etc/init.d/apache2 restart

 i get the following error:

apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName

 i have changed that ip address to my computer's ip address as shown in your article

many thanks

By: Anonymous

Thank you so much.  This makes installing LAMP easy, especially since I am fairly new to linux.  I am no longer a windows user, thank god, and this takes minutes compared to hours trying to set up on a windows box.  There were a few extra steps, but most of it was prompt based.  But I'm up and running and excited to learn VIM.

By: Anonymous

Thanks for the guide, It has been very usefull to me. Thinks like this guide and people like you make great Internet!

By: Chris P

Thank you for the simple to follow article.  I was able to get a web server, database, and admin tools up and running in under an hour.  Amazing!

By: Dave

Had to add LAMP via a remote system and it worked just fine with a few differences:

1) MySQL version  5.1.37-1ubuntu5 prompted for the root password thus eliminating the tricky part.

2) Didn't find the  ;  entry in php.ini, so I didn't make that change and as of yet, I am not experiencing any issues.

 Very helpful post



By: bryan

Great job!  This is the first one I found that worked!!

By: Uly Marquez

 quick and easy kungfu for ubuntu.. thank you

By: deeba

excellent job.thank u....

By: i hate mondays

well,thx helped me a lot...

 i had project to make  and it was kind of impossible to make under windows.and now ,after rethinking some stuff,i would love to permanently change my os to linux... 

 u should make more tutorials for newbs...there are a lot of us out here:))

By: Mark

I followed your instructions and it all worked perfectly first time.  The only difference was that the MySQL and PHPMyAdmin both prompted for passwords and usernames etc so there was no need to tinker with configuration files.

 Nicely presented HowTo.

By: Sree


By: sunil

hi sir

 after completion of Lamp installation on my system and when i am trying to open the following url i.e http://localhost/phpmyadmin it says phpmyadmin was not found on this server.So please do reply


Thanks and Regards

Sunil Jadhav 

By: johny

Dont worry, your tutor was really helpful and easy to follow, 5 stars!!! ;-)

By: Joel

Had installed all the packages but was stuck with trying to figure out how to run the test scripts i was writing for the tutorials. All of them just said to post it to the web server document root and while i knew what that was, dint know where the local root was for apache! Anyway thanks again... i was getting desperate enough to consider just wamp and learning php.

By: Bilal Malik

It was great help.



By: Anonymous

Needed a quick and dirty way of getting a LAMP environment going (I haven't touched *nix in ages) and your guide was a Godsend!


Nice job - thank you!  :)

By: texas hold em

Great blog, and the author is surely cool! Pretty good, man!

By: A. Self

I am new to Linux and definitely appreciate the easy walk-through on this process. Thanks!

By: Juan Alejandro Piraquive

Hi I installed the lamp on my ubuntu server and everyhitng is almost perfect just one problem.


I finished all but when i try to get into my /ipaddress/phpmydmin it is not working yet.


Can you tell me pleae how i can browse in my phpmyadmin page.



Thanks a lot.

By: Da Vidis

Many thanks, the LAMP installation was smooth

By: kostaslivs


By: James

This was much easier than the xampp on Ubuntu install I did a couple months ago, which involved searching to solve "after install" problems. But your nice simple straight forward guide?... No problems at all. Everything works. Beauty!

And now I have a bonafide real deal lamp install :) - Sweeeeet!

By: kingkeamo

great tutorial thank you


By: Lippy

Thanks for the guide.  Made installing everything easy for a course I am taking that requires I create a database and front end website in php for it.

By: Anonymous

Many thanks for your Lamp Install guide. As a newbie I found it very easy to follow. It worked perfectly without a hitch.

By: outstanding!



This was perfect for a newbie like me.  Please, write more guides just like this.

By: Ravi Veliyat

I have used php-mysql in windows already...

but i was totally unknown to Linux or Ubuntu..

then the guidelines provided by you helped me..

i found it very easy to install php in ubuntu..


Thanx man..!

By: Anonymous

Simply thank you!

By: anand ganti

good great post


By: milamoto

Your tutorial is excellent.


By: Anonymous

this was quick and easy not hard at all the pasword thing throw me off cause it just pushed me into making a password i didnt need to go through the password step but not hard at all

By: Chris

Great post...

You said it was newbies...that wasn't the case since my installations took some turns that newbies might not logically put 1 and 1 together, ya know?

But you surely made it easy for me... Thanks again!

By: jester

you also need to include the following line in /etc/apache2/apache2.conf

first type the following command to open up this file:
gksudo gedit /etc/apache2/apache2.conf

Add the following line of code inside apache2.conf:
Include /etc/phpmyadmin/apache.conf

 save it and restart apache:

sudo /etc/init.d/apache2 restart

By: Anonymous

Thanks dude, its really help me.out to phpmyadmin work correctly..

By: Mostafa

When trying to save the php test file to /var/www i get the "you don't have permission to save file here" error. should i change the permission of the folder or not? Actually i'm a noob in ubuntu and i read somewhere that it is better to not change the permission of the var folder. so what shall i do now?

By: Anonymous

Did you use

sudo gedit /var/www/testphp.php

for editing the file?

The "sudo" is important to temporarily get root privileges.


In phpMyAdmin I get "No Privileges" under the area to create a new database.

 I get this on my account (MPG) and root...

By: ??

Thank you very much. This guice is useful, just for the new PHPer.

By: Anonymous

great instructions ! -- thanks

By: Arpan

Thanks man!

I installed everything very smoothly with your help.

Can you please tell me a good manual for mysql.

 Thanks in advance for your help

By: Artem

Many Many Many big THANKS!!!

I'm newbie to this and it not just helped, I installed everything almost w/o any troublems... Well one of the comments helped me with one problem but it was nothing big.

Installed it, now to learn how to use all this crap! LOL


By: Andiluvslinux

Hey Cargoship,

Your instructions were absolutely brilliant for me as a newbie in linux. Love the easy understandable instruction, though I wasn't quiet sure about one thing. I had to change the bind-address to my ip. Does that mean I have to change it to the IP address to the one assigned by my LAN or are you refering with that to the WAN address? As I said, these are my first steps in web-server doings. But otherwise awesome site ! Well done !

 regards andiluvslinux 

By: Dazza

Nice guide.  Brief but all the right info in the right places.



By: Cyndi

Awesome newbie instruction.  Thanks!!

By: Anonymous

This was unbelievably helpful. THANKS

By: Anonymous

I really appreciate this how-to!

I'm building a website for a club at school, and I needed a LAMP server to create it on. I've looked at several tutorials, and this was the only one that even steered me anywhere near the right direction. Thanks to this, I can finally get to work on the site!

By: Mykell

But one more question about phpmyadmin:

 I got it to the point where http://localhost/phpmyadmin says 403 Forbidden. Any suggestions?

 (If it's relevant, I'm using Ubuntu Hardy Heron, and my webpages are in /usr/local/apache/htdocs)

By: Anonymous

Thanks, that was painless.

By: pankaj

thank you..

you made it easy to configure.

thanx a lot

By: mah!

thank you for your guide given... i've learned so many things... thank you again...

By: Anonymous

Thank you so much for providing this excellent tutorial on LAMP configuration

By: jeremy

a lot

By: JimNYC

I didn't realize how relatively painless this could be on ubuntu. my thanks

By: Anonymous

how i uninstall all that i installed.

everything was woking but after a restart i tried to change data base password now i get error in phpMyAdmin


#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

so it thinking just unstall the whole thing and try again.

By: Wasfi

I decided to cut off microsoft and all it's products and was really stuck with using mysql on ubuntu but u came to the rescue .. God bless you

By: Stretch

Great Guide, very simple and to the point.


Hello there

   Instruction given for installing LAMP is very useful for beginners. Saved time and my health by providing simple step by step procedure. Great work. Thankyou so much for posting.

By: Karira

Thank you

I'm new user  

By: Tharindu

Great work buddy Really useful for me each time I'm upgrading my system


By: v twom

Excellent! I was able to set it up in no time. Many Thanks!

By: Hamed Rajabi Varamini

Your guide was so easy & helpful, just please add to them MysqlPasswordReset in details. Thank you!

By: Jesse Andersson

This is by far the best, most effective and friendly and easy to use guide I have ever read or used. I read the whole thing. It was so good and rich with usefulness that I didn't want to skim through it, I wanted to savor it. If only the endless man pages and example scripts and online documentation I went through could have been half as perfect and helpful. I am extremely impressed and grateful. If I wasn't already in a committed relationship I would ask you to marry me :) Thanks again. If you ever need anything, like my first born or what not, just say the word. Wow, I mean, seriously, please do more. If you don't mind. Maybe configuring drupal, or cake_PHP (I don't know if I'm even into cake...if you do more guides do what ever you like. I'm sure it will be great and I will find it useful no matter what the subject matter.) You know what? For all I know, you may have done lots more already. I'm going to look. But not while I'm writing this. So, see you around, or you handiwork at least, I hope.

By: Anas

Thanx buddy i'm writing this without even completing my installation of mysql.


By: Hummad

Thanks a lot for your details help and assistance. Worked very well.

By: david owen

excellent tutorial, simple, valid, easy to follow.

 I seem to recall there was a way to install all the components in one go, as "lamp" but I was unable to find a reference for the apt-get install command to do that.

By: D'

There is a way from the synaptic package manager that allows you to install the lamp server as follows:

open synaptic > edit > Mark package by task > on the new windows scroll down to "LAMP Server" and apply.

By: vipul

hats off to you sir.. very helping guide..

By: greg

Hi, I found your tutorial to be very clear and helpful. However, I believe it is now dated. I followed your directions to a T, I have Ubuntu Lucid Lynx 10.04 and upon installing mysql a semi graphical interface popped up asking for the root password. The same type of graphical interface happened with phpmyadmin when I was installing that as well. I am unable to view phpmyadmin at http://localhost/phpmyadmin/. I apologize, I am very new to linux/ubuntu but I definitely enjoyed your guide up until I encountered discrepancies with the tutorial.

By: Daniel

Everything I was looking for and nothing more, everything worked within minutes on Ubuntu 10.04. Thanks!

By: Omkar Khair

An easy drive thru, for Ubuntu newbies. Thanks, and keep such posts coming :)

By: bakry salih

Thanks!!! clear and useful tutorial. it woked with no problems in ubuntu 10.4.

By: Anonymous

very clear and simple tut.

it worked perfectly.

By: Yene

to the point love it

By: Anonymous

Great tutorial.

By: Raju Aryan

This is the simplest tutorial i ever met on the internet about installing LAMP. Believe me users it's the gud one.


One more thing don't forget to run this command after installing phpmyadmin

sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin

otherwise u will get a 404 not found error. Actually this command let the browser know the phpmyadmin folder to be in var folder, thought not actually. just link that is much fine..have great development guys.take care.

raju aryan

By: Anonymous

Hei All,

Raju's final "ln" command is crucial.

Ubuntu 10.04 usually by default installs LAMP already

Was scratching me head where to invoke phpmyadmin..


By: beruh

Really perfect guide; everything worked just as described. But this phpmyadmin issue should be included in the initial tutorial, just to make it more perfect. Regardless, thanks a lot and keep it up!

By: Sandip karande

I added below lines in apache.conf, file 

# Include phpmyadmin configuration
Include /etc/phpmyadmin/apache.conf

# Remove the useless apache warning while startup


404 error fixed.. now I can access http://localhost/phpmyadmin


Thank U.

By: shiva shampoo

Thank you so much for the great instructions. Everything is working now :)

By: Kantha

Thanks for the information.

By: Anonymous

Fantastic! Thanx a lot!

By: Anonymous

You should also add there may be a misspelling in the php.ini file:

Initially it shows:

But it should be corrected to show:


I also added another line :


Thanks for the tutorial!

By: Angel A. Moncada

I thank you for all your help, you did a great job for those of us that have no experience with LAMP servers. this was great. Thank you again in Jesus Name


Linear, clear and simple! You did an excellent job. You are fine man with great karma. Bravo. Laurel garland and glory.

By: Anonymous

Thanks man! You're the best!!

 was really helpful.

 just one thing: in the php.ini, it seems like the '' changed to '' for some reason O_o

By: Steve Webb

This is an excellent help page and guide.  Thank you.

Given PHP in your instructions does not include PHP with GD support (security issues so I am told) I was wondering if you could give the user the option to install PHP with GD support with the command line:

sudo apt-get install php5-gd

Which ever way, thanks for the excellent support.


By: Minez

Nice info and run perfectly....!! thanks....

By: Matt

Good tutorial. I want to note that changing the bind address is a rather terrible idea. MySQL should only be available from the local machine. There is generally no need to access if from other hosts, and it is a bad idea to make this change without addressing the security concerns.

By: Anonymous


 The best and simplest post. Works perfect!!! Always find working in linux better than windows. LAMP is yet another instance 2 prove it :)


By: Ruwan Wickramarachchi

This is really valuable post on installing and configuring LAMP on ubuntu environment.I would like to add one more thing that i have faced in my ubuntu 10.04 installation(also on 9.10).

when i was trying to restart apache server soon after  i installed it i got the following error:

* Restarting web server apache2                                                

apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName

this might be happened due to missing statement in your httpd.conf file. (default configuration file for apache server)

this can be solved as follows =>

1) open your httpd.conf file :

sudo gedit /etc/apache2/httpd.conf

2) then insert this entry into your httpd.conf file and save it.

ServerName localhost

3) restart apache server :

sudo /etc/init.d/apache2 restart

I hope this might be helpful to those who have this problem.

Again thanks a lot for these instructions on LAMP installation


Ruwan Wickramarachchi.

By: jesse


  I do not know if this is the case, but you might have gotten the error you had because you were using the IP address ""  That is not the "loop-back" address, the correct IP address for working on "localhost" is "". I believe the reason that editing your config file worked was because the "localhost" setting uses as its IP address.

  As the expression goes, "the devil is in the details".  Hopefully this will also help any others who might have had an issue like this.



By: JB

Excellent guide for newbies! Followed instructions as mentioned and voila... its working! Thanks a lot

By: BentFranklin

Very good, thank you!  Also great comments, people!  Reading the latest 50 or so really helped.

By: jetti


1. if the command not works mysql -u root just use this one mysql -u root -p

 2. similarlly for sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin use sudo apt-get install libapache2-mod-auth-mysql php5-mysql

By: steven

this is good advice.  post should be updated

By: Arvind Kumar Chaubey


Really it is a very good helping guide for newbie of Lamp.

by using this i did my full installation in ubuntu.

once again  a lot of thanks for writing this article. and hoping the same for others   . Please keep it up.


By: Anonymous

This is a very good tutorial but i failed to find ';' in the php.ini file instead i found ';' and changed it to by adding 'y'.

By: Cid Visious

The name is

just take out the ; infront of to make it look like this

then restart the server. 

By: tototo

Genial, Genius............

Worksssssssssssssssssssssssssssssssssssssssssss Great!


By: Anonymous

i am a newbie and your TUT help me to enjoy the Ubuntu 10.04. now i want to now that how can i start the apache sever automatically? i have created a luncher in my desktop and set this command: sudo /etc/init.d/apache2 start i don't know how can i make it all automatically. Best Regards, Mohammad

By: Jashley6369

Thanks for taking the time to write your article on installing lamp. I'm new to Ubuntu and know next to nothing about it. Your article helped me walk through the process with ease.

By: Varghese

Most possibly the simplest Howto.....Thanks a lot.

By: Sean

Seriously...awesome tutorial, thank you very much! I am a complete Linux newbie and I am now up and running with LAMP. 

By: Anonymous

Excellent.. thank you

By: newuser

Thanks. followed the guide to step 3 w/o any problems, but at step 3 I get the following message in the terminal:       ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)



By: Anonymous

I got the same, but realized it was because I already set up the root user and password on install. Just use

>mysql u- root -p

to get in and set up any other users for your new database.


By: Anonymous

thanx man.... it is great....

By: Ricardo

This is an excellent working guide. I installed on an Ubuntu 10. This is what users look for. Congratulations and thank you.


By: GP Das

The tutorial is excellent. I would like to install PHP5 with FTP and Socket. Pl tell me the command to do this. Thanks in advance.

By: Alvaro

Great Tutorial! More to come I hope? Thanks a lot.

By: Anonymous

This is a really well written tutorial I would like to see it go just a little bit farther and explain how to get a page set up that says something more than "it works".



By: Anonymous

Thank you for this great article!

By: Juraj

It works, thanks!

By: Anonymous

Thanks! It was a great help in getting LAMP installed on my ubuntu machine.. 

By: Asfand

Thanks, gr8 and on the target work..

By: Dr. Robert F. Szalapski

Thanks for taking the time to write this tutorial.  I just installed Ubuntu 10.04 -- my first new Linux since Slackware.  I found a few of the details were slightly different from your post, but it got the job done painlessly.


By: Anonymous

it's just great!!!

i'm new to ubuntu and this tutorial helpt me a lot!

just btw: if u install the latest mysql you can set the password at installation

By: Anonymous

Thanks a lot! It works perfectly! I tried to make it work on Windows for forever but it never worked, now on Linux with your tutorial I tried it for the first time and it instantly worked! Thank you!

By: B-rad

Wow finally somebody that knows what they are doing but is clear and concise. I literally have visited like 10-20 other sites trying to get this working and they all have gotten me confused or haven't been thorough and complete.


Keep it up.

By: anshul

this is an excellent tutorial i found it very easy. Just remember to use mysql -u root -p if u have used a password for sql root. thanks

By: Anonymous

Installations are perfect . Php runs with apache2 web server but Mysql is constantly giving access denied .How to get Mysqlworking as a database and php is also unable to connect to database .

By: gholton

I tried a few other help me pages for LAMP. I ended up blowing up my system twice and trying again. Then I found your document and it worked like a breeze.

The "" really needing to be "" should be added but luckily a fellow poster had it covered.

Again excellent assist here. Thanks!

By: Anonymous

This is an amazingly accurate step by step tutorial.  It was very clear and accurate!!  I just follow the instructions here and everything worked fine (apache and php).  During the install, I was prompted with few additional y/n prompts and different prompts for passwords not mentioned in the tutorial.  But I am very familiar with WAMP (Windows rather than Linux) setup, so slight differences didn't throw me off though.

 I am a bit confused about the reference to "" though.  My php.ini file contains that, but one of the comments says it should be "". ???

 You have a talent for this, please keep doing it!

By: Web design for Holiday Homes

This is an excellent tutorial. I totally messed up my Ubuntu 9.04 installation by getting it all wrong and I can see where I went wrong now. I now have a fresh clean install of 10.04 and the correct way of installing LAMP. Fantastic...thank you.


By: Beppe

Thanks a lot.
After been wasting a lot of my time on windows platforms I've migrated on Ubuntu, especially for production environments.


Greate work: clear and complete.

Thanks a lot.

Rafael Marangoni

BRLink Servidor Linux Team

By: Alan

Fantastic guide, really well written, informative and useful. Bookmarked for future builds :D

By: GoodSandlap

You, in a single tutorial, have enabled me to finally make the transition overnight. Going to a real server platform has always been an overwhelming nemesis that I have deferred due to my lack of know-how and intelligence. I am now migrating as we speak to Ubuntu.


I thank you

I thank you

I thank you!



By: Axel van Moorsel

After 3 years it still can be used. I miss only 2 little things which would make it complete for the real newbies.

  1. How to exit the MySql Shell (by typing 'exit' or 'quit').
  2. How to start PhpMyAdmin (http://localhost/phpmyadmin), although you could argue that this belongs in a PhpMytAdmin tutorial.
Nevertheless: great article.

By: Orijit


I installed ubuntu one today as a plan to shift from windows to a linux system for my development purpose and was looking to setup AMP on it.

 I can safely tell you that the article is neat. Serves its purpose. Easy to understand. keep up the good work and keep me posted.

thanks and regards (no hard words here ;)


By: rudy

2 :thumbsup:

By: Anonymous


 when i type it in my browser i dont get the page which you said. Can you please help me.

By: nitai

excellent guide.

Thank you.

By: Jason F. Grissom


Great how-to!

 As of 10.04 mysql.ini can be found at "/etc/php5/apache2/conf.d/mysql.ini".

Thanks for saving me so much time!

By: George Sedlak

New to Ubuntu and after trying other ways to load php/apache just gave up. Your tutorial took 2 minutes and everything is up and running, bless you, well done.




By: Anonymous

Really useful tutorial. Thanks very much!

By: Akash Panwar

The tutorial is just perfect for the needs and is too simple for understanding.

Thanks alot.

By: neo_aryan

i tried to follow every step but seems to be prob somewhere.. while installing apache installation of 'start' command failed don know y n so wen i m trying to configure it with sql and php i need to restart apache its not starting but giving ab error msg.. pls somebody help here is the error msg * Restarting web server apache2 (98)Address already in use: make_sock: could not bind to address no listening sockets available, shutting down Unable to open logs Action 'start' failed. The Apache error log may have more information.

By: Gulshan

Thanks a lot !!

I am new with LAMP server and It is  the shortest and easiest way to install and configure LAMP.




Thanks a lot once again


By: Caz_blue

Thanks for the brilliant tutorial, I would not have gotten this installed without it.


just a small note, step 3 was not needed in the version of Ubuntu I'm using ( I think it's maverick meerkat?) there was a prompt to get through step three that popped up at the end of step two.


After all steps where done (successfully) the landing page was throwing an error, this was needed to fix it.


gksudo gedit /etc/apache2/apache2.conf

Add the following line of code inside apache2.conf:
Include /etc/phpmyadmin/apache.conf


from this website


thanks again, would not be looking at some cool databases without you!

By: Shredder

Good job.

By: Misoooo

very helpfull, thanks

By: Anand

Perfect...... Hats off to you

By: Anonymous

Wonderful and easy to follow. Thanks!

By: Anonymous

superbly easy setup instructions. Worked exactly the way you say.

 Thanks a bunch!


By: Mike

Thanks, It is really very easy to set up LAMP by using this guide!

By: Jörg

Very, very helpful.

Thanks a lot!

I only had to find the information regarding to create a symlink otherwise:

sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

Then it worked perfect.

By: Philip John

I did this, which got rid of the 404 for http://localhost/phpmyadmin but I now have a 403 Forbidden in it's place. Any ideas?

By: jarcmaster

 Those with the GKSUDO command  simply replace this line:

gksudo gedit ....

 with this one: sudo gedit ....




By: Anonymous

this works great.  thank you so much.  write more guides :)

By: rsgracey

Wonderful instructions. Followed them with no difficulties whatsoever. One question: The date on this is 2007. Does it retrieve all the latest versions, or do I have to worry about that now?

By: Joema

I am Joe from China, Beijing.Thanks for your guide! its great!!! I am new to LAMP. I wish to know you. You can be my teacher.

By: Kristofer

Great walk-through, but I got stuck in the end.

 Where I'm supposed to remove the semicolon.. Can't seem to find that special line ; ....

 Then when I try to restart Apache, nothing happens.

Thanks in advance! 

By: Bitz

Thank you SO much... I'm a new user....and had some issues figuring this out...... gone through many forums and none helped.... until I got to yours!

 Once again  THANK YOU!!!!!!!!

By: shabeer

thanq dear , am also a new user and am very happy now

By: Anonymous

thank you thank you thank you, what has taken me hours just took minutes you should be a tech writer way better than UBUNTU docs


By: Val Ian Enriquez

Thanks for the steps! :)


I am looking for a guide how to install a LAMP.. I spend how many hours just to look for the right site...that's why I'm very thankful that I've found this one!.. thank you... may our GOD blesses you in all aspects of your light.... GBU..

By: Willy

This is an awesome guide; good work, I would like know about security and maybe how to link my data base with freeradius, and to a login portal page to authenticate wi-fi users.. would you happen to have a guide that you would like to share...

By: Frostraver

Very good guide! Thank you!

By: Jorge Biquez

works like a charm!. Great !

By: Anonymous

Work Great! Thanks!

By: bcow

Excellent guide! Thank you for taking the time to make it!


recently i switched over to linux mint 10 julia and am facing lot of problem with LAMP INSTALLATION.thati followed up the instructions given in the link
and followed each step as mentioned but i skipped the following section
-----------------------------------------Step 2 (optional). In order for other computers on your network to view the server you have created, you must first edit the "Bind Address". Begin by opening up Terminal to edit the my.cnf file.

gksudo gedit /etc/mysql/my.cnf

Change the line

bind-address =

And change the to your IP address. -----------------------------------------------
as i am working only in my laptop computer and i don't have ip too;

DIALOGUE BOX ASKED ME IF I WANTED TO SET UP A DATABASE NAMED some conf.....(i don't remember clearly)
which i said no to;;as i d installed my sql earlier itself;;

it showed a couple of dialogue boxes asking to enter your password-which i did;;then
the rest of commands;;showed the following errors in the terminal

COMMAND-mysql -u root
ERROR-ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

COMMAND:mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
ERROR:mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

now that i have restartted the server and server is running;;;
it shows the proper:IT WORKS message for::::http://localhost/

and it does show the proper configuration for

but for http://localhost/phpmyadmin

its showing
----Not Found

The requested URL /phpmyadmin was not found on this server.
Apache/2.2.16 (Ubuntu) Server at localhost Port 80----------


By: Gosmo

You have to follow the next instructions:

To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf, first type the following command to open up this file:
gksudo gedit /etc/apache2/apache2.conf

Add the following line of code inside apache2.conf:
Include /etc/phpmyadmin/apache.conf

Now restart Apache:
sudo /etc/init.d/apache2 restart

By: t0m3kk

Man, 10x for your post... I had the same problem but now the problem is solved and everything looks fine :)



By: Anonymous

Thanks a million... never knew how easy it was, thanks.

By: Dawiss

Thanks, had the same problem.

By: Bison

This should be added to the guide, I wouldn't have found out about it if I didn't check the comments section.

By: Anonymous

brilliant! this was the only thing missing from the above tutorial, thanks!

By: Abin V Paul

This was a great help

By: walker

well, i had the same problem and, i solved it with:

use the command like this:

 mysql -u root -p

 after that you have to type your password, that is already exist if you add one before.

its worked to me fine. 

By: David

From fresh ubuntu installation to running phpmyadmin in about 10 minutes!


By: Anonymous

This guide was invaluable, my mother in law sponsors a student where I live, and the student needs a machine as she can't afford one*. I have resurrected a 7 year old laptop with XUbuntu into a reasonably decent dev environment, so your altruism has helped people helping others, good karma :-).

Went as smoothly as ice, I'm a .net dev by day and  I love Linux, but my job keeps me pretty tied to MS operating systems. I only use Linux under VMs to keep my hand in. When my wife buys herself a new lappie, I have plans for the old one :evil grin:

* This is why I've remained anonymous.

By: Anonymous

thanks a lot !!!

By: Shammancer

This guide is right at the point and tells you exactly what you need to do. Keep up the good work. 

By: Arun Prasad

It was very helpful. Thanks a lot for this wonderful information. You made my day. :)

By: Ges Scott

Excellent! Thank you so much. You're tutorial is straightforward and so easy to follow. After quite a number of years using WAMP on windows I migrated to Linux using Ubuntu. I was very concerned about using/configuring my development environment. I had searched around for a way to use LAMP. I found you! Everything was/is up and running within half hour just by pasting your commands.

Once again thank you very much. More tutorials like this from you please!

Ges Scott


By: dexter

wat a site !!!!!!


thnx a lot

By: Anonymous

neat elegant. very well done indeed!

By: Pramod

very easy yet very useful thanks a lot :)

By: Goga

Great job! Very easy to follow, and straight to the point! Thanks!

By: tiwigi

thank you, it was totally no pain ;) (in ubuntu 11.04 no need for last steps with mysql extension ... anyway works like a charm)

By: Madhawa

Very good post. It worked for me. Thank you.

By: Anonymous

Great walk-through, works great!


By: kuberprok


By: jonathan young

just wanted to say this is one of the best, most concise and easy to follow guides for doing something incredibly complex, kudos to you folks!  thank you!!!

By: Anonymous

wow, just wow. amazing!!!!!!!!!!!!!!!!

easiest guide ever

By: sabyasachi

It is really helpful.


By: upul karunarathne

It's a great tutorial , help alot

By: Melvin

I really must  say that you are very good what you teach. Thank you for your time and knowledge.

I install this to my Ubuntu desktop, but i want to know if it  possible to use any controller to access them as one interface (like a control panel).

I also will like to know if you can guide me through the ftp setup or openssh

Although i would have love to communicate with my Ubuntu Server 11 directly with a webmin, but i am having problem installing it.

it shows this error message any time i type

~$ sudo apt-get install ethtool
[sudo] password for mklaw: 'i typed password'

THEN error

Reading package lists.... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ethtool

 ANOTHER error

~$ sudo /etc/apt/sources.list
[sudo] password for mklaw: 'i typed password'

THEN error

sudo: /etc/apt/sources.list command not found

I am not sure  if it is referring me to the CDROM instead of the internet to download.

Please offer your warmest support.



By: KidGr

thanks a lot man.
i had a problem with mysql and i saw the link after i solved it!!!
Excellent tutorial

By: Nikhil Baliga

Thank you for the excellent step-by-step procedure. 

By: J Soe

I just wanna thank you for this great tutorial! :)

By: Caleb

Great guide! The only issue I ran into was step 3. I even tried it with sudo, didn't work. Found out that I already have MySQL installed, I believe that that may have been the issue. I am running on 10.10 and LAMP work beautifully. Thanks for the guide.

By: Anonymous

Thank you, very easy and clear tutorial !

By: sheenu

All done in a jiffy... loads of thanks.... :)

By: Yaron

Help me a lot. Thanks Again!

By: Kelly

You are the man. This tutorial was great. You got me up and running. Thanks a million.

By: .Jebin

Very clear man.. and it work crystal clear.. Thanks!


By: orbit

thanxxxxxxxxxxxxx a lot

By: Juan


 Worked great!

By: Emilio Vargas

Great Doc thanks so much for your post it worked wonderfully. love the way you present step by step commands. I'm new in the ubuntu world and very scare some times with this of terminals buy with docs like this soon it all be conquered.

By: akiara kalchek

Thank you alot for this guide.. i don't know how long this is on the net, but i used it today on ubuntu natty and works perfectly... thank you

By: Arun

Very easy to follow and works great ... excellent writeup.

Thank you 

By: Anonymous

THanks a ton for this article, the only problem i had was in the step to get php and mysql to work together, i couldnt find the specified line to edit =/


By: rishi

am vry glad to convey my regards to u..i am beginner to linux...this tutorial helped mi a lot to learn more abt installin things in linux...hope every beginner try this tutorial lik mi ..thank u so much :)

By: Anton

It works great! BUT indicate explicitly that with the command
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
you also install mysql extensions for PHP and Apache!

By: Nuno Godinho

Cristal clear! You made it extremely simple. Many thanks to the authors of this article.

By: Anonymous

Crystal clear and works a treat - thank you.

By: Joe

Tutorial went great until editing the php.ini file.

There is no ; entry in the php.ini file.


Ubuntu 11.04

By: Berl

You find the ;extension = by using the "extension" keyword in your search. just next,next,...

By: Caeruleus

If you just searched the file for ";" you wouldn't have found it. There is a tab between the semi-colon and the word extension

By: Vi Jeh

I also have same problem in php.ini.edit

By: vijith vijayan

now its found,ok...

By: Amanda

This tutorial helped me figure out what I did wrong with my LAMP installation. Thanks for a great, very helpful tutorial!

By: edzams

Great job for a first timer. Appreciate it much. All the best.


Very clear and useful - thx !


By: Anonymous

thanks you!!!!!!

By: Anonymous

It worked with no hitches!

By: grant

please add 'mysql -u root -p' with the "-p" into this tutorial. When using the command 'mysql -u root' I get an access denied, you must use the '-p' so that the system prompts you for the root password in order to continue with the rest of the tutorial. Thanks.

By: Anonymous

Hi. I also have the same problem of mysql-u root giving me "ERROR 1045 (28000): Access denied for user 'root-p'@'localhost' (using password: NO)" even after I tried your suggestion of using "-p" it still gives me the same error". Help please

By: Dan

Looks like you didn't leave a space between root & -p

If you use

mysql -u root 

and get an error regarding password then you probably already have a password set in which instance you should use 

mysql -u root -p 

 which will then prompt for the password which you have already written down ;)

By: mhdere

great, easy to follow. thanks

By: Anonymous

This appears to have worked perfectly. Thanks so much

By: Jason

Thanks man! Worked perfectly.

By: Paul

Very good guide, easy to do, had it up in 1/2 hour!



 [email protected]

By: Akhenaton_2

Very good guide, worked pretty well.

Sometimes I've completed with other sources for subjects like which was in my file.

And I had a little problem with phpmyadmin. The simlink was not created, just create it manually or copy the folder into /var/www.

Otherwise, it was excellent and very useful!

By: Egirland

Followed instruction with full success! Thanks.

I preferred using Synaptic rather than apt-get.... so the mysql password has been asked me by a friendly setup window....


By: Arno

Great guide ! I Just followed the steps and everything worked immediately. Thanks taking the time to make this guide and for saving me a lot of time ;-)

By: Gavin

In the past running windows and apache after installing phpmyadmin all i did was go to http://localhost/phpmyadmin, not this doesnt work in this case and am wondering how I can access phpmyadmin to make changes.


I am running ubuntu 11.10 if that is of any help.


Thanks Gavin,

By: Patrick




Include /etc/phpmyadmin/apache.conf

to the bottom of your


 file and restart the apache server

you will now be able to use


to access the program.


By: Paul

Thanks for the info Patrick!

I was having the same problem that Gavin was.

By: Nicker

Thanks Patrick, that helps a great bunch.

By: Koenigscat

Thank you man!

 also, after adding that line to the bottom of that file, apache needs to be restarted in order for phpmyadmin to show up in 'http://localhost/phpmyadmin'

for those who don't know, do the following

 sudo /etc/init.d/apache2 restart

By: Albaraa

After I configure the file my.cnf using: gksudo gedit /etc/mysql/my.cnf

The following happens:

 (gedit:3714): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.LBQG9V': No such file or directory

(gedit:3714): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

(gedit:3714): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.EXJE9V': No such file or directory

(gedit:3714): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

(gedit:3714): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.DLTS9V': No such file or directory

(gedit:3714): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

And when I open the file again it would be changed, but after doing all of the other steps I still cant access my, localhost/phpmyadmin 
 So any help is much appreciated, THANK YOU!

By: Des

I am a complete novice, so any answer please in easy speak just like the great instructions. I was able to follow easily but have this

 could not reliably determine the server's fully qualified domain name, using for server name.


I have change the bind address to the ip addy i found on the network settings for this computer, what have I done wrong??

Thanks in advance


By: informaticien51

you have made nothing wrong...this say that there is no dns server in your host.

You have no adress..

 That s not a problem, because you access to your site via http://localhost

By: irealrush

AWesome tutorial. thanks alot ! 

By: chika.tambun

install ubuntu server with lamp server then just add phpmyadmin package..

xampp like would be yours

By: Mani

Well it seems I got it all to work, thanks for the write-up.

By: GuestHouse

Thanks a lot! Really easy guide to understand, this one goes right down to the hard drive archive. 

By: Elly

Perfect! Thanks

By: Anonymous

Thanks for making a guide that is easy to understand and doesn't have unnecessary information riddled throughout!  That is so hard to find.  Keep up the good work!

By: Javier

I have a problem when I test PHP.

In step 4, in the browser, when I type http://localhost/testphp.php, it shows me that it can't connect to the server, and it doesn't show the page of php.

Then, when installing mysql, in step 3, I have this error: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I don know what to do, I followed the instructions one by one...

Thanks in advance.


By: Alek Silver

This error message means that you already set up a password for MySQL.

When you install MySQL in Ubuntu, it asks you to enter a password.(MySQL in the terminal window)   If you entered a MySQL password at install, then you need to type this to log into MySQL:

mysql -u root -p

It will then ask you for the current MySQL password for the user "root"

If you entered a MySQL password at time of install, you can skip the step in this tutorial where it tells you to create a password.

By: Anonymous

I am receiving this error: (gedit:9535): Gtk-WARNING **: cannot open display. 
The error occurs during this step:

After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file entitled php.ini. To open it type the following:

gksudo gedit /etc/php5/apache2/php.ini

By: Anonymous

 an easy way to lamp on ubuntu on a video

By: robsoles

I won't mind if anybody would like to explain to me how the following line leads to something that can't be configured and secured as adequately as stepping it all out as above here.

sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql

was just checking if much had changed since the last LAMP I set up....

By: Anonymous

$ sudo gedit /var/www/testphp.php
[sudo] password for kelly:

(gedit:4824): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.OIV7AW': No such file or directory

(gedit:4824): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory


gksudo gedit /etc/apache2/apache2.conf

(gksudo:4889): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",

 $ sudo /etc/init.d/apache2 restart
apache2: Syntax error on line 232 of /etc/apache2/apache2.conf: Could not open configuration file /etc/phpmyadmin/apache.conf: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.!

I have no clue where to start! And the first two PHP and Apache installations are supposed to be easy! Oh no, I am scared! I must be an EXTREME newbie! Any help greatly appreciated! 



By: shijesh

Excellent guide .. was able   to install LAMP on my Ubuntu 11.10 in 30 mins..


Gr8 Job..


Best Regards,


By: Anonymous

thanks for your guide - I could installed everything alright

I think it would be even more helpfull if you explain how to reach phpmyadmin

 I used it before and after some thinking got to the configuration to be able to use it - I mean, 

 coping the content of /etc/phpmyadmin/apache.conf to /etc/apache2/httpd.conf

You could also say you get to phpmyadmin, not as an application but through the browser - I tried finding phpmyadmin application icon to run it! ;-(

By: Alberto Magassela


I learned a lot from this tutorial.

thank you very much

By: Hari Thakur

Thanks a Lot ..!

By: Anonymous

The lamp-server set up now has the ; in the /etc/php5/apache2/conf.d/mysql.ini .

By: Steve

What directory location does this install default to for each app? Also could you change the installation location?  Any reason not to? Just curious, thanks.



By: Luis Palacios

Wonderful tutorial
It was very helpful, 100% functional

Easy to understand, and I learn a lot with this

 Thank you very much!!

By: userzero

Fantastic aide, have done this a fair few times now, always years apart and I always forget the coding, very simple and straightforward, keep up the good work...if you fancy doing a how to install j2ee on eclipse for linux anytime, let me know, I can never get it right! ;-)

By: Kiran

That was real crisp and straight forward way of doing it. Everything worked wonderfully smooth. The only glitch I faced was that http://localhost/phpmydmin didn't open the phpmydmin interface. A search at the ubuntu forums provided the solution for that too. In case anyone else needs. 


By: Ben

Don't forget to start with:

sudo apt-get update

Thanks for the tutorial!

By: Anonymous

If you get error when doing mysql -u root, do mysql -u root -p instead, it'll work. 

By: Roderick

The steps you put here worked flawlessly, except that the file in your instructions "" is "" in php.ini .  Perhaps it changed recently.

By: Suresh

please say how to test the phpmyadmin that I have installed....

By: Mauricio

In order to phpmyadmin works, you need to copy it to www:

sudo cp -R /usr/share/phpmyadmin /var/www

so, you can use it typing: http://localhost/phpmyadmin at your prefered browser. 

By: Anonymous

This really worked to get phpmyadmin working

By: Anonymous

Its really easy to install LAMP with ONE single command in ubuntu:

sudo apt-get  install lamp-server^ phpmyadmin


Copy past, and you are set. All you need to do to get started is add

 to your /etc/php5/apache2/php.ini file

By: munir


By: Anonymous

excellent thanks very much

By: Damian

I am trying to install LAMP on Ubuntu desktop 12.10 but when i go to follow your list using terminal  its not finding anything in the locations to install, any help would be appreciated..

By: Anonymous

Did you run "sudo apt-get update"?

By: Anonymous

Your tutorial was the fastest, most comprehensive lesson I have ever seen and best of actually worked FLAWLESSLY! You are the man!!! Thanks

By: PetiteFleurBleue

I just have it done on Linux Mint Debian Testing,it also worked perfectly well

after adding the "cp" line suggested by Mauricio on 2012.10.08.

One difference was that "extension=mysql" was present in the .conf file as  "extension=msql" .

Only details changed, as the presence of menus to edit the mysql password or to choose between apache and another server. Maybe because it seems this tuto was writen in 2007 and then these menus didn't exist yet. 

Very useful, thanks a lot!


By: Ernie

Thank you, very helpful. Everything came up and is working.


By: Manan

Thank You !!!!! You saved a lot of my time.....

By: Magnus

Thank you for the exelent, simple and working guide

By: Anonymous

I have followed your instructions on installing LAMP. I did not follow

Install MySQL Nr 2 (Optional).

 Now just restart Apache and you are all set!...........I got the following:

[email protected]:~$ sudo /etc/init.d/apache2 restart
[sudo] password for alex:
 * Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
                                                                         [ OK ]
[email protected]:~$

Is this correct?

Kind Regards


By: Peter N

Thank you very much for the excellent guide.  It is my first look at Linux and LAMP and I will use its resources to publish my own (historical) information with the goodwill and free of charge that you have done.

By: Anonymous

Try adding -p at the end of it so it'll look like "mysql -u root -p", it will ask   you for a password hopefully you remember it.

By: miNo

when I installed everything worked good but now when I want to login into phpmyadmin I get message like this #2002 Cannot log in to the MySQL server

please help

By: Volodymyr Krupach

Nowdays to configure mysql you need just to type:

sudo apt-get install php5-mysql

 and restart:

sudo service apache2 restart

By: Anonymous

I don't know about you guys but I prefer to install LAMP in a single click after reading about other methods.

 Don't know if you are allowed to link to other guides here or not but this one seemed to help as it had alot of screenshots,

They had two different installation methods there too which was nice.

By: mike

Awesome guide, easy to follow, very well done. Thank you very much!

By: Yesaya

straight forward guide, thanks.

I would like to mention thought that the line to link php to mysql is a little different. mine said instead of extension.mysql=so. I am using ubuntu 13.04.

 It works all the same.

thanks again. :)

By: Faraz Hashmi

This is a nice guide to install lamp, I have look @ this to recall all the process of the installation for lamp. THANKS!

By: Hai Bui thanh

I highly recommend

This guide is very easy to follow


By: inbrown

Worked perfectly.  Thanks for the tutorial!

By: Wild

Thank you so much. 2 thumbs up.

By: Anonymous

 If this doesn't work

$mysql -u root
 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

 Try this:

mysql --user=root -p


By: Sunlutang

Worked Great !!!  Thanks!

By: Keagan

Thanks for taking the time to create this for us. :)

By: mohamedDZ

thanks for this great job

By: kimberly

Thank you, Sir (or Madam!). Far more helpful than some of the other guides I have used!


By: Anonymous

Thanx .... Best one yet i hav seen

By: J. Piar

Thank you. Very helpful.

By: Anonymous

I just found this on Google, it was one of the first pages, but it was a great guide, and helped a lot, it deserved to be one of the first pages. Thanks!

By: Anonymous

Awesome tutorial. Thank you! I would recommend including that after you run the set password on mysql that you have to either exit mysql in the terminal or restart the terminal. Other than that, flawless. 

By: GeekyGamer14

Thanks! But just change you're to your. This guide really helped!

By: Anonymous

 * Restarting web server apache2                                                                                                                apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName

By: Shauneq

 I got this to and resolved it by adding my local hostname to /etc/hosts.   My hostname is and my ip address is, so I added this line: qbuild1


By: Nick B


 I thought this guide was terrific !! I use it every time I need to install LAMP. I also use the link to RESET PASSWORD page, which is also a good resource ! 

Thanks very much !!! 

By: lgshort

this is a process that i have gone through a hundred times but its always nice to have a well made walkthru to reference.  a webserver in 30 minutes or less.  thanks for the easy to follow step by step, it makes me look awesome in my bosses eyes. :)

By: Dale

Totally a stupid question. When you say "add your IP address" in the MySQL installation section, do you mean my local or public IP?

By: Anonymous

Wonderful tutorial,thumbs up

By: Shauneq

Beautiful cookbook style directions.   I hate pages that just say "install apache" with no information on how to do.  Great job.

 You say uncomment the line:  


 But when I went to edit the file, the line said


 So I couldn't find ""   I can't imagine why my installation had "" but I just uncommented it and changed it to ""


By: Zain

Yea, It says the same here too. Instead of, I have So, I changed it to, saved and exited.

By: Sib Andela

Good Day,

 I have just installed XAMPP as per your very clear instruction on UBUNTU 12.04 

(The clearest instructions I have found so far) 

After installing PHP  and doing the RESTART I got the message; ... Waiting apache2: Could not reliably determine the server's fully qualified domain name, assuming as server name.

 I carried on and installed MySql  and phpmyadmin as per the instructions, much the same

THEN when I wanted to test localhost/phpmyadmin I got :


The required URL /phpmyadmin was not found on the server


 APACHE/2.2.22(Ubuntu) Server at localhost Port 80


Please what must I do to get things working so that I can use my database

 Are there settings I need to make to MySql?

and Where do I create a directory where I can place my PHP and HTML code so I can test via localhost.

 Many thanks


By: Anonymous

I believe you made a typo. is local host.

By: Anonymous

The localhost address on 127.n.n.n uses the netmask so all addresses under 127 work. I often use just for fun, works fine.

By: Jimmy


By: Anonymous

Thanks ! it was usefull

By: Anonymous

Thank you! This was really easy and clear to follow.  The only thing I can think of that might improve the instructions is a step to SAVE after changing 

By: rtp

Nice guide. Is there a guide on how this can be used? I'm trying to get BugZilla working with LAMPP.

By: Anonymous

Thanks very much for this guide.

By: James

For step 3 of the mysql setup:

 Instead of the command 'mysql -u root' it should be 'mysql -u root -p'

It will ask for the password, so just put in your password.  If you dont' know it, try using your linux user account password or..

sudo -i 


and punch in your new UNIX password

This is my first time installing LAMP on my ubuntu 12.04 (desktop) system so I couldn't think of anything that would alter step 3.

 Hope this helps everyone.

By: Twig

Thanks. Was stuck there for a while :)

By: Alec

How would I be able to test and see if everything is working properly if I am using Ubuntu Server?  I know that I can't open a web browser so how could I test this and see if everything is working properly?

By: RASMiranda

Alterantive to "Test PHP" Steps 1 and 2: 
#create test PHP page
sudo rm /var/www/testphp.php
sudo touch  /var/www/testphp.php
echo "<?php phpinfo(); ?>" | sudo tee /var/www/testphp.php
cat /var/www/testphp.php #Make sure <?php phpinfo(); ?> appears on the output, 2 times

By: Bas Cost Budde

An even quicker alternative is on the commandline: php -i

By: Anonymous

How do i check phpMyAdmin for managing the mySql db?

By: Yogesh

Can you please add below steps for phpmyadmin, as I had to do these in order to run phpmyadmin from browser

sudo gedit /etc/apache2/apache2.conf

add this line somewhere

Include /etc/phpmyadmin/apache.conf

and finally restart apache.

sudo /etc/init.d/apache2 restart


By: Lohith


 I was unable to install the lampp. I followed all the steps but really i din know what was happening.. don know nothing is working. i don have any idea about what are the files have been installed. how i can remove all those files? I would like to reinstall once agian by following your steps.. Need help.......:-(





By: Mikal

I just needed to put up a LAMP and this guide was the first I found.
Simple and good instructions! two problems I encountered, the () around the password did not work for resetting the sql database, and the reset for apache2 in the last string did not work. other than that, worked really good! Thank you!

By: Henrik

I tried the tutorial and probably due to updated versions I have these corrections


The mysql apt-get will prompt me for a root password, thus you do not need that step.

Also, the "mysql -u root" cannot log you in, you must replace it with "mysql -u root -p" and then enter your pwd upon request.

By: Cole

Great post... I found it very easy to follow. 

By: ghundi


firstly I would like to appreciate for a great step-by-step instruction on installing/setting up Apache, PHP and MySQL

thus, I had problem with PHP installation. after installing the PHP, I did exactly as said. made testphp.php and placed it in /var/www folder.

tried accessing it from http://localhost/testphp.php

BUT I got 404 Not Found !!!!

don't know what's wrong....



By: hello-you

Wow, man. That was great a great article (and still would be if it was your hundredth). Great work!


now if I can only get mysql-server working...

By: Emmanuel Obong

Thanks for great work

By: Tama

It would be easier to:sudo apt-get install lamp-server^

The caret is important, this is a virtual package that includes Apache, Mysql and Php. Nonetheless, your testing instructions are very useful.

By: Christophe


other tutos were unsuccesfull for me, yours is great and clear.



By: celia

I have this error  ```The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete.``` when accessing to http://localhost/folder/

By: sagar malhotra

I have read the all instruction and succesfully instaled the lamp thanks for sharing these helpful tips.

By: arness

usless men 

By: Vimalkumar Bohara

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using Set the 'ServerName' directive globally to suppress this message

By: Vimalkumar Bohara

Hello Folks,

I tried to get some solution for my error which is


AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using

Set the 'ServerName' directive globally to suppress this message.


the solution I got is edit some files like httpd.conf or fqdn & many more in /apache2 directory but NONE of these are presents.

can anyone provide me with full proof solution?

By: Tobin

how can i solve this problem...


sudo: unable to change to sudoers gid: Operation not permitted

sudo: setresuid() [0, 0, 0] -> [119, -1, -1]: Operation not permitted


By: JulianBor

At the first step of installing PHP with the command sudo apt-get install php5 libapache2-mod-php5 it says:

E: Package 'php5' has no installation candidate

E: Package 'libapache2-mod-php5' has no installation candidate

Can anyone help me please?


By: till

Are you sure that you use Ubuntu 12 or older? If not, then use the tutorial version for the newer Ubuntu versions which can be found here: