XAMPP is a free and open-source cross-platform web server solution stack package developed by Apache Friends, consisting mainly of the Apache HTTP Server, MariaDB database, and interpreters for scripts written in the PHP and Perl programming languages.

Here in this post, We will see How To Auto Start XAMPP or LAMPP at Startup in Ubuntu.

As we all know that we have to manually start this service every time we restart our ubuntu.

To solve this, we will create a script that starts the XAMPP during the boot time, This tutorial provides scripts for both earlier and later versions. If your Ubuntu version is 18.04 or higher then use the first script from the below section. If your Ubuntu version is lower than 18.04 I think this is not going to help you.

Now Creating a script to start XAMPP automatically in Ubuntu 18.04 or later

Run the following command.

sudo gedit /etc/systemd/system/xampp.service

This command, if already not created, creates a new file named  xampp.service  in the directory  /etc/systemd/system/  and opens it for editing.

In the opened file, add the following lines and save the file


ExecStart=/opt/lampp/lampp start
ExecStop=/opt/lampp/lampp stop


Once the script file is created, run the following command to instruct Ubuntu to execute it at the startup.

sudo systemctl enable xampp.service

That's it, Now reboot your pc to see the change.