How-to Install LAMP Server[Apache, MySQL, Php] On Ubuntu 10.10

Linux LAMP servers are also popular, flexible and reliable as WAMP server. The installation of both servers are very easy and differ from each other. LAMP means Linux Apache Mysql Php, and WAMP is for Windows. WAMP server installs automatically(installer),you are able to use server without touching setting files. While LAMP server installs with commands. Here, I am going to show how to install LAMP server through Terminal on Ubuntu.

LAMP Installation:

To install LAMP server, open up a Terminal window(Ctrl+Alt+t), and type the following commands.

All commands have written in italic words and remember Terminal commands are case sensitive!!

To install Apache:

sudo apt-get install apache2

Now to confirm the installation of Apache2 open http://127.0.0.1 in your web browser, you will see It Works! default page of Apache.

To install Mysql:

sudo apt-get install mysql-server

At the installation you be will asked to provide a root password for Mysql.

To install php:

sudo apt-get install php5 libapache2-mod-php5

After this installation restart Apache [sudo /etc /init.d/apache2 restart] don’t write brackets.

Now make a phpinfo.php file and save that in /var/www to do this use [sudo gedit /var/www/phpinfo.php] write a code in this file

<?php
phpinfo();
?>

Now open http://127.0.0.1/phpinfo.php

To install phpmyadmin:

 sudo apt-get install phpmyadmin

Two option window will open in installation one for web server reconfigure automatically[select apache2] and second for configure database for phpmyadmin with dbconfig-common [select No].

lamp-server-installation-ubuntu-10.10

You will need to copy the apache.conf to /etc/apache2/conf.d/ from /etc/phpmyadmin/ or the page will return a 404 error. To copy Run-

sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d

Now you have to restart your apache server

sudo /etc/init.d/apache2 restart

Now open http://127.0.0.1/phpmyadmin

Read : Lamp Installation through Tasksel

If you want to start blogging and interested in the field of earning money online. Then you should install WordPress CMS to make blog or site. For WordPress installation you should see my tutorial of WordPress installation.

Hope this will helpful for you, for any query or help post comments. Your feedback helps us.

{ 64 comments… read them below or add one }

wm December 12, 2010 at 9:36 AM

There is a much easier way to install LAMP on Ubuntu..

sudo tasksel

choose lamp server (or any server install) when prompted.

Reply

Rahul Dev December 12, 2010 at 1:42 PM

hi wm
thanks to drop it here.

Reply

Adepoju Aliu December 23, 2010 at 12:03 AM

Pls. i can’t open php file through browser after the installations.

Reply

Rahul Dev December 23, 2010 at 9:23 AM

i can’t understand what the problem is coming.
so please contact @ rahuldev@mobiletod.com

Reply

erfan December 27, 2010 at 9:21 PM

It is very good
thanks ;-)

Reply

Jonathan Klemm January 9, 2011 at 9:08 AM

I was following the “How-to Install LAMP Server[Apache, MySQL, Php] On Ubuntu 10.10″
but I made a mistake i selected yes instead of no. I tried purging phpmyadmin and then reinstalling it but i still get a file not found

Reply

Rahul Dev January 9, 2011 at 7:12 PM

hi Jonathan
first open synaptic manager search phpmyadmin
mark to complete remove then apply.
now install it again.

hope it works out for you

Reply

James January 12, 2011 at 3:47 AM

Great work, easy to fallow, and it works.
Thank very much

Reply

Tim January 15, 2011 at 2:23 PM

Thanks for the article. Helped alot.

Reply

chandan January 20, 2011 at 3:26 PM

I followed the article but I got 404 error.
one more thing i wanna ask. above in figure it shows that “yes” has been selected for the second time but told to select “no” as in article.. ? I don’t understand. they didn’t ask me to put database administrator when i was following the article given above. I think if I had selected yes then it would have asked. please help. Thanks

Reply

Rahul Dev January 20, 2011 at 9:43 PM

oops
I missed one point, after copy the apache.conf to /etc/apache2/conf.d/ from /etc/phpmyadmin/ you have to restart apache2.
Now I have updated it.
Thanks Chandan

Reply

Asrhaful Alam September 27, 2011 at 2:27 PM

I don’t use phpmyadmin in this way. I download it, then move it to /var/www/
It works for me.

Reply

Mike January 22, 2011 at 3:18 AM

I’m having a little bit of trouble. When I go to phpmyadmin and I enter my user name and password nothing happens. I was hoping someone could give me some advice.

Reply

Taps Murove September 13, 2011 at 3:56 AM

I’ve been having the same problem that you spoke about. Did you manage to find a way to fix it? I’d appreciate any help… I’ve been stuck on this for hours.

Reply

Mike January 22, 2011 at 4:05 AM

Now this pops up. cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly. Does anyone know how to resolve this? thank you

Reply

Nichelle Kunecke January 23, 2011 at 9:39 AM

Hi thanks for the article. However I get an error when trying to copy the apache.conf file from phpmyadmin to conf.d it says cp: cannot create regular file `/etc/apache2/conf.d/apache.conf’: Permission denied if I do it from the terminal. Same error trying to do it through the file windows. Any ideas?? Thanks in advance.

Reply

Rahul Dev January 23, 2011 at 10:37 AM

hello Nichelle
You should copy file through terminal with super user, try
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d

Reply

designer February 3, 2011 at 9:41 PM

Your site and its content is awesome.
Thanks for your support.

Reply

joseph Daniel February 3, 2011 at 10:15 PM

Thanks for the article.
But there are some problems.
The following two messages are seen on the bottom of phpmyadmin screen

Connection for controluser as defined in your configuration failed.
The additional features for working with linked tables have been deactivated. To find out why click here.
Please give a solution
Thanks in advance
D.Joseph

Reply

Hem February 5, 2011 at 10:21 AM

while saving ‘phpinfo.php’ a message “You don’t have the permissions necessary to save the file” is seen . how to resolve it?

Reply

Rahul Dev February 12, 2011 at 7:58 PM

hi Hem
You have to open phpinfo.php file through terminal with Super User
Try sudo gedit /var/www/phpinfo.php and save file .

Hope it has solved.

Reply

Akmal February 25, 2011 at 9:55 AM

after i follow all the steps, i got this error when i access http://localhost/phpmyadmin
403 Forbidden. You don’t have permission to access /phpmyadmin on this server.
can you help me? thanks

Reply

Rahul Dev February 28, 2011 at 9:10 PM

You have to copy apache.conf use

sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d

Reply

desta November 4, 2011 at 10:29 AM

hai, thas’ right? i have some problem.. but /etc/phpmyadmin/apache.conf is defferent file like in /etc/apache2/conf.d … never last to know.. thx.

Reply

Gayan February 27, 2011 at 8:54 AM

thanks a lot.
it is working fine…

Reply

seksrandki March 8, 2011 at 2:11 AM

I spent last 3 hours reading your articles ! And must say: awseome blog ! !

Reply

tharun March 9, 2011 at 12:17 AM

really very helpful to install php in lamp for freshers
thank for u sharing

Reply

neo March 10, 2011 at 6:49 PM

Amazing . after visiting many sites , finally great article . Indian bloggers are prefect :)

Reply

Pushpendra Pal March 10, 2011 at 7:19 PM

Thanks neo,
we will surely rule the web in near future.

Reply

Frank March 24, 2011 at 12:01 AM

Thanks for the article Rahul. Well written and easy to follow.

- Cheers!

Reply

pokihe March 25, 2011 at 7:32 PM

what do i do if i’ve forgotten the password to login phpmyadmin ? how to renewing it..pls.help

Reply

Onirik April 12, 2011 at 12:57 PM

I’m stuck with FTP and plugins install.
How can i install some plugins localy?
I think i have to install a ftp client but i don’t know how to do that… :/
Newbie Powaaa! ;)
Is it possible that you do a tuto?

Reply

Spiff June 5, 2011 at 5:26 PM

Lucid and effective. Thanks, Just one issue though. When I open up phpMyAdmin, I am unable to create a new database under MySQL Localhost heading as I am told that I have ‘no privileges’. I have read and tried a few ways to remedy this, including MySQL’s own online manual, but none works for me. Are you able to provide a similarly lucid account of how to GRANT ALL privileges in MySQL to me so that I can set up new databases through phpMyAdmin. You are one of the clearest sources I have come across.

Reply

mihai June 6, 2011 at 9:11 PM

Hello! I followed this steps and I have a problem when I try to enter to the MySql server. I have the error “#1045 Cannot log in to the MySQL server” although I write the corect password.

Reply

ajay July 3, 2011 at 8:41 AM

Hi i have installed LAMP in my linux OS , i don’t know where to place my PHP scripts inside the server (LAMP). i’m not able to find www folder to place my PHP files.

Reply

Mauricio August 20, 2011 at 11:35 AM

Hi, it’s a very good post, but all work good in instalation, but the username to logon is?, I know password, but I don’t know the username..

Reply

AK August 31, 2011 at 1:28 AM

username should be: root

Reply

Sakthi Prakash August 28, 2011 at 2:12 AM

Hi
This information is very full for me.
I hope this information will help all newbies

Reply

Jose Norbey September 18, 2011 at 1:44 PM

Thank you, very good, Now its working in my computer.

Reply

msanii September 28, 2011 at 3:15 PM

thanks alot for the help. the configuration worked. how do i find the www directory to store my web pages for easier management? thanks

Reply

Sagar November 6, 2011 at 5:39 PM

hello,
Thnx for your help. This configuration is now working. I want to ask where I should place my php program files to run them on my apache server. Also tell me how can I use php on terminal?

Reply

cecco November 9, 2011 at 6:34 PM

Thanks, the guide is very useful and very easy to do.
great job, congratulations.
hello

Reply

Edgar November 17, 2011 at 3:32 PM

Hello, I just want to tell you thank you so much for this super detailed, step-by-step instructions on how to install LAMP. In fact, I don’t know why, but in the past, I never had any problems installing it. I would just type the command apt-get install lamp and off it went, now I kept getting that it could not be found. The same way through YUM. Regardless, I am glad it worked out this way, I learned another way of installing it and maybe the only way now? LOL! I only encounter one problem and which I am sure it’s on my end; at the time to restart the apache server, I copied and pasted every command so I know it wasn’t a syntax error, but when I enter that command, I received a “etc is a folder” and then stop. So the way I did it was to go to the etc folder and execute from within, taking out the etc of course. Does anyone know why this happens? Well, thanks again for your great explanation and your hard work!!! Take care. Ed

Reply

Albert November 25, 2011 at 10:36 PM

Bro, ur article helped me a lot. Thanks…

Reply

juan December 27, 2011 at 7:01 AM

Easy and it works!

Reply

Ayo-David December 30, 2011 at 1:04 AM

Hi, thanks for this article, it help me to solve a problem I had installing LAMP for over 10hrs.

Reply

Mark Helium January 26, 2012 at 7:45 PM

Great piece of work. I ll give you 9/10 mark for this article.

Reply

kevin varnon February 8, 2012 at 3:28 PM

Good Helpfull

Reply

William February 29, 2012 at 2:29 AM

I’m using VMware and have gotten Ubuntu partially installed. I got it running, but when I start the LAMP installation, I’ve tried two different starters:

Sudo Apt-Get Install Lamp-Server^
and
Sudo Apt-Get Install Apache2

Then I get this on both of them:
Lamp-Server^ =
E: Unable to locate package lamp-server^
E: Couldn’t find task ‘lamp-server’
E: Couldn’t find any package by regex ‘lamp-server’

Apache2 =
E: Unable to locate package apache2

I need help finding a way to get these packages installed, or located at least.

Reply

Sam March 11, 2012 at 11:37 AM

You need to make sure to use lowercase commands, Terminal is case-sensitive.

Reply

rock March 29, 2012 at 7:24 AM

simply superb!!!!!!!!!!!!!!!

Reply

sneha March 29, 2012 at 6:06 PM

thanks

Reply

Ruwan April 10, 2012 at 11:18 AM

That’s cool man…Thanks for teach us..It’s superb guide..

Reply

NoMurka April 17, 2012 at 2:04 AM

Tnx maan :)

Reply

gaurav kumar April 24, 2012 at 1:57 AM

thanks for information.. its usefull……

Reply

Sisira Somaratne June 4, 2012 at 4:50 PM

Your detail explanation is fully complete. Than you very much!

Reply

Yabour June 9, 2012 at 4:14 AM

awesome articles. every thing’s working but i don’t know the username and password to login.help!! pls. tnks in advance

Reply

Chandu June 10, 2012 at 12:41 AM

Love it a lot. Its a detailed procedure to config lamp. Thanks a lot.

Reply

Daroath June 23, 2012 at 7:21 PM

Hi, Nice post! But I still wonder how you know the command to install for each application, for instance (sudo apt-get install php5 libapache2-mod-php5) and as I follow your instructions my PHP version say (PHP Version 5.3.6-13ubuntu3.8) while the PHP on Windows version is 5.4. So how can I update it to the same version as in Windows?

Reply

nani July 21, 2012 at 7:31 AM

Thank you very much.i am impressed very muchhhhhhhh.
i am working on this from 1 week. but not working. now i got it. Thank you very much.

Reply

games September 24, 2012 at 6:57 PM

very simple ,
but there are simple way,
Open terminal and Type the command :

sudo apt-get install tasksel

Now to install LAMP,
type the taskel command in terminal :

sudo tasksel

thats all

Reply

Anush October 1, 2012 at 12:00 PM

Very good, worked well. Thanks.

Reply

Reaksmey November 3, 2012 at 1:25 PM

what is the default username of phpmyadmin?

Reply

Ermi May 2, 2013 at 5:13 PM

Thanks man very helpful.
However I have one problem. I cant login to the phpmyadim. When I go to http://127.0.0.1/phpmyadmin/index.php it asked me username and password. Is there any default? I tried my login and password to the computer, but didn’t work. Any help please?

Reply

Leave a Comment