How to Install and Configure XAMPP on Ubuntu 24 Server (Latest Version – 2026 Complete Guide)

Posted by

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

If you are using Ubuntu 24 Server and want to install XAMPP (latest version) for PHP, MySQL, and Apache in one package, this guide will walk you through everything step by step.

This tutorial is written especially for:

  • VPS users
  • Dedicated Ubuntu servers
  • Developers migrating from Windows to Linux
  • Laravel, WordPress, Eventmie, or custom PHP users
  • Anyone who wants a simple LAMP stack setup quickly

This guide includes:

  • Installing the latest XAMPP on Ubuntu 24
  • Starting and stopping services
  • Fixing common errors
  • Setting permissions correctly
  • Enabling WebP support
  • Using Imagick (recommended)
  • Making XAMPP auto-start on boot
  • Security best practices
  • Hosting multiple domains
  • Production warnings
  • Troubleshooting tips

Everything is explained in simple language.


1. What is XAMPP?

XAMPP is a complete Apache distribution that includes:

  • Apache Web Server
  • MySQL / MariaDB
  • PHP
  • phpMyAdmin
  • ProFTPD (optional)

Instead of installing Apache, PHP, and MySQL separately, XAMPP gives everything in one installer.

On Linux, it installs in:

/opt/lampp

2. Should You Use XAMPP on Ubuntu 24 Server?

Before installing, understand this clearly:

XAMPP is primarily designed for development environments.

If your server is production and public, the better approach is:

  • Nginx or Apache (native)
  • PHP-FPM
  • MariaDB
  • Let’s Encrypt SSL

However, if:

  • You are testing software
  • You frequently reinstall apps
  • You want portability
  • You want minimal configuration

Then XAMPP is fine.


3. System Requirements for Ubuntu 24

Make sure your server has:

  • Ubuntu 24.04 LTS
  • Minimum 2GB RAM (4GB recommended)
  • Root or sudo access
  • Ports 80 and 443 open

Check your Ubuntu version:

lsb_release -a

4. Update Ubuntu 24 First

Always update before installing:

sudo apt update
sudo apt upgrade -y
sudo apt install wget curl net-tools unzip -y

5. Download Latest XAMPP for Linux

Go to the official website:
https://www.apachefriends.org

At the time of writing, latest version is:

XAMPP 8.2.x (PHP 8.2)

Download using terminal:

cd /tmp
wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/8.2.12/xampp-linux-x64-8.2.12-0-installer.run/download -O xampp-installer.run

Make installer executable:

chmod +x xampp-installer.run

6. Install XAMPP on Ubuntu 24 Server

Since Ubuntu Server has no GUI, use text mode:

sudo ./xampp-installer.run --mode text

Follow prompts:

  • Press Enter
  • Accept default install path (/opt/lampp)
  • Complete installation

After installation, XAMPP is installed in:

/opt/lampp

7. Start and Stop XAMPP

Start:

sudo /opt/lampp/lampp start

Stop:

sudo /opt/lampp/lampp stop

Restart:

sudo /opt/lampp/lampp restart

Check status:

sudo /opt/lampp/lampp status

8. Open Firewall Ports

If UFW is active:

sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable

Now open browser:

http://your-server-ip

You should see XAMPP dashboard.


9. Where to Put Website Files?

Your web root is:

/opt/lampp/htdocs

Example test:

echo "<?php phpinfo(); ?>" | sudo tee /opt/lampp/htdocs/info.php

Visit:

http://your-server-ip/info.php

10. Fix Permission Issues (Very Important)

By default, only root can modify htdocs.

Give ownership to your user:

sudo chown -R $USER:$USER /opt/lampp/htdocs

Now you can upload Laravel, WordPress, or other apps without permission errors.


11. Secure XAMPP

Run:

sudo /opt/lampp/lampp security

Set:

  • MySQL root password
  • Disable phpMyAdmin remote access if needed

Never leave MySQL without password on a public server.


12. Make XAMPP Start Automatically on Boot

Create service file:

sudo nano /etc/systemd/system/lampp.service

Paste:

[Unit]
Description=XAMPP
After=network.target

[Service]
Type=forking
ExecStart=/opt/lampp/lampp start
ExecStop=/opt/lampp/lampp stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Enable:

sudo systemctl daemon-reload
sudo systemctl enable lampp
sudo systemctl start lampp

13. Enable WebP Support (Very Important for Modern Websites)

Many people face WebP errors in Ubuntu.

First check:

/opt/lampp/bin/php -m | grep imagick

Check WebP:

/opt/lampp/bin/php -r 'print_r(gd_info());'

If WebP is missing in GD, best solution is to use Imagick.

Check Imagick WebP support:

/opt/lampp/bin/php -r 'print_r(\Imagick::queryFormats());'

If WEBP is present, you are good.

If not, install ImageMagick system dependency:

sudo apt install imagemagick -y

Restart XAMPP.

Imagick is more reliable than GD for WebP.


14. Common Problems and Solutions

Problem: Apache not starting

Solution:
Check if port 80 is used:

sudo netstat -tulpn | grep :80

Stop Apache2 if installed:

sudo systemctl stop apache2
sudo systemctl disable apache2

Restart XAMPP.


Problem: MySQL not starting

Check:

sudo netstat -tulpn | grep :3306

Stop system MySQL:

sudo systemctl stop mysql
sudo systemctl disable mysql

Restart XAMPP.


Problem: Permission denied uploading files

Fix:

sudo chown -R $USER:$USER /opt/lampp/htdocs

15. Hosting Multiple Domains in XAMPP

Edit virtual hosts:

sudo nano /opt/lampp/etc/extra/httpd-vhosts.conf

Example:

<VirtualHost *:80>
    DocumentRoot "/opt/lampp/htdocs/site1"
    ServerName site1.local
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/opt/lampp/htdocs/site2"
    ServerName site2.local
</VirtualHost>

Enable vhosts in:

/opt/lampp/etc/httpd.conf

Uncomment:

Include etc/extra/httpd-vhosts.conf

Restart XAMPP.


16. Is XAMPP Safe for Production?

Short answer: Not recommended.

Why?

  • Runs as root
  • Minimal security hardening
  • Not optimized for performance
  • No automatic SSL

If hosting real business app, use native stack.


17. How to Uninstall XAMPP

sudo /opt/lampp/uninstall

18. Final Recommendations

If you:

  • Frequently reinstall Eventmie
  • Work on Laravel projects
  • Need portable LAMP stack
  • Want quick testing environment

Then XAMPP on Ubuntu 24 is perfect.

If you:

  • Run high traffic site
  • Need advanced security
  • Need scalable environment

Then configure Nginx + PHP-FPM instead.

Leave a Reply

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