李光春

Debian:Linux安装Cloudflared

· 李光春

准备环境

apt-get update
apt-get install ca-certificates curl gnupg
# mkdir -p --mode=0755 /usr/share/keyrings

使用 官方 存储库

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

使用 代理 存储库

curl -fsSL https://cloudflared-proxy.dtapp.top/cloudflare-main.gpg | tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://cloudflared-proxy.dtapp.top/cloudflared bookworm main' | tee /etc/apt/sources.list.d/cloudflared.list

更新

apt-get update && apt-get upgrade

安装

apt-get update
apt-get install cloudflared

验证安装

cloudflared --help

启动

cloudflared service install xxx

journalctl -u cloudflared -f

频繁掉线问题

# 修改服务文件
nano /etc/systemd/system/cloudflared.service 
# 在 ExecStart 的 tunnel run 后面加上 --protocol http2 或 --protocol auto
--protocol http2
# 重启服务
systemctl restart cloudflared