Skip to content

Install Cloudflared Tunnel (DoH)

☣┌͜∩͜┐͜(͜◣͜_͜◢͜)͜┌͜∩͜┐☣ edited this page Feb 22, 2024 · 5 revisions


Contains the command-line client for Cloudflare Tunnel, a tunneling daemon that proxies traffic from the Cloudflare network to your origins. This daemon sits between Cloudflare network and your origin (e.g. a webserver). Cloudflare attracts client requests and sends them to you via this daemon, without requiring you to poke holes on your firewall --- your origin can remain as closed as possible

Download Cloudflared

(Currently using package for arm platforms. If using amd or a other platform, please download correct package)
(Check: dpkg --print-architecture)

For 32bit OS

Download Cloudflared ARM 32bit:

Go to https://github.com/cloudflare/cloudflared/releases , right click on cloudflared-linux-arm and copy link. In terminal type "wget copiedlink" . For example:

wget https://github.com/cloudflare/cloudflared/releases/download/2021.12.4/cloudflared-linux-arm

Rename and copy the cloudflared file to /usr/local/bin/ and update permissions:

sudo cp cloudflared-linux-arm /usr/local/bin/cloudflared && sudo chmod +x /usr/local/bin/cloudflared
For 64bit OS

Download Cloudflared ARM 64bit:

Go to https://github.com/cloudflare/cloudflared/releases , right click on cloudflared-linux-arm64 and copy link. In terminal type "wget copiedlink" . For example :

wget https://github.com/cloudflare/cloudflared/releases/download/2021.3.0/cloudflared-linux-arm64

Rename and copy the cloudflared file to /usr/local/bin/ and update permissions:

sudo cp cloudflared-linux-arm64 /usr/local/bin/cloudflared && sudo chmod +x /usr/local/bin/cloudflared

Check version (after installing Cloudflared 64bit or 32bit):

cloudflared -v

Create a cloudflared user to run the daemon

Add user:

sudo useradd -s /usr/sbin/nologin -r -M cloudflared

Download and save the cloudflared config file to /etc/default:

cd /etc/default && sudo wget https://raw.githubusercontent.com/trinib/Adguard-Wireguard-Unbound-Cloudflare/main/cloudflared

Set correct permissions:

sudo chown cloudflared:cloudflared /etc/default/cloudflared && sudo chown cloudflared:cloudflared /usr/local/bin/cloudflared

Download the cloudflared service file and save it to /lib/systemd/system:

cd /lib/systemd/system && sudo wget https://raw.githubusercontent.com/trinib/Adguard-Wireguard-Unbound-Cloudflare/main/cloudflared.service && cd $h

Enable the systemd service to run on startup, then start the service:

sudo systemctl enable cloudflared && sudo systemctl start cloudflared

Check status:

sudo systemctl status cloudflared

ctrl + c to exit status window

Important

The cloudflared tool will not receive updates through the package manager. However, you should keep the program update to date. You can either do this manually, or automatically with cron script.

Open cron file:

crontab -e

Paste command at end of file:

0 3 * * FRI sudo cloudflared update && sudo systemctl restart cloudflared

Will run at 3am every Friday.