A step-by-step guide for installing XAMPP on Ubuntu with convenience scripts and common troubleshooting solutions. Suitable for both beginners and developers.
Before installing XAMPP, ensure you have the following requirements:
-
🔧 Net Tools Package
- Required for network utilities
- Install using the command:
sudo apt install net-tools
-
💻 System Requirements
- Operating System: Ubuntu (any recent version)
- Minimum 512MB RAM
- At least 2GB free disk space
- Visit the official XAMPP website
- Download the latest version for Linux
- Save the installer file
-
Navigate to Downloads Directory
cd ~/Downloads
-
Make Installer Executable
sudo chmod +x xampp-linux-*-installer.run
-
Execute the Installer
sudo ./xampp-linux-x64-8.2.12.0-installer.run
-
Follow Installation Wizard
- Click "Forward" to proceed through each step
- Accept the default settings unless you have specific requirements
Run the XAMPP Control Panel:
sudo /opt/lampp/manager-linux-x64.run
Create a script to automatically handle service conflicts and launch XAMPP:
-
Create the Script File Create a file named
manage-services.sh
with the following content:#!/bin/bash # Function to check sudo status check_sudo() { # Check if sudo is available without a password sudo -n true 2>/dev/null if [ $? -eq 0 ]; then return 0 # Sudo is available without password else return 1 # Sudo needs a password fi } # Ensure sudo privileges if check_sudo; then echo "Sudo access is already available." else echo "Please enter your sudo password to continue..." sudo -v if [ $? -ne 0 ]; then echo "Invalid sudo password. Exiting script." exit 1 fi fi # Reload systemd to prevent warnings echo "Reloading systemd daemon to ensure up-to-date service configurations..." sudo systemctl daemon-reload sleep 1 # Function to stop a service stop_service() { local service_name=$1 echo "Stopping $service_name..." sudo systemctl stop "$service_name" } # Stop services stop_service "apache2" stop_service "mysql" # Delay for better user feedback echo "Waiting a second before starting XAMPP manager..." sleep 1.5 # Start XAMPP manager echo "Starting XAMPP manager..." sudo /opt/lampp/manager-linux-x64.run # Final message echo "XAMPP is now running! If you encounter issues, try restarting all services using the command: 'sudo systemctl restart apache2 mysql'."
-
Make Script Executable
sudo chmod 755 manage-services.sh
-
Run the Script
./manage-services.sh
If you're still encountering issues, try pressing Restart All 🔄.
Access the XAMPP dashboard and phpMyAdmin:
http://localhost/phpmyadmin/
This guide was created with reference to:
- How to Install XAMPP on Ubuntu by PhoenixNAP