Cloudflare Zero Trust Guide
Isometric dark scene of a technician loading a package from a box into a server, with a glowing blue tunnel running through a stone arch to a cloud.
cloudflare-tunnel

How to Install and Update cloudflared on Ubuntu (apt, .deb)

Install cloudflared on Ubuntu from Cloudflare's apt repo or a .deb, fix 'Unable to locate package', run it as a service and update it with apt.

By Cloudflare Zero Trust Guide Editorial · ·Updated · 8 min read

The short answer to how to install cloudflared on Ubuntu: add Cloudflare’s signed apt repository, then install the package with apt. It takes three commands. Write the GPG key to /usr/share/keyrings/cloudflare-main.gpg, add a deb line for https://pkg.cloudflare.com/cloudflared any main, and run sudo apt-get update && sudo apt-get install cloudflared. After that, apt delivers updates.

The daemon does nothing until it has a tunnel. This page installs cloudflared, verifies it, runs it under systemd and puts updates under your control. Tunnel creation and Access setup are covered in your first Cloudflare Tunnel, step by step. cloudflared is the tunnel connector, not the WARP client, which WARP compared with a VPN covers.

Evidence and limits. Commands come from Cloudflare’s package repository page and Cloudflare One docs. Error text and service behaviour come from the cloudflared 2026.11.1 source and release notes. Ubuntu facts come from Ubuntu’s release page, manpages, server docs, package search and apt source, plus the Debian wiki on keys. We did not run these steps ourselves.

Which install method should you use on Ubuntu?

Use the apt repository at pkg.cloudflare.com. Packages are verified by a signing key trusted for that repository only. apt upgrades cloudflared with the rest of the system, and nothing restarts on its own. The alternatives (a .deb via dpkg, a standalone GitHub binary or the Docker image) each fit a narrower case.

MethodInstallUpdate pathAuto-updateUse it when
apt repo (pkg.cloudflare.com)3 commandsapt-get install --only-upgradeNoDefault for Ubuntu hosts that can reach the repo
.deb via dpkg -iDownload + dpkgRe-download + dpkgNoOffline hosts, or pinning one build
Standalone binary (GitHub)Download, chmod +x, move into PATHcloudflared update or auto-updateYes, when run as a serviceMinimal images without an extra apt source
Docker cloudflare/cloudflareddocker runPull a new imageDisable with --no-autoupdateHosts already running everything in containers

The auto-update column matters most. Cloudflare’s run parameters reference says built-in updates are “not available on Windows, for package-manager installations, or when cloudflared runs interactively in a terminal”. It also warns that “the updater does not wait for the replacement process to connect to Cloudflare before shutting down the old process”. --autoupdate-freq defaults to 24h, so a single-connector tunnel risks dropping connections daily, at a time you didn’t pick. Package installs let you schedule updates yourself.

Add Cloudflare’s apt repository

Cloudflare’s package repository page gives these commands for the any suite:

sudo mkdir -p --mode=0755 /usr/share/keyrings
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared any main' | sudo tee /etc/apt/sources.list.d/cloudflared.list

Cloudflare recommends the any suite for any Debian-based distribution. It also publishes release-specific suites: focal (20.04), jammy (22.04) and noble (24.04). Use any unless you need to pin. Ubuntu’s release upgrade guide says third-party repositories “are disabled during the release upgrade”. With any, you can re-enable the source without editing the codename.

On Ubuntu 26.04, use the any line. The repository page lists no 26.04 suite, and dists/resolute/Release returns 404 for Ubuntu 26.04 (Resolute Raccoon). The any suite’s Release file is served.

The signed-by= option matters. The Debian wiki’s third-party repository guidance warns against putting a vendor key in the global /etc/apt/trusted.gpg.d store. Doing that “would cause the system to accept signatures from the third-party keyholder on all other repositories configured on the system that don’t have a signed-by option”. Old tutorials using the deprecated apt-key add do exactly that; avoid them.

Keep the nightly suite at next.pkg.cloudflare.com off anything people depend on.

Install and verify cloudflared

sudo apt-get update && sudo apt-get install cloudflared
cloudflared --version
apt-cache policy cloudflared
ls -la /usr/local/etc/cloudflared/

cloudflared --version shows the installed build. Compare it with the newest tag on GitHub releases. apt-cache policy confirms the candidate comes from pkg.cloudflare.com, not a forgotten source.

The ls line checks for .installedFromPackageManager. Cloudflare’s update documentation uses that marker to distinguish package installs from standalone binaries. If it’s there, update with apt, never with cloudflared update.

Alternative: install the .deb with dpkg

Use this on hosts that can’t reach pkg.cloudflare.com, or for one exact build. Cloudflare documents the same command for dpkg upgrades:

curl --location --output cloudflared.deb "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-$(dpkg --print-architecture).deb"
sudo dpkg -i cloudflared.deb

--output cloudflared.deb saves the download as cloudflared.deb. That is the name to pass to dpkg -i, not the GitHub asset name such as cloudflared-linux-amd64.deb.

dpkg --print-architecture returns amd64 on x86-64 and arm64 on 64-bit ARM matching the GitHub asset names. Releases also ship 386, arm, armhf and a FIPS amd64 build. To pin a build, replace latest/download with download/2026.11.1, or any validated tag.

The cost: nothing announces new versions. Cloudflare’s downloads page says it “supports versions of cloudflared that are within one year of the most recent release”. Manual installs mean manual upgrades.

Does cloudflared need any firewall ports open on Ubuntu?

No inbound ports. cloudflared only makes outbound connections, over TCP and UDP 7844, to region1.v2.argotunnel.com and region2.v2.argotunnel.com, per Cloudflare’s firewall requirements. Outbound 443 is optional, for update checks, github.com downloads and Access JWT validation. The ufw manual page says ufw installs with “a default outgoing policy of allow,” so a stock Ubuntu host needs no new rule.

With default-deny egress, open only what the connector uses. Your apt mirrors and pkg.cloudflare.com still need 80/443:

sudo ufw allow out 7844/tcp
sudo ufw allow out 7844/udp
sudo ufw allow out 53

Test the path before creating a tunnel:

dig +short A region1.v2.argotunnel.com
dig +short AAAA region1.v2.argotunnel.com
dig +short SRV _v2-origintunneld._tcp.argotunnel.com
nc -vz -w 3 region1.v2.argotunnel.com 7844
mtr -T -P 7844 -c 10 region1.v2.argotunnel.com

nc only proves TCP/7844. UDP is connectionless, so nc -u reports success either way. If a middlebox drops QUIC, the default --protocol auto falls back to HTTP/2, and the logs show it.

Run cloudflared as a systemd service

Service setup depends on who owns the tunnel config.

Remotely-managed (dashboard) tunnels. The dashboard’s install command wraps a token:

sudo cloudflared service install <TOKEN>
systemctl status cloudflared
journalctl -u cloudflared -f

Treat the token as a private key. Cloudflare’s tunnel permissions page states: “Anyone with access to the token will be able to run the tunnel”.

Where the token lives depends on the build. The release notes list “Linux service: Use —token-file instead of —token” under 2026.7.2. In the 2026.11.1 source, service install <TOKEN> writes the token to /etc/cloudflared/token with mode 0600 (common_service.go). The unit then runs tunnel run --token-file /etc/cloudflared/token (linux_service.go).

Units written by older builds can still carry the token on the ExecStart line of /etc/systemd/system/cloudflared.service. Don’t post systemctl cat cloudflared output publicly, and check your shell history for the pasted install command. To add flags such as --loglevel, run sudo systemctl edit --full cloudflared.service, then restart.

Locally-managed tunnels. These use config.yml and a credentials file. Cloudflare’s Linux service guide warns of a catch. The service looks for $HOME/.cloudflared/config.yml, and under sudo, $HOME is /root. A config in your own home directory won’t be found. Pass the path explicitly:

sudo cloudflared --config /home/<USER>/.cloudflared/config.yml service install
sudo systemctl start cloudflared
systemctl status cloudflared

Each machine supports only one cloudflared service. A second attempt fails with “cloudflared service is already installed at” followed by the unit path (service_template.go). Run sudo cloudflared service uninstall before switching tunnels. One connector is also a single point of failure. Add a replica on a second host before anyone depends on it.

To check it is running, look for active (running) in systemctl status cloudflared. Then open the tunnel under Networking > Tunnels in the Cloudflare dashboard and confirm its status. A running process with an unhealthy tunnel usually means port 7844 egress is blocked.

How do you update cloudflared on Ubuntu?

Update through apt, then restart the service. Cloudflare’s documented procedure is two lines, restart included:

sudo apt-get update && sudo apt-get install --only-upgrade cloudflared
sudo systemctl restart cloudflared.service

Why cloudflared update refuses. On a package install it logs “cloudflared was installed by a package manager. Please update using the same method”. In the 2026.11.1 updater source, it checks for the .installedFromPackageManager marker and then stops without updating. The apt commands above are the fix.

You may see that message in the journal without typing it. In the 2026.11.1 source, cloudflared service install also adds cloudflared-update.timer, which runs cloudflared update daily with up to six hours of random delay. On an apt install, each run only logs the refusal. Pass --no-update-service to service install to skip the timer.

Ubuntu’s own automatic updates won’t cover cloudflared either. Ubuntu’s automatic updates guide warns that adding a repository “WILL NOT make unattended-upgrades consider it for updates”. The Unattended-Upgrade::Allowed-Origins list in /etc/apt/apt.conf.d/50unattended-upgrades decides which repositories it uses. Unless you add Cloudflare’s origin there, cloudflared updates only when you run apt.

sudo apt-mark hold cloudflared gives full control, but release the hold on a schedule: a build pinned indefinitely eventually falls outside the one-year support window. With two replicas, restart them one at a time.

Common install errors and fixes

Signature errors after the key rotation

The repository page notes, “We have rolled our public key for package signing”. It names RPM distributions and Debian Trixie as affected. It says the old keys are “DEPRECATED and will be removed on 30 April 2026”. On Ubuntu, re-running the key command above replaces the keyring with the current key, harmless if already present. If signed-by points at a filename from an older tutorial, rewrite both files.

”Unable to locate package cloudflared”

apt prints this when no package of that name exists in its package lists, per the apt source. Common causes are:

  • Cloudflare’s repository isn’t added. Ubuntu’s own archive has no cloudflared package. A packages.ubuntu.com search across all suites returns no results.
  • apt-get update wasn’t run after adding the source. Ubuntu’s third-party repository guide says you need to run apt update after adding the repository information.
  • The .list file has a typo, or names a suite Cloudflare doesn’t publish, such as resolute.
  • The architecture isn’t served. The any suite’s Release file lists only amd64, 386, arm64, arm and armhf.

Check each one:

cat /etc/apt/sources.list.d/cloudflared.list
sudo apt-get update
apt-cache policy cloudflared
dpkg --print-architecture

The apt-cache manual page says policy prints “detailed information about the priority selection of the named package”. Look for a pkg.cloudflare.com line there. If dpkg --print-architecture prints ppc64el, riscv64 or s390x, neither the repository nor the GitHub release assets cover that host.

The tunnel stays unhealthy while the service runs

That is almost always egress on 7844, or the service running a different tunnel than expected. Work through the error 1033 fixes, which check the process, then the ports, then DNS.

How to remove cloudflared cleanly

sudo cloudflared service uninstall
sudo apt-get remove cloudflared
sudo rm /etc/apt/sources.list.d/cloudflared.list /usr/share/keyrings/cloudflare-main.gpg
sudo apt-get update

In the 2026.11.1 source, service uninstall also deletes /etc/cloudflared/token. Removing the connector doesn’t delete the tunnel object or its DNS routes. Hostnames still pointing at it serve error 1033 until you delete the tunnel in the dashboard, or with cloudflared tunnel delete <NAME> for a locally-managed tunnel. If the tunnel replaced a port forward, don’t reopen that port as a shortcut. Tunnel versus port forwarding explains why the closed port was the point.

FAQ

Is there a snap package for cloudflared?

Cloudflare doesn’t list a snap on its downloads page. The documented Linux options are the pkg.cloudflare.com apt repository, the .deb and standalone binaries on GitHub, and the cloudflare/cloudflared Docker image. Any snap would be third-party packaging of a daemon holding your tunnel credentials. Stick with Cloudflare’s own repository.

Sources

  1. Cloudflare Package Repository: cloudflared for Debian and Ubuntu
  2. Cloudflare Package Repository: Release file for the any suite
  3. Cloudflare One docs: Downloads (cloudflared)
  4. Cloudflare One docs: Update cloudflared
  5. Cloudflare One docs: Run as a service on Linux
  6. Cloudflare One docs: Tunnel run parameters
  7. Cloudflare One docs: Tunnel permissions
  8. Cloudflare One docs: Tunnel with a firewall
  9. cloudflared releases on GitHub
  10. cloudflared RELEASE_NOTES on GitHub
  11. cloudflared 2026.11.1 source: cmd/cloudflared/updater/update.go
  12. cloudflared 2026.11.1 source: cmd/cloudflared/linux_service.go
  13. cloudflared 2026.11.1 source: cmd/cloudflared/common_service.go
  14. cloudflared 2026.11.1 source: cmd/cloudflared/service_template.go
  15. Ubuntu releases: Ubuntu 26.04 LTS (Resolute Raccoon)
  16. Ubuntu Packages search: cloudflared in all suites
  17. Ubuntu Server docs: Third party repository usage
  18. Ubuntu Server docs: Automatic updates
  19. Ubuntu manpage: ufw(8), noble
  20. Ubuntu manpage: apt-cache(8), noble
  21. Ubuntu apt source: apt-pkg/cacheset.cc
  22. Ubuntu Server docs: Upgrade your release
  23. Debian Wiki: Instructions to connect to a third-party repository

Related