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:

489 Comment(s)

Add comment


From: Rajat

Great work man. material really helped.

From: nguy

Great Help

From: Parag

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



From: 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


From: guru katre

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

thanks :)

From: 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!

From: Anonymous

Great Tutorial....

From: 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

From: 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! 

From: 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

From: Anonymous

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

 Was it 

sudo tasksel install lamp-server


From: 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.

From: 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.

From: 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

From: 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

From: 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

From: 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

From: Anonymous

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

From: Anonymous

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

From: 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

From: 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 :)

From: Bruno Silva

TOP 10


From: Sadiq

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

From: Jonathan`

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

From: Giovanni

very good guide, all done well!!!

From: 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.


From: 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.

From: 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..?



From: cordlafond

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

From: Anonymous

a bit late?


root@ubuntu:/# 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.



From: 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?

From: 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.




From: Silvia

Muchisimas gracias por el tutorial...excelente

From: Hemant

It worked for me perfectly.. Thanks a lot

From: gearbox

Thx !

From: 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........

From: 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.


From: 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.

From: 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

From: 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

From: stussy

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

From: ck

[sudo] password for ck:
sudo: nautilus/var/www: command not found





From: 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


From: 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.


From: frank

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

From: Jonathan

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


From: 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

From: 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?


From: Anonymous

Good job. It helped a lot!

From: AQIL

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


From: jgalapatt

The step by step instructions were very helpful. Thank You

From: 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.



From: Anonymous

Very useful tutorial, thanks for writing it.

From: Anonymous


From: 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>

From: 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.



From: 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!

From: Felipe Silveira

great article!

From: 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.

From: 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...:-)




From: Jiao.Zhang

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

From: Totte

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

From: Jim

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

From: Cata

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

From: Dinu

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

From: Kalpesh

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

From: Alpha

Thanks, this LAMP instruction really help. Great help.

From: thameera

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

From: dinesh

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

From: Unknown Hero

Thank you very much for this guide!


Works like a charm!

From: Micha

Great guide, thanks!

From: 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.

From: William

Excelent tutorial :)

It works on Ubuntu Netbook Remix.

From: Anonymous

Great guide!

Keep it up!


From: Alex(Kiev)

Thanks a lot!

It's very helpful tutorial!!


From: Ryan

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


From: Akila

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

From: notinterested

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


Whats the deal?

From: 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 root@'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


From: 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.


From: 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

From: Bruce Edgar

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



From: Sinan Saricinar

Best tutorial ever...

From: 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. 

From: 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?



From: 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! :)

From: 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)

From: ErikB

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

From: golnaz

easy and helpful,thanks

From: 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!

From: Pieter den Toom

Worked like a charm, thanks

From: 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.


From: 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

From: Vikram TV

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



From: 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

From: Nater

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

From: Web design company

Thanks for the guide !

From: Jacques

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

From: sam

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


From: Ron

Great tutorial and lots of good tips in the posts.



From: singermaa

It's Better then i've seen.


thanks you 

I'd looking for just this one


Good luck to you for more

From: 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




From: J Young

Thanks! This works great!

From: Anonymous

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

From: hema

that was reaaly help full thnq for tht

From: 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

From: DFC

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

 Thanks in advance!

From: 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 :)

From: 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!

From: 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!

From: bouchardpie

Thanks much.  This was a big help.

From: Kris

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

From: 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. 


From: Benito Estrada

Despite minor details your guide really helps, solid gold!

Thanks 1,000! 

From: MSK

extremely useful. thanks

From: john


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

 For your first tutorial it was really good!


From: Anonymous

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

From: 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!!

From: 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?

From: 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.


From: 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?

From: J-man

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

What should I do?

From: sofazen

I sorted this out just adding it (

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

From: Anton Agestam

Thanks, phpMyAdmin refuses to work without that!

From: 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

From: 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 :)


From: 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

From: StigMcSobol

Hard work, but a well paced guide.

Thanks for making the first effort.


From: 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 ;)


From: Evgeny Ustimenko

ivan@805-room:~/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

From: marsty5

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

From: Anonymous

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

From: 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

From: tskrich

Fabulous instructions!!!!

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


From: Joseph

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

From: 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!


From: Kavi

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

 Thanks again.

From: Anonymous

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

From: 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... :(

From: 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).



From: 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!!

From: 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

From: 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.

From: Anonymous

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

From: 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!

From: 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



From: bryan

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

From: Uly Marquez

 quick and easy kungfu for ubuntu.. thank you

From: deeba

excellent job.thank u....

From: 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:))

From: 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.

From: Sree


From: 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 

From: johny

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

From: 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.

From: Bilal Malik

It was great help.



From: 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!  :)

From: texas hold em

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

From: A. Self

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

From: 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.

From: Da Vidis

Many thanks, the LAMP installation was smooth

From: kostaslivs


From: 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!

From: kingkeamo

great tutorial thank you


From: 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.

From: Anonymous

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

From: outstanding!



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

From: 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..!

From: Anonymous

Simply thank you!

From: anand ganti

good great post


From: milamoto

Your tutorial is excellent.


From: 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

From: 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!

From: 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

From: Anonymous

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

From: 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?

From: Anonymous

Did you use

sudo gedit /var/www/testphp.php

for editing the file?

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

From: MPG

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

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

From: ??

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

From: Anonymous

great instructions ! -- thanks

From: 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

From: 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


From: 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 

From: Dazza

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



From: Cyndi

Awesome newbie instruction.  Thanks!!

From: Anonymous

This was unbelievably helpful. THANKS

From: 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!

From: 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)

From: Anonymous

Thanks, that was painless.

From: pankaj

thank you..

you made it easy to configure.

thanx a lot

From: mah!

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

From: Anonymous

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

From: jeremy

a lot

From: JimNYC

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

From: 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.

From: 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

From: 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.

From: Karira

Thank you

I'm new user  

From: Tharindu

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


From: v twom

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

From: Hamed Rajabi Varamini

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

From: 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.

From: Anas

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


From: Hummad

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

From: 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.

From: 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.

From: vipul

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

From: 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.

From: Daniel

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

From: Omkar Khair

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

From: bakry salih

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

From: Anonymous

very clear and simple tut.

it worked perfectly.

From: Yene

to the point love it

From: Anonymous

Great tutorial.

From: 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

From: 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..


From: 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!

From: 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.

From: shiva shampoo

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

From: Kantha

Thanks for the information.

From: Anonymous

Fantastic! Thanx a lot!

From: 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!

From: 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

From: JJP

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

From: 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

From: 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.


From: Minez

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

From: 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.

From: Anonymous


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


From: 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.

From: 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.



From: JB

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

From: BentFranklin

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

From: 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

From: steven

this is good advice.  post should be updated

From: 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.


From: 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'.

From: Cid Visious

The name is

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

then restart the server. 

From: tototo

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

Worksssssssssssssssssssssssssssssssssssssssssss Great!


From: 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

From: 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.

From: Varghese

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

From: Sean

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

From: Anonymous

Excellent.. thank you

From: 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)



From: 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.


From: Anonymous

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

From: Ricardo

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


From: 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.

From: Alvaro

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

From: 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".



From: Anonymous

Thank you for this great article!

From: Juraj

It works, thanks!

From: Anonymous

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

From: Asfand

Thanks, gr8 and on the target work..

From: 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.


From: 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

From: 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!

From: 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.

From: 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

From: 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 .

From: 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!

From: 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!

From: 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.


From: 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

From: Alan

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

From: 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!



From: 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.

From: 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 ;)


From: rudy

2 :thumbsup:

From: Anonymous


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

From: nitai

excellent guide.

Thank you.

From: 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!

From: 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.




From: Anonymous

Really useful tutorial. Thanks very much!

From: Akash Panwar

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

Thanks alot.

From: 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.

From: 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


From: 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!

From: Shredder

Good job.

From: Misoooo

very helpfull, thanks

From: Anand

Perfect...... Hats off to you

From: Anonymous

Wonderful and easy to follow. Thanks!

From: Anonymous

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

 Thanks a bunch!


From: Mike

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

From: 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.

From: 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?

From: jarcmaster

 Those with the GKSUDO command  simply replace this line:

gksudo gedit ....

 with this one: sudo gedit ....




From: Anonymous

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

From: 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?

From: 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.

From: 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! 

From: 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!!!!!!!!

From: shabeer

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

From: 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


From: 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..

From: 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...

From: Frostraver

Very good guide! Thank you!

From: Jorge Biquez

works like a charm!. Great !

From: Anonymous

Work Great! Thanks!

From: bcow

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

From: RUBY

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----------


From: 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

From: t0m3kk

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



From: Anonymous

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

From: Dawiss

Thanks, had the same problem.

From: Bison

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

From: Anonymous

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

From: Abin V Paul

This was a great help

From: 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. 

From: David

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


From: 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.

From: Anonymous

thanks a lot !!!

From: Shammancer

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

From: Arun Prasad

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

From: 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


From: dexter

wat a site !!!!!!


thnx a lot

From: Anonymous

neat elegant. very well done indeed!

From: Pramod

very easy yet very useful thanks a lot :)

From: Goga

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

From: 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)

From: Madhawa

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

From: Anonymous

Great walk-through, works great!


From: kuberprok


From: 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!!!

From: Anonymous

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

easiest guide ever

From: sabyasachi

It is really helpful.


From: upul karunarathne

It's a great tutorial , help alot

From: 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.



From: KidGr

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

From: Nikhil Baliga

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

From: J Soe

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

From: 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.

From: Anonymous

Thank you, very easy and clear tutorial !

From: sheenu

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

From: Yaron

Help me a lot. Thanks Again!

From: Kelly

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

From: .Jebin

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


From: orbit

thanxxxxxxxxxxxxx a lot

From: Juan


 Worked great!

From: 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.

From: 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

From: Arun

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

Thank you 

From: 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 =/


From: 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 :)

From: 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!

From: Nuno Godinho

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

From: Anonymous

Crystal clear and works a treat - thank you.

From: Joe

Tutorial went great until editing the php.ini file.

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


Ubuntu 11.04

From: Berl

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

From: 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

From: Vi Jeh

I also have same problem in php.ini.edit

From: vijith vijayan

now its found,ok...

From: Amanda

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

From: edzams

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


Very clear and useful - thx !


From: Anonymous

thanks you!!!!!!

From: Anonymous

It worked with no hitches!

From: 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.

From: 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

From: 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 ;)

From: mhdere

great, easy to follow. thanks

From: Anonymous

This appears to have worked perfectly. Thanks so much

From: Jason

Thanks man! Worked perfectly.

From: Paul

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



 [email protected]

From: 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!

From: 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....


From: 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 ;-)

From: 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,

From: 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.


From: Paul

Thanks for the info Patrick!

I was having the same problem that Gavin was.

From: Nicker

Thanks Patrick, that helps a great bunch.

From: 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

From: 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!

From: 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


From: 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

From: irealrush

AWesome tutorial. thanks alot ! 

From: chika.tambun

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

xampp like would be yours

From: Mani

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

From: GuestHouse

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

From: Elly

Perfect! Thanks

From: 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!

From: 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.


From: 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.

From: 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

From: Anonymous

 an easy way to lamp on ubuntu on a video

From: 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....

From: 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! 



From: shijesh

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


Gr8 Job..


Best Regards,


From: 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! ;-(

From: Alberto Magassela


I learned a lot from this tutorial.

thank you very much

From: Hari Thakur

Thanks a Lot ..!

From: Anonymous

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

From: 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.



From: Luis Palacios

Wonderful tutorial
It was very helpful, 100% functional

Easy to understand, and I learn a lot with this

 Thank you very much!!

From: 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! ;-)

From: 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. 


From: Ben

Don't forget to start with:

sudo apt-get update

Thanks for the tutorial!

From: Anonymous

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

From: Roderick

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

From: Suresh

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

From: 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. 

From: Anonymous

This really worked to get phpmyadmin working

From: 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

From: munir


From: Anonymous

excellent thanks very much

From: 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..

From: Anonymous

Did you run "sudo apt-get update"?

From: Anonymous

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

From: 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!


From: Ernie

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


From: Manan

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

From: Magnus

Thank you for the exelent, simple and working guide

From: 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:

alex@alex-PC:~$ 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 ]

Is this correct?

Kind Regards


From: 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.

From: 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.

From: 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

From: Volodymyr Krupach

Nowdays to configure mysql you need just to type:

sudo apt-get install php5-mysql

 and restart:

sudo service apache2 restart

From: 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.

From: mike

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

From: 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. :)

From: 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!

From: Hai Bui thanh

I highly recommend

This guide is very easy to follow


From: inbrown

Worked perfectly.  Thanks for the tutorial!

From: Wild

Thank you so much. 2 thumbs up.

From: 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


From: Sunlutang

Worked Great !!!  Thanks!

From: Keagan

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

From: mohamedDZ

thanks for this great job

From: kimberly

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


From: Anonymous

Thanx .... Best one yet i hav seen

From: J. Piar

Thank you. Very helpful.

From: 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!

From: 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. 

From: GeekyGamer14

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

From: 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

From: 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


From: 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 !!! 

From: 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. :)

From: 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?

From: Anonymous

Wonderful tutorial,thumbs up

From: 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 ""


From: Zain

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

From: 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


From: Anonymous

I believe you made a typo. is local host.

From: 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.

From: Jimmy


From: Anonymous

Thanks ! it was usefull

From: 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 

From: rtp

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

From: Anonymous

Thanks very much for this guide.

From: 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.

From: Twig

Thanks. Was stuck there for a while :)

From: 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?

From: 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

From: Bas Cost Budde

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

From: Anonymous

How do i check phpMyAdmin for managing the mySql db?

From: 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


From: 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.......:-(





From: 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!

From: 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.

From: Cole

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

From: 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....



From: 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...

From: Emmanuel Obong

Thanks for great work

From: 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.

From: Christophe


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



From: 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/