cloudflared Install, Service, Updates and Tunnel Configuration
How to install cloudflared, run it as a system service, update safely, and roll out tunnel config changes with minimal downtime.
This page summarises Cloudflare documentation on cloudflared, the lightweight daemon that connects your infrastructure to Cloudflare Tunnel. Whether you are exposing a private app, proxying arbitrary TCP, running a key server, or previewing a local project, you install cloudflared on the host (and sometimes on each client), keep it current, and usually run it as a service so the tunnel stays up after reboot.
cloudflared role: what it does and where to install it
Section titled “cloudflared role: what it does and where to install it”cloudflared maintains an outbound-only connection from your machine to Cloudflare; tunnel traffic is proxied over that link.
The Cloudflare daemon, cloudflared, will maintain a secure, persistent, outbound-only connection from the machine to Cloudflare. Arbitrary TCP traffic will be proxied over this connection using Cloudflare Tunnel ↗︎.
— Cloudflare, Arbitrary TCP
For Cloudflare Tunnel, Cloudflare describes cloudflared as required server-side software:
Cloudflare Tunnel requires the installation of a lightweight server-side daemon, cloudflared, to connect your infrastructure to Cloudflare. If you are creating a tunnel through the dashboard, you can simply copy-paste the installation command shown in the dashboard.
— Cloudflare, Downloads
Install it on:
- The origin or key server hosting the resource (Keyless SSL — Cloudflare Tunnel, Public DNS).
- Each client device that connects through client-side
cloudflared(Arbitrary TCP). - Machines used by coding agents after you authenticate agents (prerequisite: download and install
cloudflared).
cloudflared is open source; release binaries and notes are referenced from the Downloads and Tunnel downloads pages.
Download and install cloudflared: package manager vs binary
Section titled “Download and install cloudflared: package manager vs binary”Pick an install method for your OS, then confirm the binary runs. Dashboard-created tunnels can use the install command copied from the UI (Downloads).
Detailed CLI steps for locally managed tunnels are in Create a locally-managed tunnel (mirrored at Tunnel — create local tunnel).
Linux: APT, RPM, Arch, or manual binary
Section titled “Linux: APT, RPM, Arch, or manual binary”On Debian and Ubuntu, Cloudflare documents adding the Cloudflare package repository signing key and repo, then:
sudo apt-get update && sudo apt-get install cloudflaredRHEL-family systems use the yum repo and sudo yum install cloudflared. Arch users can install from the community repo with pacman -Syu cloudflared. Alternatively, download .deb, .rpm, or architecture-specific binaries from Downloads — Linux.
macOS: Homebrew or direct Darwin builds
Section titled “macOS: Homebrew or direct Darwin builds”brew install cloudflaredYou can also install via Homebrew or fetch Darwin arm64 or amd64 builds (Downloads — macOS). The Tunnel changelog notes macOS users can get cloudflared-arm64.pkg from GitHub in addition to Homebrew.
Windows: executable or MSI from GitHub
Section titled “Windows: executable or MSI from GitHub”Download the latest 32-bit or 64-bit executable or MSI from GitHub via Downloads — Windows. After download, rename if needed and check version in PowerShell (Create a locally-managed tunnel — Windows):
.\cloudflared.exe --versionBuild from source (optional)
Section titled “Build from source (optional)”Cloudflare documents cloning github.com/cloudflare/cloudflared, make cloudflared, and optional go install (Create a locally-managed tunnel).
| Approach | Typical use | Update path |
|---|---|---|
| Dashboard install command | Remotely managed tunnel | Replace container or follow Update cloudflared |
Package manager (apt, yum, brew) |
Servers with repo access | Same package manager; see .installedFromPackageManager check below |
| GitHub binary / source | Custom paths, air-gapped builds | cloudflared update where supported |
Verify cloudflared is installed correctly
Section titled “Verify cloudflared is installed correctly”Run cloudflared --version in your shell before creating or running a tunnel.
Confirm that cloudflared is installed correctly by running cloudflared –version in your command line:
— Cloudflare, Preview Local Projects with Cloudflare Tunnel
Useful diagnostics:
| Command | Purpose |
|---|---|
cloudflared version |
Version and build date |
cloudflared help |
Top-level commands |
cloudflared update |
Fetch new binary (GitHub/source installs only) |
See Useful commands — Manage cloudflared.
Some features need a minimum version—for example, Tunnel diagnostic logs require cloudflared version 2024.12.2 or later.
Supported release window
Section titled “Supported release window”Cloudflare supports cloudflared versions within one year of the latest release; older builds may break without notice (Downloads — Deprecated releases). Clientless access best practices recommend updating regularly for features and bug fixes.
Run cloudflared as a service: Linux, macOS, and Windows
Section titled “Run cloudflared as a service: Linux, macOS, and Windows”Running as a service is the default recommendation so cloudflared starts at boot and keeps serving while your origin is online.
In most cases, we recommend running cloudflared as a service. Running as a service helps ensure the availability of cloudflared to your origin by allowing the program to start at boot and continue running while your origin is online.
— Cloudflare, Run as a service
Overview: Run as a service. OS guides: Linux, macOS, Windows.
Linux systemd: install and config path pitfalls
Section titled “Linux systemd: install and config path pitfalls”Prerequisites: complete steps 1–4 of the tunnel CLI setup so you have a named tunnel and config.yml under .cloudflared (Linux as a service).
-
Install the unit:
cloudflared service install(often withsudo). -
If
sudomakes$HOMEpoint to/rootand your config lives under/home/<USER>/.cloudflared/config.yml, install with an explicit path:sudo cloudflared --config /home/<USER>/.cloudflared/config.yml service install -
Start and check:
systemctl start cloudflared, thensystemctl status cloudflared. -
After routing or config changes:
systemctl restart cloudflared.
macOS: login agent vs boot daemon
Section titled “macOS: login agent vs boot daemon”- At login:
cloudflared service install— launch agent using~/.cloudflared/. - At boot:
sudo cloudflared service install— launch daemon using/etc/cloudflared.
Manual start: sudo launchctl start com.cloudflare.cloudflared (logs under /Library/Logs/). Restart after config changes with launchctl stop / start (macOS as a service).
Windows service: separate system profile config
Section titled “Windows service: separate system profile config”Windows setup copies cloudflared.exe to C:\Cloudflared\bin, runs cloudflared.exe service install, places credentials under C:\Windows\System32\config\systemprofile\.cloudflared, validates ingress, and may adjust the service ImagePath in the registry (Windows as a service). Restart with sc stop cloudflared / sc start cloudflared.
For multiple instances on Windows, each service needs a unique name via sc.exe create (Update cloudflared — Run multiple instances in Windows).
Update cloudflared: restarts, autoupdate, and package managers
Section titled “Update cloudflared: restarts, autoupdate, and package managers”Any update restarts cloudflared, which can interrupt active connections unless you plan for redundancy.
Updates will cause cloudflared to restart which will impact traffic currently being served. You can perform zero-downtime upgrades by using Cloudflare’s Load Balancer product or by using multiple cloudflared instances.
— Cloudflare, Update cloudflared
When built-in autoupdate runs
Section titled “When built-in autoupdate runs”Documented in Tunnel run parameters — autoupdate-freq and Run parameters:
Built-in automatic updates are enabled when cloudflared is installed as a standalone binary and runs as a service. They are not available on Windows, for package-manager installations, or when cloudflared runs interactively in a terminal. When an update is available, cloudflared restarts to use the new version. The updater does not wait for the replacement process to connect to Cloudflare before shutting down the old process. Active connections may be interrupted.
Default check interval: cloudflared tunnel --autoupdate-freq <FREQ> run <UUID or NAME> defaults to 24h. Disable with --no-autoupdate or environment variable NO_AUTOUPDATE.
Detect package-manager installs:
ls -la /usr/local/etc/cloudflared/Look for .installedFromPackageManager (Run parameters — no-autoupdate).
Manual update by install type
Section titled “Manual update by install type”Follow Update cloudflared / Update the cloudflared service:
- Standalone binary / source:
cloudflared update, then restart the service (e.g.sudo systemctl restart cloudflared.service). apt:sudo apt-get update && sudo apt-get install --only-upgrade cloudflared.dpkg -i: download latest.debfrom GitHub releases andsudo dpkg -i.yum:sudo yum update cloudflared.brew:brew upgrade cloudflared, then restart macOS launchd as documented.- Windows service: after
cloudflared update,net start cloudflared. - Docker (dashboard token): run a new container from the latest image with the token from Networking > Tunnels; Cloudflare recommends remotely managed tunnels with Docker.
Zero-downtime: tunnel replicas, DNS swap, and config rollout
Section titled “Zero-downtime: tunnel replicas, DNS swap, and config rollout”Use a second cloudflared instance (or Load Balancer priorities) so one connector can take traffic while the other updates or stops.
Configuration file changes without full outage
Section titled “Configuration file changes without full outage”When editing a locally managed tunnel config, Cloudflare suggests a replica rollout (Configuration file):
- Keep the original instance running with the old config.
- Start a replica with the updated config file.
- Wait until the replica is fully running and usable.
- Stop the first instance.
When the first instance of cloudflared is stopped, long-lived HTTP requests (for example, Websocket) and TCP connections (for example, SSH) will be dropped. UDP flows will also be dropped, as they are modeled based on timeouts. When the new replica connects, it will handle all new traffic, including new HTTP requests, TCP connections, and UDP flows.
— Cloudflare, Configuration file
The same traffic-handling note applies when swapping instances during Update with multiple cloudflared instances (point the new instance at the same origin, change DNS to the new address, remove the old instance). With Cloudflare Load Balancer, add the new connector as priority 2, promote to priority 1, then drain the old one.
Common mistakes when installing and operating cloudflared
Section titled “Common mistakes when installing and operating cloudflared”- Wrong config location for Linux services — installing with
sudowithout--configwhenconfig.ymlis in a user home directory (Linux as a service). - Expecting autoupdate on Windows or with package managers — automatic updates are unavailable there; plan manual upgrades (Run parameters).
- Using
cloudflared updateafterapt/yum/brewinstall — update with the same package manager (Useful commands). - Restarting the only connector during long-lived sessions — WebSocket, SSH, and UDP flows drop on stop; use replicas or load balancing (Configuration file).
- Running an unsupported OS for key servers — prefer supported Linux packages from the package repository for key server deployments.
How to check this on your site
Section titled “How to check this on your site”- On the tunnel host, run
cloudflared --versionand compare with the supported window on Downloads. - Confirm the connector runs as a service (
systemctl status cloudflared, Windows Services, or macOSlaunchctl) per Run as a service. - After any upgrade, restart the service using the commands for your OS in Update cloudflared and verify tunnel health in the Cloudflare dashboard (Networking > Tunnels).
- If you use diagnostic logs, ensure the host meets the version prerequisite in Tunnel diagnostic logs.
- You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page does not match your experience or the linked Cloudflare docs, email yimasynthetic@gmail.com with the page URL and the exact statement you want clarified.