Thursday, September 29, 2022

How to Install Traefik in Debian (Without Docker)

 Download the suitable version of Traefik for your system from here:

https://github.com/traefik/traefik/releases

as an example, we'll be download the linux 64 bit version:

wget https://github.com/traefik/traefik/releases/download/v2.8.7/traefik_v2.8.7_linux_amd64.tar.gz

extract those package:

tar -xzvf traefik_v2.8.7_linux_amd64.tar.gz

set the traefik as executable and move the traefik binary to linux bin folder

chmod +x traefik

mv traefik /usr/local/bin/traefik

Give the traefik binary the ability to bind to privileged ports (e.g. 80, 443) as a non-root user:

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/traefik

Set up the user, group, and directories that will be needed:


sudo groupadd -g 321 traefik

sudo useradd \

  -g traefik --no-user-group \

  --home-dir /var/www --no-create-home \

  --shell /usr/sbin/nologin \

  --system --uid 321 traefik


sudo mkdir /etc/traefik

sudo mkdir /etc/traefik/acme

sudo chown -R root:root /etc/traefik

sudo chown -R traefik:traefik /etc/traefik/acme


Place your traefik configuration file ("traefik.toml") in the proper directory and give it appropriate ownership and permissions:


sudo cp /path/to/traefik.toml /etc/traefik/

sudo chown root:root /etc/traefik/traefik.toml

sudo chmod 644 /etc/traefik/traefik.toml


Install the systemd service unit configuration file, reload the systemd daemon, and start traefik:


sudo cp /path/to/traefik.service /etc/systemd/system/

sudo chown root:root /etc/systemd/system/traefik.service

sudo chmod 644 /etc/systemd/system/traefik.service

sudo systemctl daemon-reload

sudo systemctl start traefik.service


Have the traefik service start automatically on boot if you like:

sudo systemctl enable traefik.service


.


0 comments:

Post a Comment