---
url: /howto/installing-teamscale/installing-as-linux-service.md
---

# How To Install Teamscale as a Linux Service

You might want to install Teamscale as a Linux service to allow for more consistent management with other services on the same machine and to ensure that Teamscale is automatically started after a reboot.
Additionally, this allows Teamscale to automatically restart in case of a crash.

:::tip Note
Before installing Teamscale as a service, ensure that the basic configuration was completed and that Teamscale can be [started manually](../installing-as-zip-distribution/).
:::

The required files are located in the folder `linux` in the Teamscale installation directory.
You can choose between a `systemd`-based installation or an `init.d`-based one.

\[\[toc]]

## systemd

Most modern Linux distributions support [systemd][systemd].
To see if your system supports it, check for the existence of the directory `/lib/systemd` or the command `systemctl`.
(This procedure was tested on *Ubuntu 20.04*.)

### Installing Teamscale as a systemd Service

1. Modify the file `linux/systemd/teamscale.service` according to the TODO comments inside.

2. Copy the file to `/etc/systemd/system`.

3. Reload the systemd daemon to register the new service by running:
   ```bash
   sudo systemctl daemon-reload
   ```

4. Enable the service to start at boot time by running the following command:
   ```bash
   sudo systemctl enable teamscale.service
   ```

To start the service manually use the following command:

```bash
sudo systemctl start teamscale.service
```

### Uninstalling the Teamscale systemd Service

1. To **uninstall** the systemd service, run the following commands:
   ```bash
   sudo systemctl stop teamscale.service
   sudo systemctl disable teamscale.service
   ```

2. remove the file you copied to `/etc/systemd/system/teamscale.service`

## init.d

The following guide for `init.d` is deprecated (this procedure was tested with *Ubuntu  12.04*).
If possible use `systemd` or `docker` instead.

### Installing Teamscale as a init.d Service

1. Edit the file `teamscale.init`:

   1. Enter or edit the correct path to the Teamscale root directory.
      For example:
      `TEAMSCALE_HOME=/opt/teamscale`

   2. Enter or edit the correct path to the Java installation directory.
      For example:
      ```bash
      export JAVA_HOME=/opt/jdk
      ```

   3. Optionally uncomment and fill the `EXTRA_START_ARGS` line to run the services as a different user.

2. Install the service by running from the command line:
   ```bash
   sudo ./install-service.sh teamscale
   ```

3. Start the service by running the following command:
   ```bash
   sudo service teamscale start
   ```

### Uninstalling the Teamscale init.d Service

If you later have to **uninstall** the `init.d` service run the following command:

```bash
sudo ./uninstall-service.sh teamscale
```

[systemd]: https://systemd.io/
