Skip to content

Instantly share code, notes, and snippets.

@NicolaiSoeborg
Last active September 25, 2024 13:40
Show Gist options
  • Save NicolaiSoeborg/f2e787e43a3ea777d47438d9c7b85965 to your computer and use it in GitHub Desktop.
Save NicolaiSoeborg/f2e787e43a3ea777d47438d9c7b85965 to your computer and use it in GitHub Desktop.

adduser --system coredns --home /var/lib/coredns

Create /etc/systemd/system/coredns.service:

[Unit]
Description=CoreDNS DNS server
Documentation=https://coredns.io
After=network.target

[Service]
PermissionsStartOnly=true
LimitNOFILE=1048576
LimitNPROC=512
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
User=coredns
WorkingDirectory=/var/lib/coredns
ExecStart=/usr/local/bin/coredns -conf=/etc/coredns/Corefile
ExecReload=/bin/kill -SIGUSR1 $MAINPID
Restart=on-failure

[Install]
WantedBy=multi-user.target
  • wget [latest from github]
  • sudo mv coredns /usr/local/bin/
  • sudo systemctl daemon-reload
  • sudo systemctl enable coredns
  • sudo systemctl start coredns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment