How to install XAMPP on Ubuntu 20.04 LTS

Although Ubuntu 20.04 or its earlier Linux versions we don’t need to install XAMPP because using a few commands, we can set up the LAMP environment on Ubuntu. Thus, for Windows, it is a greater piece of software. However, if you don’t want to go through various commands to set up a LAMP, the XAMPP is the best option.

What is XAMPP? 

If you want to develop software for the web or create a website, you need a test environment that is not accessible from outside but includes all the necessary tools. XAMPP from Apachefriends offers such a development environment. It allows the creation of a Local web server with Apache, PHP, Perl, and MySQL.

In addition to Apache, MySQL, PHP, and Perl, other programs such as phpMyAdmin for the administration of MySQL, OpenSSL for encryption of network connections, FileZilla as an FTP server and the Mercury Mail Transport System is an email server with POP, SMTP, and IMAP are included. In addition, the web analysis tool Webalizer is available, although the path in webalizer.php may have to be adapted in the event of problems.

XAMPP is designed as a pure test system and aims to be ready for use quickly. Thus, not meant to serve as a web server for commercials because it does not offer adequate protection against possible hacker attacks there. Apart from Windows and macOS, it almost supports all Linux distributions such as Debian, RedHat, CentOS, Ubuntu, Fedora, Gentoo, Arch, and SUSE.


  • Graphical Ubuntu 20.04 LTS Linux
  • A non-root user with sudo rights.

Use Xampp on Ubuntu 20.04 LTS focal Fossa

You can follow the below steps not only for Ubuntu Focal Fossa but also for earlier versions such as Ubuntu 19.10/19.04/18.10/18.04/16.04… Linux Mint, Debian, Elementary OS…

Step 1: Download XAMPP for Ubuntu Linux

The first thing we need is the executable binary of XAMPP on our Ubuntu 20.04 LTS. For that, we simply visit the official website of this tool. Here is the link.

Scroll down to the section where the XAMPP Linux packages are available to download. You will see three versions there.

Expect the PHP version, the rest of the tools in all three versions will be the same. Thus, as per the requirement of the PHP version of your project download the one.

Apachefriends download XAMPP
Apachefriends download XAMPP

Here we are downloading the latest PHP version, however, you can go for any of them. Click on the Download button.

Step 2: Open Command Terminal

You can either use the shortcut- CTRL+ALT+T or simply go to the Applications from Activities option and search for the Terminal and run it.

Step 3: Change permission and Run the XAMPP installer

By default, whatever we are downloading from the internet using the browser on Linux systems, goes into the Downloads folder, thus first switch to that first.

cd Downloads

Change the permission of the installer. 755 means read and execute access for everyone and write access to the owner of the file

chmod 755 xampp-linux-*

Run the installer

sudo ./xampp-linux-*

Step 4: Setup Installer Wizard

The moment you run the installation command, an XAMP setup wizard will open. Click on the Next button.

Run Bitnami XAMPP
Run Bitnami XAMPP

Select both the components “XAMPP Core files” and XAMPP Developer files and then NEXT.

Select XAMPP components to install
Select XAMPP components to install

By default, all the files will unpack under /opt/lampp.

Default installation folder
Default installation folder

ProgressClick on the Finish and the XAMPP will be on your Ubuntu 20.04 LTS system.

XAMPP installed on Ubuntu Linux
XAMPP installed on Ubuntu Linux

Once the installation is done, the system will automatically start the XAMPP, however for later you can use the command terminal:

sudo /opt/lampp/./

Step 5: Start Apache and MySQL server

Go to the Manage Server Tab and corresponding to Web server and Database click on the start button. To change their running ports select Configure one.

Install XAMPP server on Ubuntu 22.04

Step 6. XAMPP Desktop Shortcut

We need to create a file that will be used as a Desktop shortcut in which add some entries that will let the system execute and launch the XAMPP application.

nano Desktop/XAMPP.desktop

Add Lampp server and icon path

Inside the above-created launcher file, copy and paste the below entries which define the type of the shortcut, and the path to execute along with the icon.

[Desktop Entry]
Exec=sudo /opt/lampp/

Save the file using Ctrl+O, hit the Enter key, and then exit the file – Ctrl+X.

Now give sudo permission to your desktop shortcut.

sudo visudo

Scroll to the end of the file and past the given line:

your-user ALL = NOPASSWD: /opt/lampp/

Note: Don’t forget to replace the your-user with the current user that you are using to run XAMPP on your Ubuntu 20.04 LTS system.

Now, right-click on the Desktop shortcut and select “Allow Launching“.

Step 7: Stop or Start the XAMPP server

In the future, if you want to stop the service of this tool, simply use the following command with sudo.

To stop all Xampp running services:

sudo /opt/lampp/lampp stop

And if you want to start them again via the command line:

sudo /opt/lampp/lampp start

Step 8: Uninstall Xampp from Ubuntu 20.04

To completely uninstall or remove the XAMPP server from your system, let’s see the command that you can use.

sudo /opt/lampp/./uninstall
Uninstalling XAMPP from Ubuntu 22.04

To remove shortcuts:

sudo rm ~/Desktop/XAMPP.desktop
sudo rm /usr/share/applications/XAMPP.desktop

12 thoughts on “How to install XAMPP on Ubuntu 20.04 LTS”

  1. I like your tutorial, a lot. However, as a stone-cold beginner, after step 5, what’s next? Are php and brackets already installed? How do I start using php and brackets on Ubuntu 20.04? Ok, if brackets is installed I can start that. What if Brackets is not installed? and how do I set it up for PHP? The book that I’m learning PHP from doesn’t have all of this detail.

  2. Nicely done easy to follow. Is XAMPP also updated it self or will it update the Apache MySQL and PHP if i run the update and upgrade just like LAMP? Thanks

  3. I am searching on google how to install xampp and I find your post. And after reading your content, hopefully, now we can install xampp. Thank you!

  4. LAMP despite being aged is still relatively complex thus XAMP is a great help. Thanks for a very helpful and high quality info and looking forward to more.

  5. Thanks to this info I installed XAMPP in one sitting and this is immediately after I installed Mint 21 on a old Fujitsu Lifebook T-series!! this laptop is slow but still dependable as ever.

  6. very interesting tutorial
    the command:
    sudo /opt/lampp/./
    does not work on my ubuntu 22.04.1 (is it the point in the middle correct?)
    in my file system I don’t find the file
    where should it be?
    how can i execute xampp control center?
    thanks for the support


Leave a Comment

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