Skip to content

How to Install XAMPP on Debian & Ubuntu

How to Install XAMPP on Debian & Ubuntu

XAMPP is a free and open-source cross-platform web server solution stack package, consisting mainly of Apache HTTP Server, MariaDB database, and interpreters for scripts written in the PHP and Perl programming languages. This guide shows you how to install it on Debian and Ubuntu.


Prerequisites

  • Ubuntu 20.04+ / Debian 10+
  • Root or sudo access
  • Internet connection
  • At least 1GB free disk space
Note: XAMPP is not for production use. It’s designed for local development and testing only.

Step 1: Download XAMPP

Visit the official XAMPP download page and download the Linux version, or use wget:

wget https://www.apachefriends.org/xampp-files/8.2.12/xampp-linux-x64-8.2.12-0-installer.run

Make the installer executable:

chmod +x xampp-linux-x64-8.2.12-0-installer.run

Step 2: Run the Installer

Run the installer with root privileges:

sudo ./xampp-linux-x64-8.2.12-0-installer.run

The installer GUI will appear. Follow these steps:

  • Click “Next” to proceed
  • Choose “XAMPP Developer Files” (recommended) or just the core package
  • Choose installation directory (default: /opt/lampp)
  • Click “Next” to begin installation
  • Wait for installation to complete

Step 3: Command-Line Installation (Alternative)

For a non-interactive installation:

sudo ./xampp-linux-x64-8.2.12-0-installer.run --mode text

Or silently:

sudo ./xampp-linux-x64-8.2.12-0-installer.run --mode unattended

Starting XAMPP

Start Apache & MySQL

sudo /opt/lampp/lampp start

You should see:

Starting XAMPP for Linux...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.

Access XAMPP Dashboard

Open your browser and navigate to:

http://localhost

Or for the status page:

http://localhost/xampp

Stopping XAMPP

sudo /opt/lampp/lampp stop

Stop individual services:

  • Stop Apache: sudo /opt/lampp/lampp stopapache
  • Stop MySQL: sudo /opt/lampp/lampp stopmysql
  • Stop FTP: sudo /opt/lampp/lampp stopftp

Useful Commands

  • Secure XAMPP: sudo /opt/lampp/lampp security
  • Restart: sudo /opt/lampp/lampp restart
  • Backup: sudo /opt/lampp/lampp backup
  • Version: sudo /opt/lampp/lampp version

File Locations

  • XAMPP Directory: /opt/lampp
  • Web Root (htdocs): /opt/lampp/htdocs
  • Apache Config: /opt/lampp/etc/httpd.conf
  • PHP Config: /opt/lampp/etc/php.ini
  • MySQL Data: /opt/lampp/var/mysql
  • Log Files: /opt/lampp/logs

Secure Your XAMPP Installation

Run the security script to set passwords:

sudo /opt/lampp/lampp security

This will prompt you to set passwords for:

  • MySQL root password
  • phpMyAdmin password
  • FTP password
Warning: The default XAMPP installation has NO password protection. Always run lampp security on production-facing servers!

Uninstalling XAMPP

Stop all services first:

sudo /opt/lampp/lampp stop

Remove the installation directory:

sudo rm -rf /opt/lampp

Troubleshooting

Port 80 Already in Use

Find and stop what’s using port 80:

sudo lsof -i :80
sudo kill $(PID)

Permission Denied Errors

Ensure correct ownership of htdocs:

sudo chown -R daemon:daemon /opt/lampp/htdocs
sudo chmod -R 755 /opt/lampp/htdocs

MySQL Won’t Start

Check MySQL error logs:

tail -50 /opt/lampp/var/mysql/*.err

Apache Won’t Start

Check Apache error logs:

tail -50 /opt/lampp/logs/error_log

Conclusion

You now have XAMPP installed on your Debian/Ubuntu system. XAMPP includes:

  • Apache – Web server
  • MariaDB – MySQL database
  • PHP – Server-side scripting
  • Perl – Programming language
  • phpMyAdmin – Database management
Congratulations! Your local web development environment is ready!