Skip to content

Instantly share code, notes, and snippets.

@sarkrui
Created May 31, 2023 12:19
Show Gist options
  • Save sarkrui/a2998f3a6256a43a5a41dbf5edf5947f to your computer and use it in GitHub Desktop.
Save sarkrui/a2998f3a6256a43a5a41dbf5edf5947f to your computer and use it in GitHub Desktop.
Install Cloudflared on Alpine Linux

Cloudflared Setup Guide

This guide will walk you through setting up Cloudflared on your system.

Pre-Requisites

You need to have administrative (sudo) access to your system.

Here are the steps to install Cloudflared.

# Download the latest version of cloudflared
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -O /usr/bin/cloudflared

# Give executable permissions to the downloaded file
chmod +x /usr/bin/cloudflared

# Check the version of cloudflared to confirm the installation
cloudflared -v

Creating a Cloudflare Tunnel

After installing Cloudflared, you need to create a Cloudflare tunnel.

  1. Visit https://one.dash.cloudflare.com.
  2. Navigate to Access -> Tunnels -> Create a tunnel.
  3. Fill in a name you like and save the tunnel.
  4. Find the code block below If you already have cloudflared installed on your machine.

Starting the Cloudflared Service

To start the Cloudflared service on your machine, follow the steps below:

# Start the service
/etc/init.d/cloudflared start

# Remove the service from the default runlevel (just in case it was added earlier)
rc-update del cloudflared

# Add the service to the runlevel again (this ensures that the service starts automatically when the system boots)
rc-update add cloudflared

# Start the service immediately
rc-service cloudflared start

# Add the service to the default runlevel
rc-update add cloudflared default

That's it! You have successfully installed and set up Cloudflared on your system.

Troubleshooting

If you encounter any issues while following this guide, please check the official Cloudflared documentation for further help.

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