Traefik is a modern HTTP reverse proxy and load balancer designed for deploying microservices. In this tutorial, we will guide you through the process of installing Traefik on Debian Latest.
Before installing Traefik, make sure your Debian server meets the following requirements:
It’s always good practice to update your system before you start installing any new packages. Use the following commands to update the system:
sudo apt update
sudo apt upgrade
Traefik requires Docker to manage and run containers. You can use the following commands to install Docker on Debian:
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
After installing Docker, you can check its version using the following command:
docker version
There are different ways to install Traefik on Debian, but in this tutorial, we will use Docker Compose to manage Traefik and its dependencies. Follow the steps below to install Traefik:
sudo curl -sSL https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
docker-compose --version
sudo mkdir /etc/traefik.d
cd /etc/traefik.d
sudo nano traefik.yaml
version: '3'
services:
reverse-proxy:
image: traefik:v2.2
container_name: traefik
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
- "--providers.docker.exposedbydefault=false"
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik.yaml:/etc/traefik/traefik.yaml
- ./acme.json:/etc/traefik/acme.json
restart: always
Save and close the file.
Create another file to store your ACME configuration.
sudo touch acme.json
sudo chmod 600 acme.json
sudo nano docker-compose.yaml
version: '3'
services:
reverse-proxy:
image: traefik:v2.2
container_name: traefik
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
- "--providers.docker.exposedbydefault=false"
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik.yaml:/etc/traefik/traefik.yaml
- ./acme.json:/etc/traefik/acme.json
restart: always
Save and close the file.
Start and test your Traefik installation.
To test whether Traefik is working, run the following command:
sudo docker-compose up -d
Now you can access the Traefik UI by visiting http://your_server_ip:8080/dashboard/
. You should see a dashboard with details about the Traefik containers running on your server.
In this tutorial, we have shown you how to install Traefik on Debian Latest. By following these steps, you should have successfully installed Traefik and started to use it to manage and run your microservices.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!