Cloudflare Docs
Cloudflare Zero Trust
Visit Cloudflare Zero Trust on GitHub
Set theme to dark (⇧+D)

Run as a service on Linux

You can install cloudflared as a system service on Linux.

​​ Prerequisites

Before you install Cloudflare Tunnel as a service on Linux, follow Steps 1 through 4 of the Tunnel CLI setup guide. At this point you should have a named tunnel and a config.yml file in your .cloudflared directory.

​​ 1. Configure cloudflared as a service

By default, Cloudflare Tunnel expects all of the configuration to exist in the $HOME/.cloudflared/config.yml configuration file. The available options are documented on the configuration file reference, but at a minimum you must specify the following arguments to run as a service:

ArgumentDescription
tunnelThe UUID of your tunnel
credentials-fileThe location of the credentials file for your Tunnel

​​ 2. Run cloudflared as a service

  1. Install the cloudflared service.

    $ cloudflared service install
  2. Start the service.

    $ systemctl start cloudflared
  3. (Optional) View the status of the service.

    $ systemctl status cloudflared

​​ Next steps

You can now route traffic through your tunnel. If you add IP routes or otherwise change the configuration, restart the service to load the new configuration:

$ systemctl restart cloudflared