Tin Hat / Run a server / Linux
Tin Hat Server on Linux
For a Linux machine of your own: the spare that hosts your Minecraft server, a virtual machine, or a rented server (VPS). Two commands install the same server the image runs, from the same signed release. It leaves the machine's name, its network addresses, SSH and your firewall settings alone, and can run next to your own reverse proxy.
Before you start
- Debian 13 or Ubuntu 24.04 with systemd, on a 64-bit processor: Intel or AMD, or ARM (like a Raspberry Pi 5 or an ARM VPS). Other distributions come later; until then the virtual machine image runs anywhere a VM does.
- At least 2 GB of memory and 10 GB free for
/var/lib. More is better once people share photos and files (the rough numbers). - These ports: TCP 80 and 443 (the app, chat and the setup page), TCP 7881 and UDP 7882 (calls), and TCP 7880, 8008, 8070, 8080 and 8090 for its own parts. If one is in use, the installer stops before changing anything and says which.
- Game servers are fine. Minecraft (25565), Valheim (2456–2458) and most game servers use other ports, so they keep running next to it.
- A web server already on ports 80 and 443? If it's nginx, Traefik, Caddy or Nginx Proxy Manager, it can be Tin Hat's reverse proxy: install with
--behind-proxy(below). Otherwise, give Tin Hat a machine or virtual machine of its own. - A user that can run
sudo, and internet on the machine. - Not Windows' Linux (WSL): on Windows, use Tin Hat Server for Windows.
A machine (or virtual machine) of its own is easiest. A rented server works too: on a rented server.
Tested in our lab on Debian 13 and on Ubuntu 24.04 (install, setup and an update), and on Debian 13 next to nginx with --behind-proxy. The ARM build works in our lab too. ARM releases may come a little after the Intel/AMD ones; if one isn't out for your machine yet, the installer says so.
Install
- Download the installer into the folder you're in
curl -fsSLO https://updates.tinhat.dev/server/install.sh
It's the same file as on every release page on GitHub. It's one plain bash script: read it first with
less install.shif you like. Its first lines say what it changes. Careful types can also check its signature. - Run it it asks for your password once
sudo bash install.sh
It checks the machine (system, memory, disk space, the ports), installs what's missing (Docker only if it isn't there yet), downloads the release and checks its signature and checksums before installing it, then starts the server. The first time takes a few minutes, mostly downloading.
Your own reverse proxy already has ports 80 and 443 on this machine? Run
sudo bash install.sh --behind-proxyinstead (next to your own reverse proxy). - Note the address and the setup code it prints both at the end
$ sudo bash install.sh == Packages … == The release Tin Hat Server 0.3.1 (signature and checksum OK) == Container images (the first time takes a few minutes) ghcr.io/element-hq/lk-jwt-service:0.4.0 livekit/livekit-server:v1.13.7 matrixdotorg/synapse:v1.145.0 postgres:17-alpine == Installing … Tin Hat Server 0.3.1 is installed. Set it up in a browser: http://192.168.1.50/ Setup code: 4082-7685 Open it from a computer or phone on the same network. `sudo tinhat setup-code` shows the code again. Everything else happens in the browser. `sudo tinhat` shows the status; `sudo tinhat uninstall` removes it. $
Trimmed: the package installer's own lines are left out, and long lines are wrapped. A real run of 0.3.1 on a fresh Debian 13 machine (86 seconds, downloads included); the address and the setup code are examples.
- Open the address on a phone or computer on the same network for example
http://192.168.1.50/Type the setup code and follow the pages: the setup, screen by screen. Your machine has no setup screen of its own, so the code lives in the terminal:
sudo tinhat setup-codeshows it again until setup is done.
Next to your own reverse proxy
For a machine whose own nginx, Traefik, Caddy or Nginx Proxy Manager already has ports 80 and 443. A plain install stops there and names the program:
Tin Hat Server: Ports 80 and 443 are in use on this machine (nginx). If that's your reverse proxy (nginx, Traefik, Caddy, Nginx Proxy Manager), run this again with --behind-proxy: Tin Hat Server then leaves 80 and 443 to it, and your proxy sends your domain to Tin Hat. Otherwise a machine (or virtual machine) of its own is easiest.
So run it with the flag:
sudo bash install.sh --behind-proxy
- Tin Hat never uses ports 80 and 443 on this machine. They stay your proxy's.
- The setup page is on port 8080: the installer prints an address like
http://192.168.1.50:8080/, with the setup code. - The Name step has one choice left, already picked: My own domain → My own reverse proxy (it handles HTTPS). The page says why: Another web server on this machine (your reverse proxy) has ports 80 and 443, so Tin Hat Server runs behind it: your proxy sends your domain to this server.
- Your proxy sends your domain to port 8080 on this machine. The setup's last page and Dashboard → Network give you the settings for nginx, Traefik, Caddy and Nginx Proxy Manager, ready to copy (what they look like).
- Calls still come straight to the machine: the server asks your router for TCP 7881 and UDP 7882 itself.
- Only for a proxy on this machine. With the flag, Tin Hat has no HTTPS of its own and checks call sign-ins through your proxy. If your proxy runs on another computer, install without the flag and choose My own domain → My own reverse proxy at setup (how). The installer refuses the flag when nothing on this machine answers on port 443; add
--forceif you're setting the proxy up next.
The installer ends with the same reminder:
Tin Hat Server 0.3.1 is installed. Set it up in a browser: http://192.168.1.50:8080/ Setup code: 4082-7685 … At setup choose "My own domain", then "My own reverse proxy": the last page shows the settings to paste into your proxy (it sends your domain to port 8080 here). Your router still sends TCP 7881 and UDP 7882 straight to this machine.
Tested in our lab on Debian 13 with nginx on ports 80 and 443: the nginx settings the setup handed out went into /etc/nginx/conf.d as they were, and a friend outside reached chat and calls' sign-in through it.
What it changes on your machine
- Packages: Docker if it isn't there yet (your distribution's own packages), Python, restic, minisign, WireGuard tools and a few small helpers. On a home network also Avahi, so phones and computers can find a home-only server as
yourname.local. - Docker, only if it installed it: a settings file that keeps Docker's own networks on 198.18.x addresses, away from home networks, and caps container log sizes. A Docker that was already there keeps its settings, and the call server keeps clear of its networks.
- Tin Hat itself: the program in
/opt/tinhat, its data (accounts, messages, settings) in/var/lib/tinhat, two services (tinhat-managerandtinhat-update), and thetinhatcommand. Its parts run as Docker containers namedtinhat-…. - Two small system files: one line in
/etc/hostsfor the server's name (marked# tinhat-server), and a sysctl file that gives the call server bigger network buffers.
It never changes the machine's name, its network addresses, SSH or your firewall settings, and it leaves an existing Docker's settings and your other containers alone. (Docker itself, like anywhere, adds firewall rules for the ports its containers publish.) If you run a firewall (ufw, firewalld), let in TCP 80, 443 and 7881 and UDP 7882 yourself.
Day-to-day commands
Everyday things live in the dashboard. On the machine itself:
| Command | What it does |
|---|---|
sudo tinhat | The status: setup phase, the server's name, version and addresses, and each part with its state |
sudo tinhat setup-code | The setup code again, until setup is done |
sudo tinhat recovery-code | The one-time code for Forgot your password? Ask for it in the browser first; it works for 10 minutes |
sudo tinhat logs | What the server has been doing (the manager's recent log). sudo tinhat logs synapse for one part: caddy, postgres, synapse, livekit or lk-jwt |
sudo tinhat factory-reset --yes-erase-everything | Deletes every account, message, file and setting and starts over at the setup page, with a new setup code. The machine keeps its name |
sudo tinhat uninstall | Removes Tin Hat Server (below) |
Updates
- Tin Hat Server's updates come from its dashboard, the same as for every other kind of server: by themselves at night (3–5 AM your time, never during a call) or with one click. Each one is signed and checked first, the server makes a safety copy and goes back to it by itself if the new version doesn't start properly, and the
tinhatcommand is updated along with it. More on updates. - The operating system stays yours. On your own machine the server doesn't install system updates or restart the machine. Keep Debian or Ubuntu up to date the way you normally do.
On a rented server (VPS)
A VPS from any hosting provider works with the same two commands. What's different:
- It has its own public address, so there's no router to open: choose Friends anywhere or My own domain at setup. The setup and the dashboard say "This server has its own public address".
- Open the ports in your provider's firewall (often called a security group or cloud firewall): TCP 80, 443 and 7881, and UDP 7882. If one is blocked, the outside check names it and points at the provider's firewall or the machine's own.
- The setup page is open to the internet until setup is done. Only the setup code unlocks it, and ten wrong tries lock it for ten minutes. It's plain HTTP until then, so set the server up right after installing, from a connection you trust.
The installer says the same at the end:
This machine has its own public address, so the setup page is open to the internet until setup is done: only the code above unlocks it (ten wrong tries lock it for ten minutes). Choose "Friends anywhere" or "My own domain" at setup. If the provider has a firewall in front of the machine, let in TCP 80, 443 and 7881 and UDP 7882.
Tested in our lab on a plain Debian 13 machine with a public address of its own: it set up as Friends anywhere, and a friend outside reached it.
A reverse proxy already on the rented server? It works the same as at home: install with --behind-proxy (above), and the proxy uses the settings just as the setup hands them out.
Remove it
sudo tinhat uninstall
It says what it's about to remove and asks you to type remove; anything else changes nothing. Then it removes Tin Hat's services, its containers and images, and /opt/tinhat. Accounts, messages and settings stay in /var/lib/tinhat. To delete them too (make a backup first if you want them):
sudo tinhat uninstall --erase-data
Docker and the other packages it installed stay, since other things may use them. Remove them with apt if you like.
For the careful: check the script
The installer is signed with Tin Hat's release key (minisign, Ed25519), like every release. Its signature is next to it, install.sh.minisig. With minisign installed:
curl -fsSLO https://updates.tinhat.dev/server/install.sh.minisig
minisign -Vm install.sh -P RWQUG5ce+eVTK+HZgYoCViu7WY1nwnbLR8s54/zRQR0DLiACjVuh5Mkv
It must say Signature and comment signature verified. That long string is Tin Hat's release key (key ID 2B53E5F91E971B14); What you're trusting lists it too. Checking is optional, and it's the way to know the script itself is ours before it runs as root: the script also carries the release key, checks the release's signature and every download's checksum before installing it, and stops if one doesn't match (The release's signature doesn't check out, so nothing was installed.).
If something's wrong
"These ports are already in use on this machine"
Something else on the machine already uses one of the ports Tin Hat needs for calls or its own parts (7880, 7881, 7882, 8008, 8070, 8080, 8090). sudo ss -ltnup shows what. Move that program to another port, or give Tin Hat a machine or virtual machine of its own.
"Ports 80 and 443 are in use on this machine"
If that's your reverse proxy (nginx, Traefik, Caddy, Nginx Proxy Manager), run the installer again with --behind-proxy (how it works). Any other web server: a machine or virtual machine of its own is easiest.
"Tin Hat Server is tested on Debian 13 and Ubuntu 24.04"
Other distributions come later. Until then the virtual machine image runs on any Linux that runs virtual machines. (The installer's --force tries an untested system anyway, at your own risk; it still needs apt.)
"Tin Hat Server … isn't out for arm64 machines yet"
ARM releases can come a little after the Intel/AMD ones. Run the installer again once the release is out for ARM.
"Docker is installed but without its compose plugin"
Install the plugin, then run the installer again: docker-compose-plugin from Docker's own repository, or docker-compose-v2 on Ubuntu.
"This is Windows (WSL)"
The installer is for a real Linux machine or virtual machine. On Windows, use Tin Hat Server for Windows.
"The manager didn't start"
sudo journalctl -u tinhat-manager shows why. sudo tinhat logs has the same for a bug report.
I forgot my admin password
On the dashboard's sign-in, choose Forgot your password? → Make a code, then run sudo tinhat recovery-code on the machine and type the code with a new password within 10 minutes.
Friends outside can't connect
Open the dashboard's Network tab: it checks from outside and says what to change. On a rented server, check its firewall first. At home, Friends anywhere has the router how-tos.