How to Install Headscale on Debian Latest
Headscale is a self-hosted implementation of the Tailscale control plane. In this tutorial, we'll learn how to install Headscale on Debian latest.
Prerequisites
Before we begin, make sure that you have the following:
- A server running Debian latest
- A sudo user
- Basic knowledge of the Linux command line
Step 1: Install dependencies
First, we need to install some dependencies required by Headscale. Open the terminal and run the following command:
sudo apt update
sudo apt install -y curl git gnupg2 net-tools
This command will update the package list and install the necessary dependencies.
Step 2: Install Go
Next, we need to install Go programming language. Go is required to build and run Headscale.
Run the following commands to install Go:
wget https://golang.org/dl/go1.16.3.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.16.3.linux-amd64.tar.gz
This command will download the Go binary file and extract it to /usr/local.
Step 3: Clone Headscale
We need to clone the Headscale repository from GitHub. Run the following command to clone the repository:
git clone https://github.com/juanfont/headscale.git
This command will clone the Headscale repository to the current directory.
Step 4: Build Headscale
Now we need to build Headscale using the Go compiler. Run the following commands to build Headscale:
cd headscale
go build ./cmd/headscale
This command will compile the Headscale binary.
Step 5: Configure Headscale
Headscale requires a configuration file named config.yaml to run. We need to create the config.yaml file and specify the required configuration parameters.
Run the following command to create a config.yaml file:
cp config.yaml.sample config.yaml
Now, open the config.yaml file in a text editor and modify the following parameters:
- publichost: The public hostname or IP address of your server.
- db: The database settings. You can use the default settings for this tutorial.
- auth: The authentication method. You can use the default settings for this tutorial.
Step 6: Run Headscale
Now we can start the Headscale server. Run the following command to start the Headscale server:
./headscale serve
Headscale should start up and listen on port 3478.
Step 7: Verify Headscale
To verify that Headscale is working correctly, open a web browser and navigate to the URL http://<publichost>:3478/ (replace <publichost> with the public hostname or IP address of your server). You should see a Headscale login page.
Congratulations! You have successfully installed and configured Headscale on Debian latest.
Conclusion
In this tutorial, we have learned how to install and configure Headscale on Debian latest. Headscale provides a self-hosted implementation of the Tailscale control plane, allowing you to securely connect your devices to a private network.