Skip to content

Instantly share code, notes, and snippets.

@piperswe
Last active May 24, 2022 18:37
Show Gist options
  • Save piperswe/82750ef642d71900ca770a98cbbdf72d to your computer and use it in GitHub Desktop.
Save piperswe/82750ef642d71900ca770a98cbbdf72d to your computer and use it in GitHub Desktop.
Install cloudflared with a curl|bash
#!/bin/bash
set -euxo pipefail
# Read over the script first, then run with:
# wget -qO- https://gist.githubusercontent.com/piperswe/82750ef642d71900ca770a98cbbdf72d/raw/install_cloudflared.sh | bash
# or
# curl https://gist.githubusercontent.com/piperswe/82750ef642d71900ca770a98cbbdf72d/raw/install_cloudflared.sh | bash
# It's rather unknown what versions are actually supported because
# pkg.cloudflare.com is in such a sorry state. I've tested to make sure
# each of these releases works (for cloudflared, at least).
# cloudflared isn't very picky (it's a statically linked Go binary), so
# we default to stretch if the current release isn't in this list since
# glibc is backwards-compatible
release="$(lsb_release -cs)"
if ! grep -Fxq "$release" <<EOF
# Ubuntu
focal
xenial
trusty
# Debian
bullseye
buster
stretch
EOF
then
release=stretch
fi
echo "Installing cloudflared for $release"
echo "Enter your password for sudo:"
sudo echo
echo "deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/ $release main" | sudo tee /etc/apt/sources.list.d/cloudflare-main.list
wget -qO- https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg > /dev/null
sudo apt-get update
sudo apt-get install cloudflared
cloudflared version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment