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].
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 }
There is a much easier way to install LAMP on Ubuntu..
sudo tasksel
choose lamp server (or any server install) when prompted.
hi wm
thanks to drop it here.
Pls. i can’t open php file through browser after the installations.
i can’t understand what the problem is coming.
so please contact @ rahuldev@mobiletod.com
It is very good
thanks
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
hi Jonathan
first open synaptic manager search phpmyadmin
mark to complete remove then apply.
now install it again.
hope it works out for you
Great work, easy to fallow, and it works.
Thank very much
Thanks for the article. Helped alot.
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
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
I don’t use phpmyadmin in this way. I download it, then move it to /var/www/
It works for me.
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.
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.
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
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.
hello Nichelle
You should copy file through terminal with super user, try
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d
Your site and its content is awesome.
Thanks for your support.
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
while saving ‘phpinfo.php’ a message “You don’t have the permissions necessary to save the file” is seen . how to resolve it?
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.
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
You have to copy apache.conf use
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d
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.
thanks a lot.
it is working fine…
I spent last 3 hours reading your articles ! And must say: awseome blog ! !
really very helpful to install php in lamp for freshers
thank for u sharing
Amazing . after visiting many sites , finally great article . Indian bloggers are prefect
Thanks neo,
we will surely rule the web in near future.
Thanks for the article Rahul. Well written and easy to follow.
- Cheers!
what do i do if i’ve forgotten the password to login phpmyadmin ? how to renewing it..pls.help
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?
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.
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.
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.
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..
username should be: root
Hi
This information is very full for me.
I hope this information will help all newbies
Thank you, very good, Now its working in my computer.
thanks alot for the help. the configuration worked. how do i find the www directory to store my web pages for easier management? thanks
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?
Thanks, the guide is very useful and very easy to do.
great job, congratulations.
hello
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
Bro, ur article helped me a lot. Thanks…
Easy and it works!
Hi, thanks for this article, it help me to solve a problem I had installing LAMP for over 10hrs.
Great piece of work. I ll give you 9/10 mark for this article.
Good Helpfull
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.
You need to make sure to use lowercase commands, Terminal is case-sensitive.
simply superb!!!!!!!!!!!!!!!
thanks
That’s cool man…Thanks for teach us..It’s superb guide..
Tnx maan
thanks for information.. its usefull……
Your detail explanation is fully complete. Than you very much!
awesome articles. every thing’s working but i don’t know the username and password to login.help!! pls. tnks in advance
Love it a lot. Its a detailed procedure to config lamp. Thanks a lot.
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?
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.
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
Very good, worked well. Thanks.
what is the default username of phpmyadmin?
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?