Skip to content

Instantly share code, notes, and snippets.

@Erisa
Last active April 17, 2024 13:01
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save Erisa/4015ae12211434b8f2f64ac1d731b830 to your computer and use it in GitHub Desktop.
Save Erisa/4015ae12211434b8f2f64ac1d731b830 to your computer and use it in GitHub Desktop.
Install the Cloudflare Daemon (cloudflared) in Termux
#!/bin/sh
echo 'NOTE: You can now install cloudflared directly from Termux repos.'
echo 'NOTE: To install it from source instead, open the script and comment out the next two lines.'
pkg install cloudflared
exit
# ^ comment out these lines to proceed with the script
echo "--upgrading packages"
yes "" | pkg update
echo "-- installing dependancies: golang git debianutils make"
yes "" | pkg install golang git debianutils make
echo "-- downloading cloudflared source"
git clone https://github.com/cloudflare/cloudflared.git --depth=1
cd cloudflared
sed -i 's/linux/android/g' Makefile
echo "-- building and installing cloudflared"
make cloudflared
install cloudflared /data/data/com.termux/files/usr/bin
echo "-- done!"
@sangelxyz
Copy link

Erisa, What is the proper way to run cloudflared from termux. My phone is not rooted. so the
sudo cloudflared service install does not work. Is there another way i can run this as a service from a phone that's not rooted ?

@yelrom0
Copy link

yelrom0 commented May 21, 2022

Erisa, What is the proper way to run cloudflared from termux. My phone is not rooted. so the sudo cloudflared service install does not work. Is there another way i can run this as a service from a phone that's not rooted ?

You should be able to run apt update then apt install cloudflared or pkg run cloudflared, don't need root for commands without su or sudo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment