This repository contains the code of my server, which is available at marcelgarus.dev.
This chapter describes my server setup, primarily for my future self. The server runs Ubuntu 18.04 LTS 64bit; it's a small machine hosted by Strato.
Using the GNU screen utility, you can connect to the server multiple times while retaining the same terminal state.
screen -S <name> starts a new named screen session.
Detach from a screen using ctrl+a ctrl+d.
screen -list lists all screens in the form <pid>.<name>
Screens can be re-connected to using screen -d -r <id>.
No Firewall is needed; only a few programs are listening on ports, so it's easy to get an overview. To see which programs listen on ports, do:
netstat -tulpn- Install Git
apt install curl git nano build-essential pkg-config libssl-dev
- Install Caddy
- Clone this repo
git clone https://github.com/MarcelGarus/server.git cd server - Make the production Caddyfile the system Caddyfile:
cp production.Caddyfile /etc/caddy/Caddyfile
- Enable Caddy:
systemctl enable caddy
Done! The server will run, even when the system restarts.
Later on, you can apply updates like this:
git pull && cargo runapt install ddclientThis will automatically start a wizard, where you can enter random values. Configuring is instead done using the configuration file:
nano /etc/ddclient.confThe content should be this:
## Update every 300 seconds.
daemon=300
## Log stuff to these files.
cache=/tmp/ddclient.cache
pid=/var/run/ddclient.pid
## Get the public IP address via dyndns.org
use=web, web=checkip.dyndns.org
# Update using Namecheap.
protocol=namecheap
server=dynamicdns.park-your-domain.com
login=marcelgarus.dev
password='the-namecheap-dyn-dns-password'
ssl=yes
@.marcelgarus.dev, *.marcelgarus.dev
login=marcelgarus.de
password='the-namecheap-dyn-dns-password'
ssl=yes
@.marcelgarus.de, *.marcelgarus.de
login=mgar.us
password='the-namecheap-dyn-dns-password'
ssl=yes
@.mgar.us, *.mgar.us
login=marcel.jetzt
password='the-namecheap-dyn-dns-password'
ssl=yes
@.marcel.jetzt, *.marcel.jetztTo test if it works:
ddclient -daemon=0 -noquiet -debugThe cache file is at /tmp/ddclient.cache, and you might need to delete it if you want to re-set the DynDNS A+ record, although the IP didn't change.
Make ddclient start when the system is booted:
update-rc.d ddclient defaults
update-rc.d ddclient enable