How to install and configure XAMPP on GNU / Linux

This is an up-to-date guide to how to install and configure XAMPP on GNU / Linux, with a detailed step-by-step.

What is XAMPP?

XAMPP is a completely free and easy to install Apache distribution that contains MariaDB, PHP, and Perl. The XAMPP installation package has been designed to be incredibly easy to install and use. Completely free and easy to install Apache distribution containing MariaDB, PHP, and Perl.

How to install and configure XAMPP?

Installing Xampp

1.- Download XAMPP for Linux from

install and configure XAMPP

2.- At the end of the download we have a archive .run, which we must install in the following way:

  • We open a Terminal with Control + T, or from our menu.
  • We log in as root:

Root Login

  • We proceed to give execution permissions to the .run and to install XAMPP
$ sudo su $ chmod + x $ ./




  • We accept everything and wait for the installation to finish.

Setting up XAMPP

3.- We proceed to configure XAMPP

  • MySQL Configuration (MariaDB)
    $ ln -s / opt / lampp / bin / mysql / usr / bin / $ which mysql $ type mysql $ ls -lart / usr / bin / mysql

    mysql config check mysql config

  • Setting up the rule com.ubuntu.pkexec.xampp.policy for the graphical panel to run with administrator permissions this will generate a bash file that runs For this we go to the route / usr / share / polkit-1 / actions and we execute:
    $ touch com.ubuntu.pkexec.xampp.policy $ nano com.ubuntu.pkexec.xampp.policy

    touch policy nano policy
    Inside the file com.ubuntu.pkexec.xampp.policy we paste the following code:

 Authentication is required to run XAMP Control Panel xampp auth_admin auth_admin auth_admin /opt/lampp/ true
  • Creating the script responsible for executing the graphical panel of XAMPP in the path / usr / bin / . We must create the script with name xampp-control-panel:
    touch xampp-control-panel nano xampp-control-panel

    touch xpc nano xpc

#! / bin / bash $ (pkexec /opt/lampp/;
  • Setting up a .desktop to launch the XAMPP graphical service manager, run the following commands, in the path / usr / share / applications:
    touch xampp-control-panel nano xampp-control-panel

    touch desktop nano desktop

  • After running nano application.desktop enter the following code
[Desktop Entry] Comment = Start / Stop XAMPP Name = XAMPP Control Panel Exec = xampp-control-panel Icon = xampp Encoding = UTF-8 Terminal = false Type = Application
  • Now we have an icon that when pressed will execute the pkexec, which asks us for a login to assign execution permissions to the XAMPP graphical panel. It should look something like this:
    xpc pkexec xampp-pc
  • To use mysql, if you did the previous configuration you no longer need to go to the directory / opt / lampp / bin / mysql -u root -p to log in now you just need to open a terminal and run mysql -u root -p.

Now we can graphically manage our XAMPP and access mysql normally without going to the / opt / lampp / bin directory.

This is all the guide, I hope you liked it and do not forget to leave your comments.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

23 comments, leave yours

Leave a Comment

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



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   federico said

    These are the articles that are most appreciated, for the detailed and precise content of their content. He had helped colleagues who prefer Windows install versions of the XAMPP software. I was unaware of the existence of an installer for Linux, used to installing and configuring a LAMP, manually. I am convinced that it will be a great help for those who want to have a server with these features, and will convince many programmers and administrators who prefer to install it on Windows, to do it on a server with Linux. Thank you Nexcoyotl for such an excellent article!

    1.    Nexcoyotl said

      Thank you very much, Federico, your comment is appreciated, I hope this small and simple manual has been useful. This is the first I hope to do many more.

  2.   Yerko said

    Very good guide

    But I have a question, why do you touch? I understand that it is to create the blank file, but with just nano, you can create and edit the file ...

    1.    federico said

      touch is a command used to update the access and modification dates of one or more files, to the current date.
      touch [OPTINO]… FILE…
      If the argument FILE or file name does not exist, then an empty file of the same name as FILE is created.
      It is more direct - and very common - this way to create empty files, than through the editor dwarf
      Run man touch for more information.

    2.    Nexcoyotl said

      Hello yerko in advance thanks for commenting, the reason why I use touch is because for me it is customary hehe. And if, as comrade Federico said, its function goes beyond the creation of files. If you want to find out more, launch $ man touch, regards friend

      1.    Yerko said

        But, after the touch you are modifying the file, so it is an extra step to what you do.

      2.    Yerko said

        I know what the touch does, I just wanted to know why you were doing it: P, since with nano it was more than enough 😉

  3.   Anonymous said

    Very good documentation, good work.
    What do you use to configure the prompt, I really liked its configuration.


    1.    Nexcoyotl said

      Hello friend, thanks for stopping by and commenting 😀, I use powerline shell it is an open-source project you can find it on github. It's easy to configure I use bash and powerline shell, although you can also configure it for zsh.

  4.   Koratsuki said

    Very good tutorial. The config of the terminal catches my attention, could you share the config?

    1.    Nexcoyotl said

      Hello Koratsuki, check out this tutorial that I do, I hope it will be useful for you to configure the prompt.

  5.   Esteban said

    Very good your contribution Brother, how sad that I have hardly seen this publication, a few weeks ago they left me the task of installing a LAMP environment on my computer, but from what I see it is easier to install XAMPP. Anyway thanks for your contribution, greetings.

  6.   daz08 said

    Great, very well explained and in a simple way.

  7.   MORKE said

    Thank you very much.

    Everything worked fine.


  8.   Katherine said

    Hello, everything that is explained in images, is it also explained in text? That is, the images are for illustrative purposes only? Or there are steps you have to do that are in pictures. I'm asking because I'm blind, and I'm not very adept at linux yet, so I don't want to make a mess haha. On the other hand, I have ubuntu mate 18. Can this tutorial be applied? From already thank you very much. Cheers!

  9.   Leon S said

    Excellent material with illustrative content, this makes it easier to guide others

  10.   Ignacio7 said

    - one side is shown twice
    touch xampp-control-panel
    nano xampp-control-panel
    - one on the route
    / usr / bin /
    - and another on the route:
    / usr / share / applications
    - I guess actually in this second path it should be xampp-control-panel.desktop.
    - On the other hand, to do most of the steps, I didn't have permissions, so I ended up preceeding the commands with «sudo«, so that I could already create them.
    - But in the end when I access the icon it gives me an error message:
    The command "xampp-control-panel" could not be executed.
    Failed to run child process "xampp-control-panel" (Permission denied)

    1.    Ignacio7 said

      - I have already made it work and I have put the execution permission on the / usr / bin / xampp-control-panel file.
      sudo chmod + x / usr / bin / xampp-control-panel

      1.    Harold barboza said

        Thanks this was what I was missing for the permission denied problem.

  11.   Leon S said

    2020 this post still works great!

  12.   Nicksoad said

    Thanks, it worked for me, although I don't see the xampp icon but a white box but it doesn't matter, I just have a problem that when I use a code editor like sublime it denies me the permissions to create files in htdocs projects. I managed to make sublime by giving permissions I can read and edit the files but I can't make it create new files.

  13.   juconta said

    Thanks a million Nexcoyotl for the article !!!, and to all those who make a place where you can find the info we need !!.
    Thanks thanks!!

  14.   Gonzalo said

    Very good explanation

    I use linux mint and I could use one explained with the accesses since I perform the steps and they do not appear in any graphic part
    in advance thank you very much