Skip to content

install.sh options ​

deploy/install.sh installs or updates Bitstream on Ubuntu 22.04, Ubuntu 24.04 or Debian 12 (amd64 or arm64). Run it as root. It downloads the binaries, the web panel and the deploy files from the GitHub Releases of bitstreamott/bitstream (the latest, or --version) and checks each file against the release SHA256SUMS.

It is safe to run again. Secrets are kept, configs are updated in place, and an existing PostgreSQL, Redis or ffmpeg install is reused.

Examples ​

bash
sudo ./deploy/install.sh --role both              # control + node on one host
sudo ./deploy/install.sh --role both --firewall rules   # add ufw rules, do not turn ufw on
sudo ./deploy/install.sh --role control
sudo ./deploy/install.sh --node --join <token> --control https://panel.example.com:8443
sudo ./deploy/install.sh --role license           # platform license server (not for panel owners)
curl -fsSL https://raw.githubusercontent.com/bitstreamott/bitstream/main/deploy/install.sh | sudo bash -s -- --role both
./deploy/install.sh --dry-run --version v1.2.0   # print the asset URLs it would fetch, change nothing

Options ​

OptionWhat it does
--role control|node|proxy|both|licenseWhat to install. Asked on a terminal when you leave it out (control is the first choice). Without a terminal (or with -y) the default is both. both is for a test lab only and prints a warning. license installs the platform license server; panel owners never need it.
--nodeSame as --role node.
--role proxyA node without FFmpeg that serves viewers in front of other nodes, with the proxy tuning preset. The panel's Add proxy command passes it for you. See Add a proxy.
--join TOKENJoin token for the node. Implies --role node when no role is given. Needs --control.
--control URLURL of the control's node API, port 8443.
--domain NAMENode: its public domain, like edge1.example.com. The node joins with it as its first domain. Asked on a terminal when you join a node without it; press Enter to skip.
--db-url DSNControl: use an external PostgreSQL 14+ instead of installing one. Use sslmode=verify-full. See External Postgres and Redis.
--db-ca FILECA bundle of the external Postgres.
--db-direct-url DSNOptional. Direct Postgres URL for migrations and backups when --db-url is a pooler. A Neon -pooler host finds its direct host by itself. Without it, everything uses --db-url, as before.
--pgbouncer--db-url is PgBouncer in transaction pooling. Needs --db-direct-url.
--redis-addr HOST:PORTControl: use an external Redis instead of installing one. Local is recommended.
--redis-user U, --redis-password PRedis ACL user and password.
--redis-tls, --redis-ca FILETLS to Redis, with an optional private CA.
--spa-origins LISTPanel origins on another host, like https://panel.example.com on Cloudflare Pages.
--ffmpeg LISTffmpeg builds for nodes: all, none, or a list like 4.4,7.1,latest. Default: the manifest default (8.1,latest). 4.4 is compiled from source, see below.
--ffmpeg-forceDownload the ffmpeg builds again.
--firewall on|rules|offufw: add the rules and turn ufw on (default), only add the rules, or leave ufw alone.
--no-firewallSame as --firewall off.
--no-sysctlDo not write /etc/sysctl.d/90-bitstream.conf.
--binaries DIRUse local bs-control, bs-node and bs-license from this folder instead of downloading them.
--skip-binariesDo not copy binaries or the panel. Use what is already in /opt/bitstream/bin.
--version TAGRelease to install, like v1.2.0. Default: the latest release.
--repo OWNER/NAMEGitHub repository with the releases. Default: bitstreamott/bitstream.
--dry-runPrint the release asset URLs it would download for this role and stop. Needs no root.
--release-url URLDownload and use a release tarball (bin/, web/, deploy/) instead of the GitHub release assets.
--memory-max SIZEsystemd MemoryMax for bs-control and bs-node, for example 2G.
--public-host HOSTPublic name or IP of this host. Default: the detected primary IP.
--force-osTry anyway on a distribution that was not tested.
-y, --yesNever ask.
-h, --helpShow the help.

What goes where ​

PathContents
/opt/bitstream/binThe binaries.
/opt/bitstream/etccontrol.env (root:root, 0600: it holds database and Redis passwords; systemd reads it as root), node.env (root:bs-node) and license.env (root:bs-license), mode 0640. .install-secrets (0600, root) keeps the database and Redis passwords for the next run.
/opt/bitstream/data/{control,node,license}Data of each service, mode 0700, owned by that service's user.
/opt/bitstream/data/joinRole both only. Mode 2770, bs-control:bs-node. Holds local.token, the one-time join token the setup wizard writes for the local node.
/opt/bitstream/media/vodNode: the VOD folder (vod_dir). Download and reprocess jobs write here. Mode 0750, bs-node:bs-node. A proxy does not get it.
/opt/bitstream/data/node/archiveNode: the TV archive folder (BS_ARCHIVE_DIR), also read for timeshift. Mode 0750, bs-node:bs-node. A proxy does not get it.
/opt/bitstream/logsMode 1770, root:bitstream.
/opt/bitstream/ffmpeg/<version>/binffmpeg and ffprobe builds.
/opt/bitstream/webThe built panel.
/opt/bitstream/data/control/geoipcountry.mmdb and asn.mmdb, the free DB-IP Lite databases (CC BY 4.0). Downloaded at install when the server is online; the panel updates them weekly. See IP location.
/etc/systemd/system/bs-*.servicesystemd units.
/etc/sysctl.d/90-bitstream.confKernel tuning. Delete it to go back to the defaults.
/opt/bitstream/data/tune/Node: tuning requests from bs-node (request.json) and the root helper's answer (result.json). Owned by root, sticky.
/etc/systemd/system/bs-node-tune.{path,service}Node: the root helper that applies tuning from the panel.
/etc/postgresql/<ver>/<cluster>/conf.d/90-bitstream.confPostgreSQL tuning.
/etc/redis/bitstream.confRedis settings, included from redis.conf.

Firewall ​

With --firewall on or rules, the installer installs ufw and adds these rules:

RolePorts (tcp)
allevery port sshd listens on, plus 22
control80, 443, 8080, 8443
node80, 8090, 8091
license8070

With on it then turns ufw on if it was off.

WARNING

If ufw was off before, the default --firewall on turns it on, and every port not in the list is blocked from then on (for example a second node on port 8092). Use --firewall rules when you manage the firewall yourself, or --firewall off to leave it untouched.

System users ​

Each service runs as its own system user: bs-control, bs-node and bs-license. They share the group bitstream, which only lets them enter etc/ and data/ and write logs/. Each data dir and env file belongs to its service, so the node (and any ffmpeg it runs) cannot read the control's master key or the license admin key. The systemd units also set InaccessiblePaths for the other services' files. Running the installer on an older install moves the files to the new owners.

Where the node can write ​

bs-node.service uses ProtectSystem=strict, so the node can write only to the folders in its ReadWritePaths line. Each run of the installer creates the VOD and archive folders and puts them in that line, in the unit itself. If you set BS_VOD_DIR or BS_ARCHIVE_DIR in node.env, run the installer again: it creates that folder and adds it too. Media roots (media_roots) are only read, so they need no entry. An archive folder you set for one node in the panel needs a drop-in with its own ReadWritePaths.

ffmpeg 4.4 ​

The public static 4.4 builds crash on MPEG-TS input, so the manifest marks 4.4 with layout source. The installer then runs deploy/ffmpeg/build-ffmpeg.sh and compiles a lean copy-only ffmpeg 4.4.5 into /opt/bitstream/ffmpeg/4.4. It installs build-essential, nasm, pkg-config and libssl-dev if they are missing, and takes a few minutes. You can run it by hand too:

bash
sudo bash deploy/ffmpeg/build-ffmpeg.sh 4.4.5 /opt/bitstream/ffmpeg/4.4

Notes ​

  • The node unit is not enabled until it has a join token, a join token file (role both) or an identity from an earlier join, so it does not crash-loop on boot. On role both, bs-node starts and waits for the setup wizard to write local.token.
  • At the end the installer prints the panel URL and the one-time setup code from data/control/setup.code. Without BS_HTTP_TLS_LISTEN it also warns that passwords would travel in clear text, and prints an SSH tunnel command. Through the tunnel (loopback), setup needs no code. It also reminds you to have a Cloudflare API token ready: the wizard cannot finish without one.
  • Other ffmpeg downloads are checked against a pinned sha256, or the release checksum list for latest builds. The 4.4 arm64 build has no published checksum: the installer warns and installs it unverified.
  • The GeoIP download is not fatal. Without internet the install goes on and the panel fetches the files later.
  • When the role changes between runs on the same host, the PostgreSQL size changes too, and PostgreSQL restarts.

Setup wizard and Cloudflare ​

The setup wizard needs a working Cloudflare connection to finish. It checks the token, writes the DNS records for the panel and starts the HTTPS certificate. See Install your first server for the token permissions.

Two variables on the control process exist for test labs only. Put them in /opt/bitstream/etc/control.env and restart bs-control. Nothing in the panel or the API can set them.

VariableEffect
BS_LICENSE_SKIP=1The wizard can finish without activating the free license, and the panel never registers. For automated tests and offline labs. Never on a real server.
BS_SETUP_SKIP_CLOUDFLARE=1The wizard can finish without Cloudflare. The panel keeps the address you opened it on, with no DNS records and no certificate. For automated tests and offline dev. Never on a real server.
BS_CLOUDFLARE_API_URLSends every Cloudflare API call to this URL instead of https://api.cloudflare.com/client/v4. For a fake Cloudflare server in tests.

Release assets ​

Each release on bitstreamott/bitstream has these files. The names have no version, so releases/latest/download/<name> always works.

FileWhat
bs-control-linux-amd64, bs-control-linux-arm64Control plane.
bs-node-linux-amd64, bs-node-linux-arm64Node.
bs-license-linux-amd64, bs-license-linux-arm64Platform license server.
bitstream-web.tar.gzThe web panel.
bitstream-deploy.tar.gzThe installer, the systemd units and the ffmpeg manifest.
SHA256SUMSChecksums of every file. Check by hand with sha256sum -c --ignore-missing SHA256SUMS.

Releases are built by the Bitstream team. They are the only place binaries come from.

Bitstream documentation