# Linux server

Source: https://tiltas.openpanel.sh/docs/devices/linux-server

> Install Tiltas on a Linux server with one command and join it to your Network with a Join key.

A server joins your Network without a browser, with a [Join key](/docs/devices/join-keys). One command installs Tiltas
and joins it. The machine becomes a **Server**: it belongs to the Account, not to a person, and its sign-in does not
expire.

**Needs:** a 64-bit Linux (x86_64 or arm64) with systemd, `curl` or `wget`, `sha256sum`, and `sudo`.

## Install and join

In the [console](/app), open **Join keys** and choose **Create Join key**. Name it after the machine, such as
“web-1”, and choose **Create Join key**. The key starts with `qlj_` and is shown once.

Copy the command under **Install and join** and run it on the server:

```bash
curl -fsSL https://tiltas.openpanel.sh/install.sh | sudo sh -s -- --join-key qlj_your_join_key
```

The installer needs root, so it runs under `sudo`; run without it, it stops and says so.

In the console, **Devices** lists the server as **Online** with its address, such as `100.64.0.7`.

The server is private until you say who may reach it: add an [Access rule](/docs/access) for the whole machine, or a
[Service](/docs/services) for one program on it.

## What the installer does

1. Picks the build for this CPU (amd64 or arm64), downloads it and checks it against the published `SHA256SUMS`.
2. Installs `tiltas` and `tiltasd` into `/usr/local/bin` and the systemd unit `tiltasd.service`, with its settings in
   `/etc/default/tiltasd`. The state, with the Device's sign-in, is kept in `/var/lib/tiltas`.
3. Enables and starts `tiltasd`, then prints the version it installed.
4. With a Join key, joins the Network. The key goes to `tiltas up` in a file only root can read, never on another
   command line.

Without `--join-key`, it installs and stops there, saying what to run next:

```text title="Output" noCopy
Run 'sudo tiltas up' to sign this Device in.
```

## Options

Add options after `sh -s --`. Each has an environment variable too.

| Option | Variable | What it does |
|---|---|---|
| `--join-key KEY` | `TILTAS_JOIN_KEY` | Joins as a Server with this Join key. Without one, run `sudo tiltas up` later. |
| `--name NAME` | `TILTAS_NAME` | This Device's name in the Network (default: the host name). Lowercase letters, digits and hyphens, at most 63, such as `web-1`. |
| `--client NAME` | `TILTAS_CLIENT` | For a desktop that signs in with another product's account: `openpanel` makes the next step `sudo tiltas up --client openpanel`. |
| `--version V` | | A specific version instead of the latest. |
| `--base-url URL` | `TILTAS_DOWNLOAD` | Where the builds and `SHA256SUMS` are downloaded from. |
| `--panel URL` | `TILTAS_PANEL` | A Panel other than `https://tiltas.openpanel.sh`. |
| `--uninstall` | | Signs out, stops `tiltasd`, and removes Tiltas with its settings and state. |

For example, to name the server:

```bash
curl -fsSL https://tiltas.openpanel.sh/install.sh | sudo sh -s -- --join-key qlj_your_join_key --name web-1
```

## Tiltas already installed

On a machine that already has Tiltas, join with `tiltas up`. To keep the key out of your shell history and the process
list, put it in a file only root can read and pass `file:` and its path:

```bash
sudo tiltas up --join-key file:/root/join-key
```

`sudo tiltas up --join-key qlj_your_join_key` works too, and so does the variable `TILTAS_JOIN_KEY`.

## Check it

```bash
sudo tiltas device
```

```text title="Output" noCopy
Device ID  dev_738arbrsr2
Address    100.64.0.7
Name       web-1
Panel      https://tiltas.openpanel.sh
```

`sudo tiltas device --json` prints the same as one JSON object, for scripts. `tiltas status` lists this Device and the others
it sees, one per line: address, name, owner (Servers show as `tagged-devices`), system and state.

The service's own log:

```bash
journalctl -u tiltasd
```

## Firewalls

**On your router, nothing needs to be opened.** Devices only make outgoing connections: to the Coordinator and the
Relays on HTTPS port `443`, and to a public STUN server to learn their public address.

**On the server's own firewall,** if it filters incoming traffic (for example `ufw` with its default deny), allow two
things so other Devices can connect directly instead of through a Relay, and so traffic that arrives over Tiltas is
let in:

```bash
sudo ufw allow 41641/udp
sudo ufw allow in on tiltas0
```

`41641` is the UDP port `tiltasd` listens on (`PORT` in `/etc/default/tiltasd`); `tiltas0` is its network interface.
Access rules still decide who may reach what.

If Tailscale also runs on this machine, both use addresses in `100.64.0.0/10`: see
[Tiltas and Tailscale on one machine](/docs/troubleshooting/tailscale).

## Share a LAN

A Linux server can give your other Devices the network behind it. See [Subnet routers](/docs/access/subnet-routers).

## Update

Run the installer again, without a Join key:

```bash
curl -fsSL https://tiltas.openpanel.sh/install.sh | sudo sh
```

It installs the latest version and restarts `tiltasd`. The Device keeps its sign-in in `/var/lib/tiltas` and
reconnects by itself, so you need not run `tiltas up` again, whatever the installer prints at the end.

## Sign out

```bash
sudo tiltas logout
```

```text title="Output" noCopy
Removed this Device from its Network.
```

It disconnects and removes the Device from your Network, as removing it in the console does. If the Panel cannot be
reached, the Device is still signed out here and the command says so: then remove it in the console under
**Devices**. Sign in again with `sudo tiltas up --join-key …`.

## Uninstall

```bash
curl -fsSL https://tiltas.openpanel.sh/install.sh | sudo sh -s -- --uninstall
```

It signs the Device out (the Panel removes it), stops and disables `tiltasd`, and removes `tiltas`, `tiltasd`, the
unit, its settings and `/var/lib/tiltas`.

```text title="Output" noCopy
Signed out.
Tiltas is uninstalled.
```
