How to Install XAMPP on Ubuntu 20.04
XAMPP is a cross-platform development environment consisting of Apache, MariaDB, PHP, and Perl. Using XAMPP on an Ubuntu Desktop reduces the installation effort and time for developers. Instead of resolving conflicts between different components of a development stack, developers can focus on their work. The lite version of XAMPP can also be installed if one wants to use MySQL and PHP only. XAMPP uses MariaDB, a drop-in replacement for MySQL, although all the MySQL commands will also work here.
XAMPP also facilitates the installation of commonly used WordPress, Drupal, Joomla, and other applications using Bitnami.
XAMPP can be easily installed with the default installer provided by the official website. It works on almost all major Linux distributions. In this guide, we will see how to install XAMPP on an Ubuntu 20.04 LTS system. Let's dive into the installation procedure. XAMPP requires that you have an Ubuntu Desktop installed.
- Ubuntu 20.04 OS (Desktop) should be installed on your system.
- Access to the internet.
- Superuser access for the current user.
Step 1. Download the XAMPP installer from the official website. Be sure to select only the installer corresponding to Linux:
As you can see this XAMPP version comes with PHP 8.0.3. If you are working with an old PHP version, you can also download the XAMPP installer for that particular PHP version from here.
Step 2. After downloading the installer, navigate to the download folder and open up a terminal there.
Step 3. Now we need to give proper permission to the installer to make it executable:
sudo chmod 755 xampp-linux-x64-8.0.3-0-installer.run
The above command will give the read and write permission for every user and execute permission only for the owner. You can verify the permission of the file with the ‘ls -l’ command.
Step 4. We are now ready to launch the installer. The below command will launch the graphical wizard for installing XAMPP.
Step 5. In the very first window of setup you will see a welcome message from XAMPP, just click ‘next’ to continue:
Step 6. In the subsequent window, select the components to install. By default, both the ‘XAMPP Core Files’ and ‘XAMPP Developer Files’ are selected. We recommend to use the default approach and press the next button:
Step 7. The Installer will now display the installation directory which is usually ‘/opt/lampp’ on Linux systems:
Step 8. In the next window, the installer will describe the bitnami modules for XAMPP. Just continue by hitting next:
Step 9. Once the above steps are completed, the setup will display the message “Setup is now ready to install XAMPP on your computer”. Click next to proceed:
Step 10. The installer will unpack the files and start the installation process as shown here:
Step 11. You will see a completion message for the installation process in the end. If you want to start the XAMPP now, check the ‘Launch XAMPP’ label and press the finish button:
Step 12. Another way to start XAMPP is to use the command:
sudo /opt/lampp/lampp start
Similarly, to stop XAMPP, use the above command as:
sudo /opt/lampp/lampp stop
Step 13. After clicking the finish button in the above step, a graphical manager for XAMPP will be launched:
We can use the Manage Servers tab to start and stop various XAMPP services:
When you close the XAMPP window after installation, you will find it hard to start the graphical interface for XAMPP although you can use the command in Step 12 to start and stop the XAMPP services. Now to start XAMPP gui, use the below command:
To create a desktop shortcut for the XAMPP gui, follow the steps below:
i) Create a new file called as xampp.desktop using the below command:
ii) Now put the following content to this file and then close it after saving it:
Exec=sh -c "pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY sudo /opt/lampp/manager-linux-x64.run"
iii) Now go to the desktop window and right-click the xampp icon. Here select the option ‘Allow Launching’:
iv) After the above step the Xampp icon will appear in place of the previous icon. Right-click the XAMPP icon and select the option ‘open’:
v) You'll need to enter the superuser password to see the main XAMPP window as shown here:
Now we can control the XAMPP from the below window:
Testing the XAMPP Setup
To verify if the XAMPP is correctly installed, go to the URL http://localhost/dashboard. If everything is configured correctly, you will see the below page:
So we have successfully installed XAMPP on Ubuntu 20.04. It is very easy to install XAMPP on Ubuntu as compared to Windows. XAMPP is only meant for testing purposes of a workload. It is not secure to deploy a XAMPP application in a production environment. This is because it has many security potholes for making the development flexible. Once a XAMPP project has passed the testing stage, it can be easily transferred to a live production system.