Install Tailscale on Ubuntu: script, apt, boot, UFW, update
Install Tailscale on Ubuntu 22.04, 24.04 or 26.04 with the script or apt, log in a headless server, start at boot, MagicDNS, UFW, updating and removing it.
On Ubuntu, run curl -fsSL https://tailscale.com/install.sh | sh, then sudo tailscale up and open the To authenticate, visit: link it prints in a browser on any device. The script adds Tailscale’s own apt repository and installs the package, which enables and starts tailscaled as a systemd service, so it starts at every boot with the login and settings it keeps on disk. The same repository can be added by hand for every release from 16.04 to 26.10, among them 22.04 (jammy), 24.04 (noble) and 26.04 (resolute). On a server, add --ssh to that first tailscale up if you want Tailscale SSH, or join with an auth key instead of the link. As of November 23, 2026 the current release is 1.104.7; update with sudo apt-get update && sudo apt-get install tailscale or sudo tailscale update.
The install script, and what it runs on Ubuntu
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale upCopiedThe script is short enough to read first, and on Ubuntu it does nothing exotic. It reads the release’s codename from /etc/os-release (Pop!_OS, KDE neon and Tuxedo OS are treated as Ubuntu), asks Tailscale’s package server whether that release is supported, and then, using sudo (or doas) when you are not root:
- writes Tailscale’s signing key to
/usr/share/keyrings/tailscale-archive-keyring.gpg; - writes the repository line to
/etc/apt/sources.list.d/tailscale.list; - runs
apt-get updateandapt-get install -y tailscale tailscale-archive-keyring; - prints
Installation complete! Log in to start using Tailscale by running:and thetailscale upline.
It never logs the machine in: that is always your tailscale up. Two environment variables change what it installs, as its header shows: curl -fsSL https://tailscale.com/install.sh | TAILSCALE_VERSION=1.104.7 sh pins a version, and TRACK=unstable switches to the unstable track (the default is stable). On a release Tailscale does not package yet it stops with ubuntu <codename> isn’t supported by this script yet. and asks you to send the details it prints to Tailscale support.
The apt repository by hand
If you would rather not pipe a script into a shell, these are the commands Tailscale’s package page gives for Ubuntu 24.04 LTS:
sudo mkdir -p --mode=0755 /usr/share/keyrings
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/noble.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/noble.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt-get update && sudo apt-get install tailscaleCopiedFor another release, replace noble in both URLs with its codename, the VERSION_CODENAME line of /etc/os-release. As of November 23, 2026 the stable track lists every Ubuntu release from 16.04 to 26.10, among them:
| Release | Codename in the URLs |
|---|---|
Ubuntu 26.04 LTS (Resolute Raccoon) | resolute |
Ubuntu 24.04 LTS (Noble Numbat) | noble |
Ubuntu 22.04 LTS (Jammy Jellyfish) | jammy |
Ubuntu 20.04 LTS (Focal) | focal |
The list file holds a single line, which is all apt needs to know about the repository and the key that signs it:
deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/ubuntu noble mainCopiedLogging in a server with no browser
sudo tailscale up prints To authenticate, visit: and a URL, and waits. Open the URL on your laptop or phone, sign in to your tailnet, and the server prints Success. --qr also prints the link as a QR code for a phone to scan. For a server set up by a script, or one nobody will watch, an auth key joins it with no sign-in at all.
Put every setting the server should have on that first line, because a later tailscale up that adds one flag is refused unless you repeat the others (the “requires mentioning all non-default flags” error; tailscale set changes one setting at a time instead). A typical server line:
sudo tailscale up --ssh --hostname=agent-box --timeout=5mCopied--sshruns Tailscale SSH, which lets your other devices SSH in by the server’s tailnet name with no keys, as your tailnet policy allows. Before you rely on it for a machine that runs an AI agent, read locking the server down with a tag: the default policy lets that server reach every device you own. Tailscale’s security bulletins of October 26, 2026 ask anyone using Tailscale SSH to run 1.104.4 or newer.--hostnamesets the name the machine has on the tailnet, instead of the one Ubuntu gives it, which on a cloud server is often an instance ID.--timeoutmatters in scripts: the default,0s, “blocks forever”.
Without sudo, the command is refused with Access denied: on Linux only root, or one user named as the operator, may change tailscaled. The operator fix is one command. Then check what you have:
tailscale ip -4 # this machine's 100.x address
tailscale status # the other machines, and direct or relay for each
tailscale versionCopiedStarting at boot: the tailscaled service
Nothing to do. The package’s install script uses Debian’s standard systemd step, which enables a unit on first install, and then restarts tailscaled. The unit, tailscaled.service, is wanted by multi-user.target, restarts on failure, and runs:
/usr/sbin/tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/run/tailscale/tailscaled.sock --port=${PORT} $FLAGSCopiedThe machine’s login lives in /var/lib/tailscale/tailscaled.state: delete that file and the machine is a new device with a new address. PORT and FLAGS come from /etc/default/tailscaled, which ships with PORT="41641" (the UDP port for direct connections) and FLAGS=""; edit it and run sudo systemctl restart tailscaled to change either. To confirm the service is set to start at boot and running:
systemctl is-enabled tailscaled
systemctl status tailscaled
journalctl -u tailscaled -bCopiedRun tailscale up once, by hand or in the provisioning script, and never from a boot script or unit of your own: with an auth key on it, that is how a machine comes back logged out months later. A service of yours that listens on the machine’s 100.x address can still start before Tailscale has it, which fails with cannot assign requested address; the fix is an ordering line in that service’s unit. On a server that is really a container, tailscaled will not start at all because /dev/net/tun is missing: Tailscale in a container covers that.
MagicDNS and systemd-resolved
tailscale up accepts the tailnet’s DNS settings by default (--accept-dns is true), which is what lets ssh laptop or ping laptop find your other machines by name. Where the machine uses systemd-resolved, Tailscale works through it rather than rewriting /etc/resolv.conf. Check both halves:
ls -l /etc/resolv.conf # should point at /run/systemd/resolve/stub-resolv.conf
resolvectl status # the tailscale0 link should list 100.100.100.100CopiedIn the example on Tailscale’s Linux DNS page, with the admin console’s Override DNS servers on, the tailscale0 section shows 100.100.100.100 as its DNS server and your tailnet’s domain among its DNS domains. If /etc/resolv.conf is a plain file instead, Tailscale writes the file itself, a DHCP client can overwrite it, and tailscale status warns DNS config not ideal; the fix for that warning is to restore the symlink. A server that should keep its own resolvers can turn the tailnet’s DNS off with sudo tailscale set --accept-dns=false and reach the other machines by their 100.x addresses.
UFW alongside Tailscale
Tailscale itself needs no inbound port: its firewall FAQ says “Most of the time, you don’t need to open any firewall ports for Tailscale”, only outbound connections (TCP 443, UDP 3478, and UDP from port 41641 for direct connections), which UFW allows by default. What UFW does affect is traffic arriving over Tailscale, because its default incoming policy of deny applies to the tailscale0 interface too. So allow that interface and keep public SSH until you have logged in over Tailscale:
sudo ufw allow in on tailscale0
sudo ufw allow 22/tcp
sudo ufw enable
sudo ufw status verboseCopiedUFW is installed disabled, with incoming denied and outgoing allowed, and the ufw manual warns that enabling it may drop existing connections such as SSH, hence the 22/tcp rule before it. Then, from your laptop, connect to ssh <user>@<100.x address> (or the server’s tailnet name), and once that works close the public port, as Tailscale’s UFW guide ends by doing (written here in the form the ufw manual gives for deleting a rule):
sudo ufw delete allow 22/tcp
sudo ufw reloadCopiedHave your provider’s web console to hand before this step. With Tailscale SSH on, sshd is no longer needed at all, and switching it off leaves nothing listening publicly on port 22, whatever the firewall says.
Updating
The package comes from Tailscale’s repository, so an ordinary apt upgrade picks up new releases, and Tailscale’s update page gives the targeted form:
sudo apt-get update
sudo apt-get install tailscaleCopiedsudo tailscale update does the same from the CLI (1.36 and later on Ubuntu): it asks before it starts unless given --yes, previews with --dry-run, and with --version=<x.y.z> installs that version, older or newer. Without sudo it stops with must be root; use sudo.
To let the machine update itself, run sudo tailscale set --auto-update. Tailscale applies it through apt, typically around a week after a release. Newly created tailnets have the admin console’s Auto-update new devices setting on by default, but that setting only affects machines added after it was turned on. The update matters more than usual on 1.104: earlier 1.104 releases can fail to reach Tailscale’s servers behind some firewalls, with “fetch control key” errors, fixed in 1.104.7.
Uninstalling
sudo tailscale logout
sudo apt-get remove tailscale
sudo rm /var/lib/tailscale/tailscaled.state
sudo rm /etc/apt/sources.list.d/tailscale.listCopiedtailscale logout disconnects and expires the machine’s login. apt-get remove is the command Tailscale’s uninstall page gives for Ubuntu; it leaves the state file, which the third line deletes (after an uninstall, a later reinstall gets a new address), and the last line stops apt checking Tailscale’s repository. If the install script put the package in, it also installed tailscale-archive-keyring, which sudo apt-get remove tailscale-archive-keyring takes out. None of this removes the machine from your tailnet’s list: do that on the admin console’s Machines page, from the menu at the end of its row, with Remove.