Last active
September 25, 2021 20:11
-
-
Save thePanz/d40ab0ee07705f4aa2921392c6a8f31f to your computer and use it in GitHub Desktop.
Caddy arm6 install script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Install script extracted from: https://github.com/caddyserver/caddy/tree/master/dist/init/linux-systemd | |
set -x | |
URL="https://caddyserver.com/download/linux/arm6?license=personal&telemetry=off" | |
TEMP="/tmp/caddy" | |
DEST="/tmp/caddy-latest_linux_arm6_personal.tar.gz" | |
curl "${URL}" -o ${DEST} | |
sudo rm -fr ${TEMP} | |
mkdir -p ${TEMP} | |
tar x -C ${TEMP} -f ${DEST} | |
sudo systemctl stop caddy.service | |
# Put the caddy binary in the system wide binary directory and give it appropriate ownership and permissions: | |
sudo cp ${TEMP}/caddy /usr/local/bin | |
sudo chown root:root /usr/local/bin/caddy | |
sudo chmod 755 /usr/local/bin/caddy | |
# Give the caddy 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/caddy | |
# Install the systemd service unit configuration file, reload the systemd daemon, and start caddy: | |
sudo cp ${TEMP}/init/linux-systemd/caddy.service /etc/systemd/system/ | |
sudo chown root:root /etc/systemd/system/caddy.service | |
sudo chmod 644 /etc/systemd/system/caddy.service | |
sudo systemctl daemon-reload | |
sudo systemctl start caddy.service | |
# Have the caddy service start automatically on boot if you like: | |
sudo systemctl enable caddy.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment