Skip to main content

Install Traefik Hub Gateway on Linux


Prerequisites

You should have access to a working virtual machine/host, either on a cloud provider or on your own infrastructure.

Make sure that you have the following installed:

  • systemd
  • Traefik Hub binary
  • A Traefik Hub Gateway token to use licensed Hub features. If you don't have one yet, skip it to run Traefik Hub in Proxy Mode. This means that you can access Traefik Proxy features but not Hub features, till you apply a valid license. Add a token later without redeploying.
  • Networking requirements if you're using a token and validating it online, so the gateway can reach Traefik Hub. For environments without outbound access, see Offline Mode.

Install with Systemd

  1. Download the Traefik Hub binary for your architecture from the releases page:
curl -L -o traefik-hub.tar.gz https://github.com/traefik/hub/releases/download/<version>/traefik-hub_<version>_linux_amd64.tar.gz
tar -xzf traefik-hub.tar.gz
sudo mv traefik-hub /usr/local/bin/traefik-hub
  1. Copy and paste the following instructions in /etc/systemd/system/traefik-hub.service:
Install Traefik Hub API Gateway
[Unit]
Description=Traefik Hub
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service

[Service]
Restart=on-abnormal
User=traefik-hub
Group=traefik-hub
ExecStart=/usr/local/bin/traefik-hub --configfile=/etc/traefik-hub/traefik-hub.toml
; Use private /tmp and /var/tmp, which are discarded after traefik stops.
PrivateTmp=true
; Hide /home, /root, and /run/user. Nobody may have access to SSH-keys.
ProtectHome=true
; Make /usr, /boot, /etc and possibly some more folders read-only.
ProtectSystem=full
; The following additional security directives only work with systemd v229 or later.
; They further restrict privileges that can be gained by traefik. Uncomment if you like.
; Note that you may have to add capabilities required by any plugins in use.
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target
  1. Create the configuration file at /etc/traefik-hub/traefik-hub.toml:
Traefik Hub API Gateway config file
[hub]
token = "YOUR-TRAEFIK-HUB-TOKEN"

[entryPoints]
[entryPoints.web]
address = ":80"

[entryPoints.websecure]
address = ":443"

[log]
level = "INFO"
filePath = "/var/log/traefik-hub.log"

# Enable API and dashboard
[api]

# Enable ping
[ping]

Replace YOUR-TRAEFIK-HUB-TOKEN with the token provided by Traefik Labs, or remove the [hub] token = "YOUR-TRAEFIK-HUB-TOKEN" line entirely to run in Proxy Mode.

  1. Reload the daemon, enable, and start the service:
sudo systemctl daemon-reload
sudo systemctl enable traefik-hub
sudo systemctl start traefik-hub
  1. Check the service status:
sudo systemctl status traefik-hub
Offline Mode

Working in an air-gapped environment? Want to install Traefik Hub API Gateway in an offline mode?

Check out the Offline Mode documentation.