How to install LAMP server in Ubuntu 11.04 / 10.10 / 10.04

If you are a web developer proficient in PHP& MySQL, you may be using the popular WAMP Server (Windows, Apache, MySQL and PHP) in your windows platform. The more powerful Linux and Unix platforms have a similar package called LAMP which stands for Linux, Apache, MySQL and PHP and serves the purpose of web development based on Open Source concept. Apache is the Web server, MySQL is the relational database and PHP (Preprocessor Hyper Text) is an object oriented programming language.

There are many approaches to installing LAMP server in Ubuntu 11.04/10.10. The simplest and most likely to be used approach is to use the following command in terminal:

sudo apt-get install lamp-server^

The command initiates the download of LAMP server to your PC with a password prompt and when finished, its done!
Open your browser and type the following:

http://localhost/

and hit enter. If you get the following screen, then Apache definitely works.
To access MySQL, you can use the following URL:

http://localhost/phpmyadmin

The following screenshot depicts PHP Myadmin being explored with your browser.
Finally to test PHP, place a php file (eg: test.php) in your www folder with the following script:

<?php
phpinfo();
?>

Now call the file through your browser  by typing http://localhost/test.php
There are other procedures to install LAMP, like using tasksel or installing Apache, MYSQL and PHP separately.

You can leave a response, or trackback from your own site.

SUBSCRIBE TO OUR DAILY RSS FEED!

RELATED POSTS

35 Responses to “How to install LAMP server in Ubuntu 11.04 / 10.10 / 10.04”

  1. [...] This post was mentioned on Twitter by Cellina Minvi, multimediaboom. multimediaboom said: RT @multimediaboom How to install LAMP server in Ubuntu 11.04 / 10.10 / 10.04 http://bit.ly/gnt2MW #lamp #server [...]

  2. jan says:

    hi i just installed

    sudo apt-get install lamp-server^ on ubuntu 11.04

    but phpmyadmin is not working

    http://localhost/phpmyadmin

    I then tried to install it with

    apt-get install phpmyadmin

    but i still get the message in my browser that

    404 is not found.

    thanks for your help
    J

    • Sarauw says:

      I also got a 404 accessing /phpmyadmin, so tried jan’s suggestion (with an added “sudo” at the start of the command).
      During install I got a couple of text prompts regarding database setup, but the DB-users could not be created:
      ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: YES)
      Unable to connect to mysql server

      A number of retries didn’t solve anything :-)
      Well, time to ask Google…

    • Qusai says:

      Hello,

      Regarding the phpmyadmin not working, here is a simple code to make it run smoothly:

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

      Simply run this command in your terminal.

      Good luck =)

  3. ismail says:

    now ….

    after install lamp-server^ you wont get phpmyadmin yet.

    you have to “sudo apt-get install phpmyadmin”

    so it will install few more modules needed by phpmyadmin (i think mcrypt module)

    during the installation process it will ask to configure to which webserver in my case it displayed 2 option a)apache2 and b)lighttpd

    now is the most important part!

    you have to select apache2 …. by having the cursor beside apache2 then press spacebar. the star “*” sign should appear. only then you’re selecting the apache2.

    if you dont do that …. phpmyadmin wont properly configured and most probably wont work.

    • blyde says:

      Hi ismail,

      After your post I realized that I never checked the apache2 box with spacebar. So I ran:

      sudo apt-get remove phpmyadmin

      and attempted to remove the tool so that I could re-install (and reconfigure) it. However, when installing it again, I don’t get the option to choose apache2, it accepts the previous parameters I entered…

      Any ideas?

      • Bruno says:

        Try:

        apt-get –purge remove phpmyadmin

        this will remove and purge all configurations

        next reinstall phpmyadmin

  4. dan says:

    i installed and had the same error.but then i used the fix

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

    as suggested by Qusai.and phpmyadmin now works
    but i cannot create a database, it says insufficient privileges

  5. Ankit says:

    What is the importance of ^ in sudo apt-get intall lamp-server^ ??
    I can’t simply write sudo apt-get intall lamp-server .

  6. jack says:

    hi i am trying to host something using php support and mysql databases both of them i can not seem to get to work any advice email me at jackbrown1941@live.co.uk

    and p.s u may have to run it in the browser u could run through terminal with root priveliges if that works by the way jan

  7. Rick Aron says:

    Hi, followed the above instructions but I get
    ‘Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.’

    when I try and log into phpmyadmin – any clues where I should go to solve this one?

  8. [...] Reference ubuntu 下架设LAMP+phpmyadmin Installing Apache2 With PHP5 And MySQL Support On Ubuntu 11.04 (LAMP) How to install LAMP server in Ubuntu 11.04 / 10.10 / 10.04 [...]

  9. addall says:

    i am also getting the same thing … not able to resolve

  10. Ashish says:

    yeah its really work…
    bruno reply is perfect

  11. Peter says:

    Quite easy, and actually working.
    Thanks for the tut!

  12. Dontput says:

    go to Synaptic and search for phpmyadmin. And make sure you have put a password in it.

  13. ohman says:

    i just installed ubuntu 11.04 today and installed lampp from apachefriends… question…how do i start lamp… if i installed it on a different drive? i couldn’t install or move the extracted archive to the opt folder? it tells me i’m not the owner

    sorry… my first time to be on linux.. and trying to find my way through… any help would be much appreciated

  14. kiran kumar says:

    I followed above instructions but its shows 404 page notfound …

  15. abhishek choudhary says:

    sir i gv d command in terminal sudo apt-get install lamp-server^
    and due to some problem i press ctrl+z
    and again when i try to install i m getting this error

    E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

    pls help me what to do .
    and how i can install lamp in my ubuntu11.04
    thanx in advnc

  16. abhishek choudhary says:

    after installation how can i add file in www folder . and also getting 403 error when i m going to access http://localhost/phpmyadmin
    getting this error
    Forbidden

    You don’t have permission to access /phpmyadmin on this server.
    Apache/2.2.17 (Ubuntu) Server at localhost Port 80

  17. cohen says:

    Hi I cannot save the test.php file to the www folder. It says I do not have to permission to save to that location.

    Any ideas?

    • swati says:

      do u accesing var/www from through terminal and just do and will ask you your password then u can access var/www and you can save but only through terminal

  18. NickWannaBGeek says:

    Hey there peeps.

    Just want to say. As a new Linux user, I think I just had the best computing experience in my life :) .

    Using this guide has made it easy to install anything in this world!

    I hope Linux over takes the miserable world of windows.

    Linux will become the future!!

    Ismail Muchas gracias.

  19. Justin says:

    @Cohen you need to do: sudo gedit test.php to create and save the file with the right permissions.

    For those having problems immediately after installing phpmyadmin and still get an error when they visit http://localhost/phpmyadmin the solution is that you need configure apache to recognize the phpmyadmin gui you installed. So complete the installation of phpmyadmin under Apache2, add the following line in the Apache configuration file at /etc/apache2/apache2.conf Include /etc/phpmyadmin/apache.conf (preferably at the end of that file where you’ll find other Include syntaxes)… Then restart apache by doing: sudo /etc/init.d/apache2 restart

    Voila.. Hope it helps

  20. swati says:

    sudo apt-get install lamp-server^

    http://localhost/

    http://localhost/phpmyadmin

    i have run all this things after running test.php i got all the information about server nd all
    but in terminal i done and im accessing mysql through root in terminal
    but im getting error as
    “ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)

    Please help me to come out through it

  21. William says:

    I’ve installed LAMP on Ubuntu before, but I had help through it. Afterwards, we had to work on creating a website, server, e-mail system, blah blah balh, all for a grade in class. Quite confusing, yet even more boring.
    Anyway, we’re taking a test and I’m trying to practice before tomorrow. I’ve got Ubuntu up and running, but when I try to install the LAMP server — sudo apt-get install lamp-server^ — it tells me it can’t find any of the packages or tasks. The first time I did this, I didn’t have this problem. Now that I have a test to do, I’m quite confused. Since we can’t ask for help, I’m basically screwed…
    Any help on this matter will be much appreciated!~ :)

  22. JP says:

    Hi, I am learning to program C in college and this works perfectly for me. Thanks a lot for your help!

  23. Terri says:

    Thanks for all the great help. Very very useful.

  24. niraj says:

    invoke-rc.d: initscript mysql, action “stop” failed.
    dpkg: error processing mysql-cluster-server-5.1 (–remove):
    subprocess installed pre-removal script returned error exit status 1
    No apport report written because MaxReports is reached already
    * Stopping MySQL database server mysqld [fail]
    invoke-rc.d: initscript mysql, action “stop” failed.

  25. niraj says:

    During installation i am getting the following errors;;

    kindly help

    Do you want to continue [Y/n]? y
    Preconfiguring packages …
    (Reading database … 288053 files and directories currently installed.)
    Removing mysql-cluster-server-5.1 …
    * Stopping MySQL database server mysqld [fail]
    invoke-rc.d: initscript mysql, action “stop” failed.
    dpkg: error processing mysql-cluster-server-5.1 (–remove):
    subprocess installed pre-removal script returned error exit status 1
    No apport report written because MaxReports is reached already
    * Stopping MySQL database server mysqld [fail]
    invoke-rc.d: initscript mysql, action “stop” failed.
    * Starting MySQL database server mysqld [ OK ]
    dpkg: mysql-cluster-client-5.1: dependency problems, but removing anyway as you requested:
    mysql-cluster-server-5.1 depends on mysql-cluster-client-5.1.
    Removing mysql-cluster-client-5.1 …
    Processing triggers for man-db …
    Processing triggers for libc-bin …
    ldconfig deferred processing now taking place
    Errors were encountered while processing:
    mysql-cluster-server-5.1
    N: Ignoring file ‘obs-ostinato.sources.list’’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
    E: Sub-process /usr/bin/dpkg returned an error code (1)

Leave a Reply

Popup By Puydi