> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Start, Stop and Enable a Service with systemctl

> Start a service with sudo systemctl start nginx and make it run at boot with sudo systemctl enable nginx. Also stop, restart, reload and check service status.

To start a service, run `sudo systemctl start nginx`. To make it start automatically at boot, run `sudo systemctl enable nginx`, or do both at once with `sudo systemctl enable --now nginx`. Check it with `systemctl status nginx`: a running service shows `Active: active (running)`. These commands work on every modern Linux distribution that uses systemd, including Ubuntu, Debian, AlmaLinux and Rocky Linux.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Beginner | 5 minutes | Ubuntu 22.04 / 24.04, Debian 12 / 13, AlmaLinux / Rocky 9 / 10, Fedora, openSUSE, Arch | sudo or root access |

## Before you start

* [Connect with SSH](https://help.freakhosting.com/portals/other/how-to-connect-to-a-linux-server-with-ssh.md). Commands that change a service need `sudo`; root can leave it out. Viewing status and lists works without it.
* **systemd** is the program that starts and supervises services on your server. A **unit** is one thing it manages; services end in `.service`, and you can usually leave the suffix out.

## systemctl commands at a glance

| Task | Command |
| - | - |
| Start now | `sudo systemctl start nginx` |
| Stop now | `sudo systemctl stop nginx` |
| Restart (stop + start) | `sudo systemctl restart nginx` |
| Reload config without stopping | `sudo systemctl reload nginx` |
| Start at boot | `sudo systemctl enable nginx` |
| Start at boot and now | `sudo systemctl enable --now nginx` |
| Don't start at boot | `sudo systemctl disable nginx` |
| Stop and don't start at boot | `sudo systemctl disable --now nginx` |
| Show status and recent log | `systemctl status nginx` |
| Is it running? | `systemctl is-active nginx` |
| Starts at boot? | `systemctl is-enabled nginx` |
| Block it from starting at all | `sudo systemctl mask nginx` (undo: `unmask`) |

`start` and `stop` act now. `enable` and `disable` only change what happens at the next boot. A service can be running but disabled, or enabled but stopped.

## How to start a service and enable it at boot

**1. Start and enable**

```bash theme={null}
sudo systemctl enable --now nginx
```

Expected output on the first enable:

```text theme={null}
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
```

**2. Check the status**

```bash theme={null}
systemctl status nginx
```

```text theme={null}
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: enabled)
     Active: active (running) since Wed 2026-11-04 10:15:02 UTC; 5s ago
```

`enabled` on the **Loaded** line means it starts at boot. Press `q` to leave the status view.

## Service names differ between distributions

Use the right name, or systemctl reports `Unit ... not found`.

| Software | Ubuntu / Debian | AlmaLinux / Rocky |
| - | - | - |
| SSH server | `ssh` | `sshd` |
| Apache | `apache2` | `httpd` |
| Cron | `cron` | `crond` |
| Firewall | `ufw` | `firewalld` |
| MariaDB | `mariadb` | `mariadb` |
| nginx | `nginx` | `nginx` |

On Ubuntu 24.04, SSH listens through `ssh.socket` by default. If you change the SSH port, follow [how to change the SSH port](https://help.freakhosting.com/portals/other/how-to-change-the-ssh-port.md), not just a restart of `ssh`.

## Restart or reload?

`reload` tells the program to reread its config while it keeps running, so open connections aren't dropped. Not every service supports it; if it doesn't, systemctl says so. `sudo systemctl reload-or-restart nginx` uses reload when possible and restart otherwise.

> [!WARNING]
>
> Before you restart SSH, a firewall or a network service, test the config first (`sudo sshd -t`, `sudo nginx -t`) and keep your current SSH session open. If a bad config locks you out of a VPS, use the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md). Never `stop` or `mask` the `ssh`/`sshd` service while you are connected through it.

## How to list services

```bash theme={null}
systemctl list-units --type=service --state=running   # running now
systemctl list-unit-files --type=service --state=enabled   # start at boot
systemctl --failed                                     # failed units
```

## How to see why a service failed

**1. Read the status**

```bash theme={null}
systemctl status myapp
```

Look at the `Active:` line (for example `failed (Result: exit-code)`) and the last log lines underneath.

**2. Read more of the log**

```bash theme={null}
sudo journalctl -u myapp -n 100 --no-pager
```

See [how to read logs with journalctl](https://help.freakhosting.com/portals/other/how-to-read-logs-with-journalctl.md).

**3. Fix and start again**

After fixing the cause, clear the failed state and start it:

```bash theme={null}
sudo systemctl reset-failed myapp
sudo systemctl start myapp
```

## How to check it worked

```bash theme={null}
systemctl is-active nginx
systemctl is-enabled nginx
```

Expected output:

```text theme={null}
active
enabled
```

To be fully sure the service comes back after a reboot, reboot in a quiet period with `sudo reboot` and check again.

## Frequently asked questions

### What is the difference between `systemctl` and `service`?

`service nginx restart` is an older command. On systemd systems it passes the request on to systemctl, so both work, but systemctl has more options such as `enable` and `status`.

### Why does systemctl say "Failed to connect to bus" or "System has not been booted with systemd"?

You are in a container, chroot or rescue system where systemd isn't running. On a normal VPS boot this doesn't happen.

### How do I edit a service's settings without changing the package file?

Run `sudo systemctl edit nginx`. It creates an override file in `/etc/systemd/system/nginx.service.d/` that survives package updates. See [create a systemd service](https://help.freakhosting.com/portals/other/how-to-create-a-systemd-service.md).

### When do I need `systemctl daemon-reload`?

After you create or change a unit file by hand. `systemctl edit` does it for you.

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every server guide in one place.

> [card] [Create a systemd service](https://help.freakhosting.com/portals/other/how-to-create-a-systemd-service.md)
>
> Run your own app as a service.

> [card] [Read logs with journalctl](https://help.freakhosting.com/portals/other/how-to-read-logs-with-journalctl.md)
>
> Find out why a service failed.

> [card] [Check open ports](https://help.freakhosting.com/portals/other/how-to-check-open-ports-on-linux.md)
>
> See what a service listens on.

> [card] [Kill a process](https://help.freakhosting.com/portals/other/how-to-kill-a-process-on-linux.md)
>
> Stop a program that hangs.

***

> [!NOTE]
>
> **Checked against the official [systemctl manual](https://www.freedesktop.org/software/systemd/man/latest/systemctl.html)** on 4 November 2026. Our test container doesn't run systemd as its init system, so service start and stop commands were not tested there. Commands can differ on other distributions or releases.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.