How to Start XAMPP Automatically in Ubuntu

How to start XAMPP automatically in Ubuntu


In the last tutorial we learned how to install XAMPP web server on Ubuntu operating system. But have you noticed that XAMPP server doesn’t start at boot time. You have to start XAMPP server manually every time you want to use it. But that’s not going to be an issue anymore. This tutorial will fix that.

This is a step-by-step tutorial on how to start XAMPP server on Ubuntu automatically on boot. To follow this tutorial, you need to have the following requirements:

  • A computer with Ubuntu operating system installed.
  • XAMPP server software.
  • Basic knowledge of Ubuntu terminal. With basic I mean, how to open a terminal on Ubuntu and how to execute commands.

Let’s get started.

Step 1: First open the terminal of your Ubuntu operating system. You can open your terminal by pressing Control, Alt and T at the same time. You can also go to the Unity dashboard and search by the keyword “Terminal” and click on the terminal. Or you can right click on the Desktop and click on “Open Terminal”.

Step 2: Now we have to create a file that will execute the command to start XAMPP server once the computer boots automatically. To do that we have to create a file under /etc/init.d . Type in the following command and press enter.

“sudo gedit /etc/init.d/xampp”

Type in your password and press enter.


Step 3: Gedit text editor will open. Now write the following bash commands on the file and save it.


Once saved, close gedit text editor.

Step 4: Now we have to make the bash script executable. So Ubuntu can execute it at boot time. To do that type in the following command on the Terminal and press Enter.

“sudo chmod +x /etc/init.d/xampp”

This command will make /etc/init.d/xampp file executable.

Step 5: Now we have to add it as the startup of all the run levels of Ubuntu that support networking. To do that, on the Ubuntu terminal, type in the following command and press Enter.

“sudo update-rc.d xampp defaults”

This command will basically copy this file to directories rc0.d, rc1.d, rc2.d, rc3.d, rc4.d etc.

Step 6: Now to test if everything is working as expected we have to restart our Ubuntu operating system.

Step 7: Once the Ubuntu system is restarted, open Mozilla Firefox or any other web browser of your choice and goes to http://localhost or .

You will see the welcome screen of XAMPP web server.


That’s how you start XAMPP automatically on startup on Ubuntu operating system.