How to install XAMPP on Linux (Ubuntu 11.04)

Hi, this is my second post.In first post I mentioned about how to run & configure XAMPP on windows computer. XAMPP may be the best server to PHP. Now its time to move into Linux. Currently I’m using Ubuntu 11.04 Natty Narwhal edition. Based on that I’ll show you how to install XAMPP on Linux OS.

Earlier day the Linux version of XAMPP called as LAMPP. But it comes as XAMPP with more improvements.

Ok, First of all you need to download the XAMPP for Linux form Apachi Friends.
here is the link for it :http://www.apachefriends.org/en/xampp-linux.html

Before installation , its better to have a MD5 check.To do that you need to login as root user.
1) Now press (Clrt+Alt+T) to open Terminal window
then type sudo -s -H
it will ask your password after that
2) type md5sum xampp-linux-1.7.4.tar.gz
the displaying MD5 should be 7d83c9829d8c79d43ea607e5b009dc58

3) Now you should extract the downloaded archive file to /pot directory

command: tar xvfz xampp-linux-1.7.4.tar.gz -C /opt

You shouldn’t use any extracting tool to extract the archive, it won’t work.And if you already installed a XAMPP version, it will overwritten by this command.Now XAMPP is installed below the /opt/lampp directory.

Now you can check whether XAMPP is working.

command: sudo /opt/lampp/lampp start
you will see a message like this

Ok now XAMPP is working 😀 .But still there is a problem. Your php testing folder is “htdocs”. You can simply move into it  File System–>opt–>lampp–>htdocs

You will noticed that it won’t allow you to put .php file or any thing. Because you haven’t owe the permission yet. Because it belongs to root user.

Change the ownership XAMPP to your user account!

In this case also you need to login as root user.
Now press (Clrt+Alt+T) to open Terminal window
command: sudo -s -H

Now move to lampp folder
command: cd /opt/lampp/

command: chown -R yourUserName:yourUserName htdocs

Important: Here yourUserName is just your user account name of Linux

Also you need to associate ownership of your Linux username with the Apache configuration. In this case move to “etc” folder:

command: cd /opt/lampp/etc/
Now you are in the etc directory. Type gedit httpd.conf. This will show the Linux text editor.

command: gedit httpd.conf

But be careful when editing; a single mistake can make the Apache web server inoperable.
Then find (press Ctrl+F) the following line in that text file..

The text file look like this…

==========================
User nobody

Group nogroup

</IfModule>

</IfModule>
===========================
Change this to:

==========================
User yourUserName

Group nogroup

</IfModule>

</IfModule>
==========================

A picture of the text file on my computer…

Now you can reboot the computer..
After that open the terminal (Ctrl+Alt+T)

then start XAMPP
command: sudo /opt/lampp/lampp start

Then go to firefox type this on address bar http://localhost/
It will take you to the XAMPP welcome page..
Now you can start programming php scripts.. put your PHP script files into “htdocs” folder as I mentioned earlier.
If your php script name is test.PHP ,type this on address bar of firefox.
http://localhost/test.PHP

If you are a beginner and want an test php script.Here it is…

See you in post with How to configure MySQL database (phpMyAdmin) in XAMPP

Enjoy it
Thanks
Gihan

39 Comments

  1. Reply
    Janani Nayanathara June 10, 2011

    great…………. 😀

    • Reply
      abdo March 6, 2013

      thnkss a loot my friennn you really help mee ( it works also in ubuntu 12.10 ) :)
      Graet from morroco

  2. Reply
    ජයංග June 11, 2011

    this is really nice dude keep it up

  3. Reply
    keerthana June 21, 2011

    good job Malan…keep it up…

  4. Reply
    crimit July 3, 2011

    hi

  5. Reply
    Fizwhiz July 11, 2011

    Dear Gihan, firstly, thank you so much for this wonderful tutorial! It’s honestly been much more successful than my previous attempt at installing a LAMP stack on my own (I’m a new linux user and developer). However, every time I fire up XAMPP using the following command: sudo /opt/lampp/lampp start, I get the following:
    Starting XAMPP for Linux 1.7.4…
    XAMPP: Starting Apache with SSL (and PHP5)…
    XAMPP: Starting MySQL…
    XAMPP: Another FTP daemon is already running.
    XAMPP for Linux started.

    And when I stop it, naturally, I get something like this:
    Stopping XAMPP for Linux 1.7.4…
    XAMPP: Stopping Apache with SSL…
    XAMPP: Stopping MySQL…
    XAMPP: XAMPP-ProFTPD is not running.
    XAMPP stopped.

    I’ve googled this trouble extensively for over an hour and I haven’t found a reasonable solution. Firstly, should I be worried about this? If so, then the common solution seems to be using ps aux | grep ftp in order to find the process using the FTP and kill it, but I’m unable to kill ProFTPD for some bizarre reason. Please advise!

    • Reply
      Gihan July 11, 2011

      ProFTPD is a FTP server which already included in XAMMP. And Fizwhiz , you said that you tried LAMMP. If it is so I think the problem is LAMMP was not completly removed. an FTP server is still in it. So that why you are getting message like “Another FTP daemon is already running..” If you can still run http://localhost and not using advantages of FTP server,I think nothing to worry. But if you face any problems, it’s better to remove XAMPP and remove the existing FTP server manually. Then try to install XAMPP. To remove FTP server use this:
      sudo apt-get remove ftp and it should be done after removing XAMPP. Then have a clean installation of XAMPP. :-)

      If you have any doubt, do not hesitate to ask. Thanks :-)

      • Reply
        Fizwhiz July 14, 2011

        Gihan, thanks so much for the prompt response! I got rid of LAMPP and then reinstalled XAMPP in addition to removing ftp, but somehow something else got messed up in the process where the Apache server wasn’t being recognized. I figured it would make my life a lot easier if i just reinstalled ubuntu (Live CD) and repeated the process properly. I just successfully installed XAMPP on my new ubuntu, thanks so much for the straight forward and clear tutorial!

        Respect,
        Fizwhiz

  6. Reply
    Gihan July 14, 2011

    Good luck with your work Fizwhiz, and you are welcome… 😀

  7. Reply
    bl4ck September 25, 2011

    it’s very use full thank you very much gihan …………….. :)

    :shakehand ….

  8. Reply
    shahan October 7, 2011

    I want to completely remove xampp from my system. I am using LinuxMint 11 (exactly same like the ubuntu 11.04, just modified.)

    When I press http://localhost then it ask for the username and password. As I had a previously installed Xampp and I forgot for that one.

  9. Reply
    lay November 15, 2011

    Hi. I’m using Ubuntu 11.10. Where is the Xampp launcher located?

    • Reply
      Gihan November 15, 2011

      launch it with linux terminal window, if you have successful installed as described, run it like this

      sudo /opt/lampp/lampp start

  10. Reply
    leoanto November 16, 2011

    where to put the jsp code to in xampp to run it.

    • Reply
      Gihan November 17, 2011

      Put them into this directory /xampp/tomcat/webapps . And to do this, you should have latest version of XAMPP bond with Tomcat or Tomcat addone. I assume you have it :D.

  11. Reply
    leoanto November 17, 2011

    i downloaded the tomcat from official website and extracted it…it contains the htdocs folder for running php … but i dont find tomcat folder itself…please give the xampp bond version download link..so i will try that one…

  12. Reply
    leoanto November 18, 2011

    thanks i will try jsp in seperate tomcat installation….

  13. Reply
    walshy December 8, 2011

    I installed lampp succesfully and it tested fine (the sample pages in ‘htdocs’).
    the next day I try it, it defaults to looking at var/www/index.html.
    why did it change?
    Plus, I can no longer login to phpmyadmin!

    • Reply
      Gihan December 8, 2011

      Try to clear the cache and restart the server, check it’s working.

  14. Reply
    Janno Reyes December 12, 2011

    Sir I have a question I already downloaded the xampp for linux and after the step 2 i got this kind of error:

    “md5sum: xampp-linux-1.7.4.tar.gz: No such file or directory”

    please help I really need to install XAMPP because I will use it for web development. (Im just new in linux OS) please help me to finish my installation I hope to hear from you soon Sir Gihan thank you very much!

    • Reply
      Janno Reyes December 12, 2011

      I downloaded xampp-linux-1.7.7.tar.gz. I already triend changing .4 to .7 but still same error.

      “md5sum: xampp-linux-1.7.7.tar.gz: No such file or directory”

      please help. . .

      • Reply
        Gihan December 13, 2011

        Hello Janno Reyes, actually the command is md5sum xampp-linux-1.7.7.tar.gz not md5sum: xampp-linux-1.7.7.tar.gz if check carefully you will see you have typed “:” after md5sum and this step is not necessary. It is additional thing to check your downloaded file is a correct file. You can just ignore that step and follow other. If you have any doubt regarding this feel free to ask 😀

      • Reply
        Janno Reyes December 14, 2011

        The error message in step 2 is “xampp-linux-1.7.7.tar.gz: No such file or directory” and if I jump to step 3, still there is an error message “xampp-linux-1.7.4.tar.gz: Cannot open: No such file or directory” please help thanks a lot!!!

        • Reply
          Gihan December 15, 2011

          You should run those command after going to your current directory. If your xampp-linux-1.7.7.tar.gz is in the Desktop. First of all you should go to Desktop directory( cd Desktop). Then try to run the command! I assume that’s the problem you have.

      • Reply
        Janno Reyes December 14, 2011

        tar (child): xampp-linux-1.7.7.tar.gz: Cannot open: No such file or directory
        tar (child): Error is not recoverable: exiting now
        tar: Child returned status 2
        tar: Error is not recoverable: exiting now

        Thats the error what I always have

  15. Reply
    Timjay February 6, 2012

    Gihan, thanks for you blogs, they give me confidence while working with my linux box. This time I am trying to setup xdebug on my Linux Mint 12 for PHP development, but any time I install xdebug it makes my XAMPP to malfunction. When I launch localhost what I will get is:

    “It works! This is the default web page for this server. The web server software is running but no content has been added, yet.”

    Pls, what can I do to solve this problem and what actually am I not doing well? Can you tell me how best to install and configure xdebug on linux mint 12 in other not to have this problem?

  16. Reply

    […] probably suffice. Treats editing the httpd.conf file, and the config.inc.php file of phpMyAdmin gihan: Also treats editing the httpd.conf file arduino: Setting up groups, maybe not necessary. […]

  17. Reply
    vishal gaiwkad March 21, 2012

    how to add php files and see them on browser in case of LINUX server..plz..give me details..step by step i nedd it urgently..thank you

  18. Reply
    Amarjeet Kawathe April 14, 2012

    its a wonderfull tutorial…I done with xampp…. 😀

  19. Reply
    hillary April 20, 2012

    what could be the issue here
    Mobile etc # gedit httpd.conf

    (gedit:30096): EggSMClient-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported

    **
    GLib-GIO:ERROR:/build/buildd/glib2.0-2.28.6/./gio/gdbusconnection.c:2279:initable_init: assertion failed: (connection->initialization_error == NULL)
    Aborted

  20. Reply
    phpblast May 6, 2012

    I good I also found easiest way of installing xampp on linux 32 bit as well as 64 bit distro
    http://www.cellguru.co.cc/2012/05/easy-way-install-xampp-on-64-bit-linux.html

  21. Reply
    wildan May 24, 2012

    hay gihan I try to start and show this
    Starting XAMPP for Linux 1.8.0-beta4…
    XAMPP: XAMPP-Apache is already running.
    XAMPP: Another MySQL daemon is already running.
    XAMPP: XAMPP-ProFTPD is already running.
    XAMPP for Linux started.

    how to remove the another mysql daemon?
    tanks

  22. Reply
    pragendra June 17, 2012

    thanks gihan for this help it works well

  23. Reply
    Chafic July 4, 2012

    Thank you very much sir :)

  24. Reply
    Peter Grimley July 17, 2012

    G’day and thanks for this. I managed to successfully install Xampp with your help, but…
    for some reason, “sudo -s -H” didn’t work for me (Ubuntu 11.10)
    I did something else (can’t remember what) which did work, only now I seem to have lost some privileges although all boxes are ticked I cannot access synaptic, software centre, update manager or Ubuntu one.
    Any ideas?

  25. Reply
    phpblasty July 28, 2012

    Great tutorial , thanks for sharing, a easy way to install Xampp on 32/64 bit (for novice ) Linux distro can be found here
    http://html5planet.blogspot.in/2012/07/install-xampp-on-3264-bit-linux-distro.html

  26. Reply
    TechToyz August 22, 2012

    Nice Article

  27. Reply
    Mohamed Refai October 6, 2012

    Reblogged this on Muhammed Refaai and commented:
    Amazing trick, no need to “gksu nautilus” anymore!

Leave a Reply