In this tutorial you will learn how to start a service on boot on Ubuntu 22.04 Jammy Jellyfish Linux. Ubuntu uses systemd service manager to manage services which means to enable and disable services is an easy and straightforward task.
In this tutorial you will learn:
- How to check if a service is enabled or disabled
- How to enable service to start on boot
- How to disable service to start on boot
|Category||Requirements, Conventions or Software Version Used|
|System||Ubuntu 22.04 Jammy Jellyfish|
|Software||systemd (installed by default)|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to start service on boot on Ubuntu 22.04 step by step instructions
In this tutorial we will be using the
apache2service as an example. Therefore, replace the
apache2name with the name of the service you intend to start on boot.
In case you do not know the name of the service you wish to start on boot then follow our guide on how to list services on Ubuntu 22.04.
- First, check the current state of the service to see whether it is enabled to start on boot. To do so, open a command line terminal and execute the following command:
$ systemctl status apache2
Note that the “vendor preset” text tells you whether the service starts automatically by default or not. This is just the default value when the service is installed, and not necessarily what the service is currently set to.
- Use the
systemctlcommand to start the service on boot. For example:
$ sudo systemctl enable apache2
Alternatively, if you also wish to enable and start the service at the same time you may execute:
$ sudo systemctl enable --now apache2
- Once the service is enabled to start on boot you can confirm its status once again by executing:
$ sudo systemctl status apache2
- To disable service to start on boot use
systemctlcommand again. For example:
$ sudo systemctl disable apache2
In this tutorial, we saw how to enable a service to start automatically upon boot in Ubuntu 22.04 Jammy Jellyfish Linux. Ubuntu, like most other modern Linux distros, uses systemd in order to manage services. Once you know how to use the
systemctl disablecommands, you can set any service to start automatically upon boot or not.