---
title: Linux install
description: The install.sh one-liner, every option it takes, what it installs where, and the order it does things in.
section: Linux
order: 10
---

A Linux machine joins an existing Bridge with one command. Bridge generates it
for you from either of two places, and the key decides what the machine becomes:

- **Add a device** (Settings > My machines) or **Add one of my devices**
  (Settings > Members), then **Installing on Linux?** on the key. The machine
  joins as one of your devices, the same as a laptop would.
- **Add a machine** in a project's **Set up workspace** dialog. Keys from there
  are agent-only: the machine runs its owner's agent and nobody can sign in to
  Bridge from it (see step 7 below).

```bash
curl -fsSL https://bridgedesktop.com/install.sh | sh -s -- inv_v2_...
```

With an invite key the script only ever joins the team the key came from.
`--server` is the one option that creates a new team, and it refuses an invite.
On a machine that is already on another Bridge, the same command adds this one
beside it (see [More than one Bridge](#more-than-one-bridge)).

Or it hosts a new Bridge of its own (see [Self-hosting](/docs/self-hosting/)):

```bash
curl -fsSL https://bridgedesktop.com/install.sh | sh -s -- --server --owner dan
```

Source: `site/public/install.sh` in the Bridge repository; the script you
download is that file, byte for byte. It is POSIX `sh`, so it runs under
`dash` on a fresh Debian as well as `bash`.

## Requirements

- Linux with systemd, on `x86_64` or `aarch64`. A Raspberry Pi running 64-bit
  Raspberry Pi OS is supported.
- `curl` and `tar`.
- Root. Run as a normal user and the script re-runs itself under `sudo`.
- `--server` additionally needs glibc, because the Bun-compiled server links it.
  Debian, Ubuntu, Fedora and Raspberry Pi OS have it; Alpine does not.

## Options

| option | effect |
| --- | --- |
| `<invite-key>` | Join the Bridge the invite came from. `inv_v2_...` (or the older `inv1_...`). The invite link, `'https://bridgedesktop.com/invite#inv_v2_...'`, works too; quote it, since an unquoted `#` starts a shell comment. Works once, expires after 24 hours. |
| `--server` | Host a new Bridge on this machine instead of joining one. Takes no invite. |
| `--owner NAME` | With `--server`, the Bridge's first user and owner. Lowercase letters, digits and dashes. Defaults to the user who ran `sudo`. Also accepted as `--owner=NAME`. |
| `--semantic` | Also install meaning search (see [Semantic search](/docs/semantic-search/)). Skipped with a message on a low-power machine. |
| `--semantic=force` | The same, on a low-power machine too. |
| `--no-auto-update` | Install the daily update timer but leave it disabled. |
| `--invite-file PATH` | Read the invite from a root-only file instead of the command line. Used by Bridge's cloud VM bootstrap; works for any install. |

Unknown options are an error, not ignored.

## Environment overrides

| variable | default | meaning |
| --- | --- | --- |
| `BRIDGE_HOST` | `https://bridgedesktop.com` | Where the tarball is downloaded from. |
| `BRIDGE_PREFIX` | `/usr/local/bin` | Where the `bridge-agent` and `bridgectl` links go. |
| `BRIDGE_LIB_DIR` | `/usr/local/lib/bridge` | Where the binaries go. |
| `BRIDGE_STATE_DIR` | `/var/lib/bridge` | State: tailnet identity, `agent.env`, search index. |
| `BRIDGE_SOCKS5` | `127.0.0.1:2640` | The tailnet's SOCKS5 proxy. |
| `BRIDGE_SHIM_LISTEN` | `127.0.0.1:2620` | The control shim `tailscaled` logs in through. |
| `BRIDGE_TUNNEL_LISTEN` | `127.0.0.1:2600` | The loopback tunnel to the server. |
| `BRIDGE_INVITE`, `BRIDGE_SERVER`, `BRIDGE_OWNER`, `BRIDGE_SEMANTIC` | unset | The options above, as environment. This is how the script passes them through `sudo`, so an invite never appears on `sudo`'s command line. |
| `BRIDGE_CLOUD_JOB`, `BRIDGE_CLOUD_CAPABILITY_FILE`, `BRIDGE_CLOUD_ARTIFACT_URL`, `BRIDGE_CLOUD_ARTIFACT_HASH` | unset | Set only by a Bridge-provisioned cloud VM. The installer then registers through `/api/cloud-machines/register` with a single-job capability instead of asking for the server-wide enrollment secret, and installs exactly the release the server verified (pinned SHA-256). Root only. |

## Cloud VMs created by Bridge

When a cloud workspace is created from **Add a workspace** (DigitalOcean or Linode,
in your own provider account), the server embeds this installer in the VM's
cloud-init and runs it there. Differences from a hand-run install:

- The VM gets a **machine-scoped reconnect credential**, never `AGENT_ENROLL_SECRET`.
  It is bound to that VM's tailnet node, and the server refuses it from any other
  node, from a fallback tailnet, or after the VM is disconnected or deleted.
- Workspace files live on a **separate block volume** mounted at `/workspace`.
  The agent will not start unless that volume is mounted.
- Inbound traffic is dropped by both a provider firewall and the guest's own
  rules. SSH is disabled; recovery is through the provider's console.

## What it installs

The download is one tarball, `/download/linux-<arch>`, of static binaries:

| file in `/usr/local/lib/bridge` | what it is |
| --- | --- |
| `bridge-agent` | The agent: runs tools on this machine for the Bridge it is enrolled with. Built without the semantic search engine. |
| `tailscaled` | A userspace Tailscale daemon, with the `tailscale` CLI compiled into it. |
| `tailscale` | A symlink to `tailscaled`; the name selects the CLI. Older releases shipped a separate binary. |
| `bridge-tailnet` | Verifies the control plane, then fronts the server on loopback. |

`/usr/local/bin/bridge-agent` and `/usr/local/bin/bridgectl` link to the agent
binary. Run as `bridgectl`, it is the management CLI (see
[bridgectl](/docs/bridgectl/)).

systemd units in `/etc/systemd/system`:

| unit | runs |
| --- | --- |
| `bridge-tailscaled.service` | `tailscaled --tun=userspace-networking --port=0 --socks5-server=127.0.0.1:2640 --no-logs-no-support` with its own state dir and socket. Nothing is uploaded to Tailscale's log service. |
| `bridge-tailnet.service` | `bridge-tailnet --fingerprint <from the invite>`, shim on `:2620`, tunnel on `:2600` |
| `bridge-tailscaled-<fp8>.service`, `bridge-tailnet-<fp8>.service` | The same pair for each further Bridge, on the next free ports (see below). |
| `bridge-agent.service` | `bridge-agent`, environment from `/var/lib/bridge/agent.env` |
| `bridge-agent-update.service` + `.timer` | `bridge-agent --self-update`, daily (see [Components and updates](/docs/components-and-updates/)) |

`/var/lib/bridge/agent.env` (mode 0600) carries the server list, the SOCKS5
address, the enroll secret, `AGENT_HEADLESS=1`, `AGENT_RAG_ENABLED=0`, and the
paths `bridgectl` reads back. `/var/lib/bridge/servers.json` (mode 0600) records
every Bridge the machine is on, with its units, ports and state directory;
`agent.env`'s server list is rebuilt from it whenever it changes.

## The order of operations

The order is the security property, so it is worth knowing exactly:

1. Download and unpack the tarball; check every expected file is present.
2. Install the binaries, each copied in beside the old one and renamed over it,
   so nothing running has to stop. From here the script hands over to
   `bridgectl join` ([bridgectl](/docs/bridgectl/#join)), which does the rest.
   Start this Bridge's `bridge-tailscaled` and `bridge-tailnet`.
3. **Wait for the shim's `/key` to answer.** It answers only after
   `bridge-tailnet` has fetched the control plane's public key through a relay
   and checked it hashes to the fingerprint in the invite. A rogue relay fails
   here.
4. Only then hand the invite's preauth key to `tailscale up`, through a 0600
   file rather than the command line, because `/proc/<pid>/cmdline` is
   world-readable.
5. Find the server on the tailnet (`http://bridge:5173`, then `:2687`) and pin
   the address so restarts skip discovery.
6. Sign in through the tunnel with `POST /api/session`. The server identifies
   this machine by its tailnet tag, exactly as it does a browser, so the
   machine is owned by whoever the invite was minted for.
7. `POST /api/machines/register` returns the server URL and enroll secret.
   Neither is in the invite.

   An **agent-only** invite gets no session. Step 6 is refused by design,
   because nobody may sign in from that machine. The script then calls
   `POST /api/machines/register-agent` instead. That call is authenticated by
   the same tailnet tag and returns the same answer. The machine is owned by
   whoever created the invite.
8. Write `agent.env`, start `bridge-agent`, enable the update timer, and print
   every Bridge on the machine with a green or red dot for whether the agent is
   connected to it.

If the release being installed has no `bridgectl join` yet (0.1.55 and
earlier), the script runs the same steps itself, for one Bridge only.

The machine joins sharing **no folders**. Choose one from Bridge (the **Add a
machine** dialog shows them as soon as the machine connects), or run
`sudo bridgectl folders add PATH`.

## Re-running

Re-running the command is safe. It replaces the binaries without stopping
anything, and then:

- **With an invite from a Bridge the machine is already on**, it refreshes that
  Bridge's services and restarts them. It does not join again (an invite cannot
  be redeemed twice), and it keeps semantic search if it was installed.
- **With an invite from a different Bridge**, it adds that Bridge alongside the
  others (next section). Nothing that was already there is stopped.
- **If the join fails** (a bad or expired invite, a control plane that does not
  verify, no server found), it removes what it created for that invite and
  stops. The Bridges the machine was already on keep running.

A machine broken by an older installer, one that fell off its Bridge after a
re-run with another Bridge's invite, is repaired by running the current one
with either invite: the first Bridge's services are put back from `agent.env`,
which still named it.

## More than one Bridge

A Linux machine can be on several Bridges at once, for example your team's and
a friends-and-family one. Each Bridge gets its own tailnet stack, exactly as
the Mac and Windows apps do it:

| | first Bridge | each further Bridge |
| --- | --- | --- |
| units | `bridge-tailscaled`, `bridge-tailnet` | `bridge-tailscaled-<fp8>`, `bridge-tailnet-<fp8>` |
| state | `/var/lib/bridge/tailnet` | `/var/lib/bridge/servers/<fp8>/tailnet` |
| tunnel, shim, SOCKS5 | 2600, 2620, 2640 | next free in each block: 2601, 2621, 2641, ... |
| screen share | 6712 | 6712 plus the tunnel's offset: 6713, ... |

`<fp8>` is the first eight characters of that Bridge's fingerprint. One agent
serves them all.

- **Folders are per Bridge.** A newly added Bridge sees no folders. Folders the
  machine already shared stay with the Bridges they were shared with, including
  any shared with "every server", which are narrowed to the Bridges present
  before the new one joined. Share with one Bridge using
  `sudo bridgectl folders add PATH --server NAME`.
- **Device identity is per Bridge.** Each further Bridge gets its own agent id,
  so two teams never share a machine record.
- **Peer-to-peer file fetches** (another device downloading a file this machine
  offers) work on every Bridge. The first one listens on port 2697; each
  further Bridge finds that port taken and uses a free loopback port instead,
  which it reports with each offer. This needs Bridge 0.1.69 or later; an older
  one served file fetches only on the first Bridge.

`sudo bridgectl servers` lists them. `sudo bridgectl leave NAME` removes one
and keeps the rest.

## Coexisting with a system Tailscale

Userspace networking means no TUN device and no change to routes or DNS, and
`--port=0` avoids the system daemon's WireGuard port. A Tailscale you already
run is left alone. See [Networking](/docs/networking/).

## Removing it

```bash
sudo bridgectl uninstall
```

This removes every Bridge the machine is on. To leave just one, use
`sudo bridgectl leave NAME`. Then remove the machine from Bridge's device list. If `bridgectl` itself is
gone:

```bash
systemctl disable --now 'bridge-agent*' 'bridge-tailnet*' 'bridge-tailscaled*'
rm -f /etc/systemd/system/bridge-*.service /etc/systemd/system/bridge-agent-update.timer
rm -rf /usr/local/lib/bridge /usr/local/bin/bridge-agent /usr/local/bin/bridgectl /var/lib/bridge
```
