Install LAMP on Ubuntu 9.10 Karmic Koala

Why install LAMP on your desktop computer?

Why would I want to install and set up a LAMP (Linux, Apache, MySQL, php) stack on Ubuntu 9.10? It’s useful if you want to set up a private web development environment. Perhaps you want to develop your own WordPress theme. If you are developing websites and experimenting, it’s nice to do it in the privacy of your own computer, rather than out on the public internet.  

Install LAMP

The Ubuntu developers have created a very easy way to install a LAMP server on an existing system. It’s all kicked off with this one simple terminal command.

sudo apt-get install lamp-server^

Note: Please make note of the caret (^) in the above command, it’s not a typo, it’s required to make the command work.

Install LAMP with apt-get

The apt package manager will show all the packages that need to be installed. Hit <Enter> to confirm that you want to install them.

You will then be prompted to change the password for the root user on the MySQL database.

Setting root password for MySQL

Enter the password you want. You’ll be prompted to enter it a second time to confirm.

After you confirm your password, apt will continue to install the rest of the packages.

Lamp installation is complete

Lamp installation is complete

Congratulations, your LAMP installation is complete! That was the easy part, now you need to get things configured to make the system easy to work with.

Test Apache

Open a web browser and enter the address http://localhost/. You should see a web page that says “It Works!”

Apache works!

Apache works!

Testing php

Now that you know Apache works, it’s time to test the php installation. You’ll need to create a file in /var/www called testing.php. Open a terminal and enter:

gksudo gedit /var/www/testing.php

Enter the following line into the text editor, save the file and exit.

<?php phpinfo(); ?>
Creating testing.php

Creating testing.php

Next, restart Apache with the following terminal command.

sudo /etc/init.d/apache2 restart

Now go back to your web browser and enter the address http://localhost/testing.php/. You should see a page displaying version information for your php installation.

Testing php - it works!

Testing php – it works!

Configuring MySQL

Since I’m installing LAMP for a web development environment, I want to bind the MySQL database to the localhost IP address. This should be 127.0.0.1 for your system. You can verify it with this terminal command.

cat /etc/hosts | grep localhost

You’ll now want to verify that the correct bind address is set up in the my.cnf file.

cat /etc/mysql/my.cnf | grep bind-address

You should see a line that looks like

bind-address		= 127.0.0.1

If the IP address doesn’t match the one for your system, you’ll need to edit the my.cnf file to correct it.

Install phpMyAdmin

You don’t need to install phpMyAdmin, but it’s a much easier way to get in and muck around with things in your MySQL database if you’re not familiar with the MySQL commands. You can install phpMyAdmin from the command line with

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

The installation will prompt you to select a web server for automatic configuration. Use the space bar on your keyboard to select apache2 and then hit <Enter>.

Configure phpMyAdmin for Apache2

Configure phpMyAdmin for Apache2

Another screen will come up asking if you want to configure a new database called dbconfig-common.  Since this is a fresh installation, use the <Tab> key to select Yes and hit <Enter>.

Configure dbconfig-common

Configure dbconfig-common

You’ll be prompted next to enter the MySQL root password. Enter the MySQL root password that you created earlier, hit <Tab> to select Ok and hit <Enter>.

Enter MySQL root password

Enter MySQL root password

You’ll then be prompted to enter a MySQL application password for phpmyadmin. You can hit <Enter> and a random password will be generated. I chose to use the same password that I used for the root MySQL password. If you enter your own password, a password confirmation screen will come up. Confirm your password.

MySQL application password confirmation

MySQL application password confirmation

The phpMyAdmin installation is now complete.

Testing phpMyAdmin

Open your web browser and enter the address http://localhost/phpmyadmin/. You should see a page like this.

Testing phpMyAdmin

Testing phpMyAdmin

You can log in with the username root and the root password that you created earlier.

phpMyAdmin home screen

phpMyAdmin home screen

Congratulations, you’re now ready to start building your local website. If you’re only working on one site you can put all of the files into /var/www.  If you’ll be working on multiple sites you may want to consider some additional Apache configuration to keep things neat and clean on you system.

161 thoughts on “Install LAMP on Ubuntu 9.10 Karmic Koala

  1. Vikash Kumar Choudhary

    Thanks Sir….Really such a great guideline or totally straight forward. I successfully configure lamp server as well as phpmyadmin into my System and i m successfully able to do php task with this.

    Thank you very much.
    Have a nice day!

    Reply
  2. Matse

    Hi…

    I’m a raw recruit in using Ubuntu … but this guidance was very helpful.
    It’s written for Ubuntu 9.10 Karmic Koala, but it also works for Ubuntu 10.10 maverick.

    Thanks a lot!

    Kind regards Matse

    Reply
  3. Ramith

    Hi I have recently installed ubuntu and wanted to have local host server, I have installed success fully but when i am at this stage for Testing phpMyAdmin, it is displaying “Not Found

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

    I am not sure every thing was succesful but displaying errors any help please

    Reply
  4. Barry

    After fretting 24 hours over having installed LAMP from Ubuntu’s Synaptic PM “by task” selection and installing PhPMyAdmin separately only to find out later that my PMA p/w didn’t work and that I couldn’t uninstall LAMP “by task” from Synaptic (’cause you can’t untick the LAMP checkbox in Synaptic), I came across your page here. To make a long story short, I finally got it all straightened out. Thanks Linerd (luv it)–you rock!

    Reply
  5. Ernie

    Excellent straight forward tutorial. Now I just need to figure out how to create my website from an existing copy. Tried it with a previous installation and couldn’t access any of the folders on the website.

    Reply
  6. Lenny

    Thanks very much for tutorial, but … where (in which folder) I should copy and extract lamp archive …

    I have now lamp in a folder in Documents and nothing happend:

    lenny@lenny-Ub:~$ sudo apt-get install lamp-server^
    [sudo] password for lenny:
    Leyendo lista de paquetes… Hecho
    Creando árbol de dependencias
    Leyendo la información de estado… Hecho
    0 actualizados, 0 se instalarán, 0 para eliminar y 0 no actualizados.
    E: No se pudo encontrar la tarea lamp-server

    Reply
  7. Venkat

    What a great tutorial…I was using xampp and once i got mysql login, several times re-installed. finally i decided to do away with xampp, this tutorial is a big help.I book marked it.
    Kudos…

    Reply
  8. djm

    Thanks, this was a great help.
    I struggled with this over a week and only after reading this, did I get my problem solved

    Reply
  9. sandeep

    Nice post,but for getting phpmyadmin to work i need to follow the post give below anyway thanks for the correction nice post dude…its simply superb…

    Reply
    1. Linerd Post author

      The installation process creates startup scripts in /etc/init.d. LAMP starts automatically when you boot your computer.

      Reply
  10. Kipp Elliott Watson

    This worked for me … except for the phpmyadmin part. I added a line at the end of /etc/apache2/apache2.conf:

    Include /etc/phpmyadmin/apache.conf

    then everything worked perfectly.

    Thank you for a wonderful tutorial. This is the simplest and fastest way to add LAMP and Phpmyadmin.

    Reply
  11. poedjie

    how to work with lamp?
    because newbie
    i have project but in win**** and I want to work in ubuntu
    thanks to answer

    please answer to my email

    Reply
  12. vedviveka

    Thank you great… tutorial.. i could install without any hiccup.. only phymyadmin..gave trouble… anyway it is extra..

    Reply
    1. Klavs

      I also just installed LAMP using this great guide. Thank you!
      However, I also had problem with http://localhost/phpmyadmin/ not working.
      I solved this by changing the Apache configuration file slightly. First open it by entering this in a terminal window:
      sudo gedit /etc/apache2/apache2.conf
      Then add the following line at the end of the file:
      Include /etc/phpmyadmin/apache.conf
      Then save it, close it, and restart Apache from the terminal window by writing:
      sudo /etc/init.d/apache2 restart
      Then phpMyAdmin also worked for me.
      This information I got from a more detailed installation guide in Danish (http://jesperjarlskov.dk/blog/lamp-linux-apache-mysql-php-pa-dit-ubuntu-desktop/).

      Reply
  13. Pingback: Installing Apache, PHP and MySQL | Anshu Verma

  14. Pingback: Install Habari on Ubuntu 9.10 | Openswitch

  15. Carlos Kosloff

    I ran into a problem when installing on another machine with similar system.
    It is running Mint Helena Gnome x64, an Ubuntu clone.
    It threw some errors during installation.
    Tested Apache and it works, then tested PHP and got this:
    Fatal error: Call to undefined function phinfo() in /var/www/testing.php on line 1
    Tried to reinstall from command line but that didn’t help.
    Before you ask, I did restart apache2, even the whole machine.
    So, php did not install correctly, how can I fix, please?
    The funny thing is that these instructions worked fine on my netbook which is running Mint Helena Gnome 32-bit.

    Reply
  16. Dazza

    Thanks for this – just what I needed! Fairly new to Linux environment (using Ubuntu 9.10 and LOVING it!) so all these terminal commands mean nothing to me – coming from years of Windows/DOS.

    All running as hoped – agin thanks for taking the time to make this so easy!!

    Reply
    1. Carlos Kosloff

      Screem HTML Editor
      Bluefish
      the firefox developer extensions
      Code Igniter or Kohana
      NetBeans
      symfony
      Eclipse
      Come back in a couple years when you are finished with those.

      Reply
  17. Pingback: Access Your Web Server From a VirtualBox Guest OS | Tux Tweaks

  18. Ivan Jaya

    Thanks for your tutorial. It really help me.

    I want ask you about LAMP:

    Can we set the LAMP for accessing the site that we create not only placed at /var/www but also a specific folder that we want (e.g. folder LearningPHP at documents) ?

    Reply
  19. Edgar

    i have an error in the downloading of phpmyadmin, i type sudo apt-get install libapache2-mod-auth-mysql phpmyadmin, and i get “can’t find package phpmyadmin” what can i do? i use 9.10 karmic koala spanish thanks for your help

    Reply
  20. Pingback: Installing Apache on Ubuntu 9.10 | The Linux Experiment

  21. Saphid

    If after you install you get a 404 not found error do this;

    First type the following command to open up this file:
    [term]gksudo gedit /etc/apache2/apache2.conf[/term]

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

    Now restart Apache:
    [term]sudo /etc/init.d/apache2 restart[/term]

    Point your browser to: http://domain/phpmyadmin, you should be able to see the phpMyAdmin landing page now!

    Reply
    1. Linerd Post author

      This should have been configured during installation. If you are getting the 404 error on phpMyAdmin you should run
      [term]sudo dpkg-reconfigure phpmyadmin[/term]
      use the space bar to mark the box next to Apache and then hit <Enter> to complete the configuration.
      Then run
      [term]sudo /etc/init.d/apache2 reload[/term]
      You should be able to use phpMyAdmin now.

      Reply
    2. Aniket

      Hi all,

      The first method works pretty. But I had tried all other ways BEFORE i went for that. For the record I first purged the old mysql installation from my machine, then installed a new one, and then reinstalled and and reconfigured the phpmyadmin. even tried reloading the configuration files on apache. But this including the config. file manually really did my job.

      Thanks for posts people.
      Aniket,
      Developer@ View6

      Reply
  22. Pingback: Phew … « Something …

  23. AccesInterzis

    I’ve seen that using this line gksudo gedit /var/www/testing.php i can creat/access a file from www folder. But how can I delete one? Or how can i get to this folder. I mean in windows it is easy: you click 2-3 times and you are in the www folder of easyphp ans you can do whatever you want there. but in ubuntu it is different.

    Reply
    1. Linerd Post author

      You can remove a file from the /var/www folder with this command:
      [term]sudo rm /var/www/filename[/term]
      You can also add and remove files using the file manager, but you’ll need proper permissions for that. The /var/www folder is set up to be writable by the www-data group. To add your userID to that group, use:
      [term]sudo adduser yourid www-data[/term]
      You might have to log out and log back in to make the group change take effect. You should then be able to manage the files in that folder from the file manager.

      Reply
        1. Linerd Post author

          It’s the same that you use to log into the system. Your terminal prompt is probably something like yourid@hostname. You can also find out you ID with the following terminal command:
          [term]whoami[/term]

          Reply
          1. AccesInterzis

            I did it. I added my user to that group. After that, I restarted my PC and when I accesed first time the root folder it let me to get in. So I went to www folder and I tried to delete a few files to create my own website after and it didn’t let me to do it. I went out of the File Browser and when i tried to access root folder again it told me that i do not have permissions to open it.

  24. AccesInterzis

    I’ve followed all steps until “Testing phpMyAdmin”. When I open in browser “http://localhost/phpmyadmin/” it tells me “The requested URL /phpmyadmin/ was not found on this server.”.

    Reply
  25. davin

    at the last step i got this error
    Not Found

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

    Reply
  26. Balco

    I have a problem with installing the lamp server.
    everytime I type: sudo apt-get install lamp-server
    I get this response:
    [term]Pakketlijsten worden ingelezen… Klaar
    Boom van vereisten wordt opgebouwd
    De status informatie wordt gelezen… Klaar
    0 pakketten opgewaardeerd, 0 pakketten nieuw geïnstalleerd, 0 te verwijderen en 0 niet opgewaardeerd.
    E: Kon taak lamp-server niet vinden[/term]

    Translated:
    [term]Reading packagelist… Done
    Tree of neceseryties is build
    The status information is being read… Done
    0 packages upgrade, 0 package installed, 0 to be deleted and 0 not upgrade.
    E:coulden’t find task lamp-server.[/term]

    Does anyone know what I did wrong, or went rong?

    PS: Sorry for my bad english, I don’t know if the translating is correct, I don’t have the english version my self.

    Reply
    1. Linerd Post author

      Balco, you forgot to include the carat at the end of the command. The correct command is
      [term]sudo apt-get install lamp-server^[/term]

      Reply
  27. J.James

    This is by far the most well developed tutorial for installing LAMP on Ubuntu 9.10. Thank you for making this process clear for a new Linux convert. Once my sight is up and running I will definitely add your link!
    Thanks again.

    Reply
  28. Wildel

    Thank you, Linerd, for your very much appreciated help!
    In my discovery of this entirely world new to me, you are undoubtedly a very bright light in the dark, and one sentence sums it all: it works!!!

    Reply
    1. Linerd Post author

      This indeed is a guide for installing LAMP on Ubuntu Desktop. It should work on a server install as well, but I haven’t tried it.

      Reply
  29. Leslie

    Hey, I got it to work. I used
    sudo gedit /etc/apache2/apache2.conf

    to insert the below code into apache2.conf – at bottom of page.
    Include /etc/phpmyadmin/apache.conf

    Tut source: http://tolearnfree.blogspot.com/2009/11/how-to-install-apache2-php5-mysql-and.html
    then I used your restart apache command, Linerd
    sudo /etc/init.d/apache2 restart

    Thanks for a superb tut here and thanks also to Mike Kenzie, collector of vintage computers
    http://www.ncf.ca/~ba600
    You are real life savers 😀 Are you in Twitter Linerd?

    Reply
  30. alain

    I started like you mentioned but is one problem

    * Starting web server apache2 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    Unable to open logs
    [fail]
    invoke-rc.d: initscript apache2, action “start” failed.

    can you help me

    Reply
  31. Pingback: How To Uninstall LAMP in Ubuntu 9.10 Karmic Koala | Tux Tweaks

    1. Linerd Post author

      Leslie – Did you remember to select “apache2” during the phpMyAdmin configuration like in the picture? Use the Tab key to go to that field and use the Space bar to select it. You can re-run the phpMyAdmin configuration with:

      sudo dpkg-reconfigure phpmyadmin
      Reply
      1. Leslie

        Thanks for answering 🙂 Yes, I did do that. I even tried the purge and (re)install (to Kirsten above) in case I had missed something. I still get the same result.

        Should I email you? This could go on awhile – I’ve talked to a couple of others on this already and we are getting nowhere! I really hope you can help :S

        Reply
        1. Linerd Post author

          Honestly, I have no idea what you might have done wrong. The process has gone smoothly for me every time I’ve run it. If you want to start over with the install, I just wrote a post on how to uninstall LAMP in Ubuntu. This will purge all of the web server information from your system so you can start fresh.

          Good luck.

          Reply
          1. Leslie

            Thanks. I got it working, and meant to put my reply here, but instead I have put it as a new comment! Sorry about that. My listing of /etc/apache2/conf.d/ is quite different to yours.

  32. Live

    OK, now that I’ve installed it. How do I uninstall or remove this lamp-server? It seems everyone is talking about installing it, but I’m not comfortable if I don’t know what it installed in my system, I think there are 10-20 packages, how do I remove all of them? Is there a command, a GUI, how do you do it?

    Reply
  33. Greg

    I, too, am on the lookout for CLI removal of LAMP in Ubuntu 9.10. Any thoughts or suggestions?

    (Thanks, btw, for the guide/tutorial!!)

    Reply
    1. Linerd Post author

      @Greg- You should be able to do i with something like

      sudo apt-get purge apache2 mysql phpmyadmin

      I’m not sure of the actual package names, I’m away from my Linux box right now. I’ll take a look at it and post an update. After removing the main packages, you can then clean up the rest with

      sudo apt-get autoremove

      You can also use aptitude instead of apt-get for the first command and the autoremove will be done automatically.

      Reply
  34. Kirsten

    Hi! I’ve been looking at several guides for installing wordpress in ubuntu and yours is really the most in-depth that I’ve come across, but I’m having some significant problems in configuring phpmyadmin. Yes, I did check the apache2 box with my spacebar, I promise.
    I get
    error 1045 (28000): Access denied for user ‘root@localhost’
    at the completion of the reconfigure. I’m wondering if the error could have it’s roots in mysql name/password or if I’ve done something especially silly.

    Also, I have tried this:
    Edit /etc/apache2/apache2.conf and add the following lines to the end of the file
    #for phpmyadmin
    Include /etc/phpmyadmin/apache.conf
    and when I do the apache2 restart fails, if this additional info is helpful at all. Any comments at all would be appreciated.

    Reply
    1. Linerd Post author

      @Kirsten – If the phpmyadmin configuration is successful, then the lines you’ve added to /etc/apache2/apache2.conf are not required and may cause a conflict, so go ahead and undo that change. That may take care of the problem with Apache starting.

      I sounds like something may have gone wrong with the phpmyadmin installation. I would try removing it and reinstalling it along with the Apache mod-auth module. Remove it with

      sudo apt-get purge libapache2-mod-auth-mysql phpmyadmin

      and reinstall it with

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

      It should take you through the phpmyadmin configuration again.

      If your hunch is correct about your MySQL root password, you can reset it by running

      sudo dpkg-reconfigure mysql-server-5.1

      Good Luck!

      Reply
        1. Linerd Post author

          So you’re able to access the other http://localhost/ sites?

          Leslie’s comments below indicate you’re not alone. You might want to try completely removing LAMP and try again from the beginning.

          Before you do that, you may want to check your /etc/apache2/apache2.conf file and make sure you didn’t remove too much. the end of my file looks like this:

          # Include of directories ignores editors' and dpkg's backup files,
          # see README.Debian for details.
          
          # Include generic snippets of statements
          Include /etc/apache2/conf.d/
          
          # Include the virtual host configurations:
          Include /etc/apache2/sites-enabled/

          Also, my listing of /etc/apache2/conf.d/ is this:

          -rw-r--r-- 1 root root  269 2009-04-01 12:01 charset
          -rw-r--r-- 1 root root   21 2009-11-14 11:04 fqdn
          lrwxrwxrwx 1 root root   28 2009-06-13 11:20 phpmyadmin.conf -> ../../phpmyadmin/apache.conf
          -rw-r--r-- 1 root root 1464 2009-04-01 12:01 security

          This page might be of some help: https://help.ubuntu.com/community/ApacheMySQLPHP

          Reply
          1. Kirsten

            Thank-you Linerd, uninstalling and starting from scratch did it. You’re instructions are incredibly helpful!

  35. Fahrisal

    Another Question:
    How do I copy paste wordpress files or Joomla files to folder www like I was used to do in windows?.
    I’m unable to paste the files by using “copy paste click”.

    Reply
  36. Venkat

    Thank you for your time in creating this excellent tutorial, I just followed your tutorial and my machine now has LAMP installed successfully. Thank You again.

    Reply
  37. Jonathan

    Thanks for the tutorial, I’m trying to switch over to Ubuntu as a web developer and was a little disappointed there wasn’t a simple solution like MAMP on the mac. However, this tutorial helped out immensely. Unfortunately, I am running into one problem. I’ve gotten to the end of the tutorial, everything seems to work, but when i try to login to phpmyadmin nothing happens. I enter root as the user and my password, the page reloads and nothing. I don’t see the phpmyadmin controls nor do i see any error. Help?? Thanks again.

    Reply
  38. relaxssl

    How to uninstall the LAMP just with one command?
    One time I tried to uninstall the LAMP with sudo apt-get remove lamp-server^ and the result is that I lost connecting the VPS Server after restarting it.
    this force me to hell?

    Reply
  39. DC

    And of course you are all aware that all of this will *only* work when networking is enabled after you log in to the desktop?

    Reply
  40. afsya

    I also met the same problem with the max, but after I tried the way of solutions that the two finally succeeded. thank you for your help …

    Reply
  41. veindoc

    Linerd:

    As a medical educator and computer hobbiest new to Linux I want you to know this tutorial is SUPERB. It is well documented, straight to the point, but comprehensive enough for a ubuntu newbie to follow. I too, DID NOT, use the spacebar to “tag” apache2 and of course got the dreaded 404 upon trying to start phpmyadmin. I followed your fix to reconfigure phpmyadmin and it worked flawlessly. I am particularly enthused with the command lines as I use them as learning tools to further understand manipulation of ubuntu. I am still struggling with installing wifi and my magicolor 3100 network printer. If I can accomplish those tasks I would only use XP for developement of Adobe Creative Suite programs. Again thank you very much and if you know of any really good methods to install wifi and the network printer I would be eternally grateful.

    Dr. Snyder

    Reply
  42. bobot

    i followed comment #33 above
    uninstalled and reinstalled phpmyadmin
    but i still got the same 404 error
    on my browser.

    i thinks i screwed it up somewhere
    during LAMP installation followed
    by phpmyadmin. i just can not
    fix it 🙁

    Reply
    1. Linerd Post author

      @bobot – If you’re using Firefox, make sure to clear the browser cache. I can’t tell you how many times I’ve chased my tail because of that. Once FF gets a 404 error, it doesn’t really try to load the page again unless you force the issue. Sometimes even clicking “reload” a few times will get a page to load.

      The only other thing I can think of is the phpmyadmin configuration. If you do sudo dpkg-reconfigure phpmyadmin, make sure you mark “apache2” like in this picture.

      Reply
  43. bobot

    i sure did and after removing the said lines
    from /etc/apache2/apache2.conf i got the
    following on my terminal as a result:

    eufemio@bagnot:~$ sudo /etc/init.d/apache2 restart
    * Restarting web server apache2
    … waiting [ OK ]
    eufemio@bagnot:~$

    but when i got back to my browser and type:
    http://localhost/phpmyadmin/

    i still can not get my phpmyadmin interface going
    that is, i got the famous 404 error.

    perhaps i will try uninstalling phpmyadmin
    and install it again and hope to get it going
    by then.

    you really are a big help and thanks a lot. 🙂

    Reply
  44. bobot

    i think you really got it right. i remember updating
    my system the day before. i followed your instructions
    and the problem on “fully qualified domain name”
    is gone but when trying to restart apache2 again
    i got the following:

    eufemio@bagnot:~$ sudo /etc/init.d/apache2 restart
    * Restarting web oapache2 [Sun Dec 13 11:07:59 2009] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
    … waiting [Sun Dec 13 11:08:00 2009] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
    [ OK ]
    eufemio@bagnot:~$

    the line 3 of my /etc/phpmyadmin/apache.conf contains the
    following: Alias /phpmyadmin /usr/share/phpmyadmin

    i dont know if my problem is trivial. i am quite new
    to ubuntu linux.

    thanks for your help… 🙂

    Reply
    1. Linerd Post author

      @bobot – I think I have it figured out. Did you perhaps follow the tip in the comments above to add lines to /etc/apache2/apache2.conf? (Comment #5 above.) That step is a patch for systems where you forgot to select apache2 during the phpmyadmin configuration. I just added those lines now and restarted Apache and got the same error.

      Edit /etc/apache2/apache2.conf (sudo gedit /etc/apache2/apache2.conf) and remove the lines
      #for phpmyadmin
      Include /etc/phpmyadmin/apache.conf

      Then restart apache with
      sudo /etc/init.d/apache2 restart
      and you should be good to go.

      Reply
  45. bobot

    i followed the tutorials and the suggestions. For a while, more precisely,
    right after the installation, I had phpmyadmin running but when i
    got back to it a couple of days after, it fails.

    i got the following when trying to restart apache:
    eufemio@bagnot:~$ sudo /etc/init.d/apache2 restart * Restarting web server apache2 [Sat Dec 12 17:00:12 2009] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    ... waiting [Sat Dec 12 17:00:13 2009] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

    i also had tried: sudo dpkg-reconfigure phpmyadmin but to no avail.
    do you think you can help me? thanks

    Reply
    1. Linerd Post author

      @bobot – Line 3 of my /etc/phpmyadmin/apache.conf is Alias /phpmyadmin /usr/share/phpmyadmin
      Does yours match that?

      To fix the “fully qualified domain name” error, issue this command:
      echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn
      then reload the sites with
      /etc/init.d/apache2 reload

      One more thought: perhaps a system update has broken phpmyadmin. Have you tried reinstalling it? I’d try completely removing it first.
      sudo apt-get purge phpmyadmin
      then reinstall with
      sudo apt-get install phpmyadmin

      Reply
  46. Don

    Beautiful! I was working to set up WordPress locally, and was fairly successful at screwing the install up. This was a BIG help, thanks for the effort to post this!

    Reply
  47. thebigfatgeek

    When I FTP into the server, I cannot copy files to /var/www. How do I put my webpages onto the server without being root (which does not have a password)?

    Reply
    1. Linerd Post author

      thebigfatgeek – Not sure what you mean. The tutorial is showing how to install a LAMP stack on your own machine. You need root (or sudo) access to perform the installation. If you can do that, then you can certainly FTP in as root as well. One option would be to log in to the server and set up Apache to read files from your home directory. Then you can place your files somewhere inside your $HOME.

      Reply
  48. Helene

    I install LAMP on Ubuntu 9.10 and the only issue I had with the above tutorial was wiht PHPmyAdmin that was not working. There is on step missing after the install:
    sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin
    that copy your phpMyAdmin file onto your root directory.

    Reply
  49. Jelle

    Phpmyadmin also didn’t work at my first try. I forgot to select apache2 during the setup. I removed purged the two packages that were installed (sudo apt-get remove –purge …) and installed them again. I made sure I selected apache2 by hitting the spacebar and ever that phpmyadmin worked like a charm.

    Great guide. Thanks!

    Reply
    1. Linerd Post author

      Jelle – Glad you got it working. I think you could have avoided the reinstall by just reconfiguring phpmyadmin with
      sudo dpkg-reconfigure phpmyadmin

      Reply
  50. cendekia

    i think you need to edit aphace.conf first in order to get connect with phpmyadmin:

    sudo vi /etc/apache2/apache2.conf

    add this line and save:

    Include /etc/phpmyadmin/apache.conf

    Reply
  51. Aveesh Kumar

    Excellent tutorial. Please make sure that you specify that to start the install from terminal there should be a caret (^) at the end.

    I assumed it was a mistake and almost didnt type it in. For newbies like me, it is important to stress that people who write tutorials are doing us a favor. A little more hand holding and we will acquire the confidence to give ms windows the boot…thx

    Reply
  52. randomguru

    just wanted to say, great post. very helpful and doing a fresh install of “karmic koala” on my laptop after wiping the drive clean and finally getting rid of Windows XP… well, it’s awesome!

    so, installing a new incarnation of LAMP was great. now i just need to redirect to my /home/public_html directory and i’m good to go!

    Reply
  53. Stefan Lasiewski

    The correct command uses a caret (“^”) at the end of the command. This is allows apt-get to call a task.

    So apparently, this should work:

    sudo apt-get install lamp-server^

    or

    sudo tasksel install lamp-server

    That is really user-unfriendly. It’s an obscure trivial addition to apt-get, and isn’t even documented in the apt-get man page.

    For more information, see Ubuntu Apache, MySQL, php

    Reply
  54. Stefan Lasiewski

    ‘lamp-server’ doesn’t seem to be a valid Ubuntu package. See http://packages.ubuntu.com/search?keywords=lamp-server&searchon=names&suite=karmic&section=all

    The package ‘lamp-server’ doesn’t exist for me at all.

    me@hosta:~$ sudo apt-get install lamp-server
    [sudo] password for stefanl:
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Couldn’t find package lamp-server

    me@hosta:~$ apt-cache search lamp-server
    me@hosta:~$
    me@hosta:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 9.10
    Release: 9.10
    Codename: karmic

    Reply
  55. Mihaela

    Thank you for the very useful tutorial. It’s nice to have all the steps to test things after you install them, so there are no surprises later on.

    Reply
  56. max

    First of all, thanks for a wonderful guide.

    I’m new to Linux and Ubuntu, and I recently had to purge my HD because of confusedly misfollowing other instructions for installing LAMP. However, your straightforward and easy to follow guide has allowed me to get it going.

    Problem is: phpmyadmin won’t work. I installed it as per your instructions and it looked like it was going well and everything, BUT when I try http://localhost/phpmyadmin/ it just gives me a big old “404 Not Found” screen. If you can think of any tips or advice, I would be very grateful.

    Reply
    1. Linerd Post author

      Edit – See the first comment above.

      Max – I did a similar tutorial for installing LAMP in Jaunty. Some of the comments listed on that post have some suggestions for your problem. There have been 2 potential solutions posted.
      1. Make a symbolic link from /usr/share/phpmyadmin to /var/www.
      sudo ln -s /usr/share/phpmyadmin /var/www
      2. Edit /etc/apache2/apache2.conf and add the following lines to the end of the file
      #for phpmyadmin
      Include /etc/phpmyadmin/apache.conf

      Then, restart Apache with
      sudo /etc/init.d/apache2 restart

      Let me know if one of these solutions works for you.

      Reply
  57. Pingback: fsdaily.com

  58. Linerd Post author

    This is important!

    If you get a 404 Error when testing phpmyadmin, then you probably forgot to select apache2 during the phpmyadmin configuration. Re-run the configuration with
    [term]sudo dpkg-reconfigure phpmyadmin[/term]
    Make sure to use the Space Bar to select apache2, (it will show a [*] next to it if it’s selected).

    Reply
  59. Pingback: Installing LAMP on Ubuntu Jaunty (9.04) | Tux Tweaks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.