Skip to content

bucherfa/server-setup

Repository files navigation

home server setup

basic setup

ubuntu

  • hardware only worked with ubuntu network installer
  • select Basic Ubuntu Server and OpenSSH server during installation in the Software selection section
  • encrypt hard drive

ssh

  • add ssh keys to server
  • disable login with password over ssh in /etc/ssh/sshd_config
  • reload ssh serivce sudo service ssh restart

docker setup

  • install some software
  • add ubuntu apt repo
  • install docker-ce and docker-compose
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) \
  stable"
sudo apt update
sudo apt install docker-ce
sudo apt install docker-compose
sudo usermod -aG docker $USER #logout and login after this

backup

The backup strategy heavily relies on borgmatic which in turn relies on Borg. Follow the steps below to set it up.

  • setup borg >=1.0.8 and rclone on a remote system
    • for borg on ubuntu you need to add an additional PPA
      sudo add-apt-repository ppa:costamagnagianfranco/borgbackup
      sudo apt update
      sudo apt install borgbackup
    • for rclone
      sudo apt install rclone
      # if the version is too old, install via generic install script from https://rclone.org/downloads/
  • setup rclone
    rclone config # and follow guided configuration
    # note: $NAME is used for rclone repo by default in backup.sh
  • connect to the remote system at least once via ssh from your host machine to add it to .ssh/know_hosts
  • create a folder on the remote system where the borgmatic repos should be initialized
  • adjust the .env accordingly
  • setup ssmtp for email notifications
    sudo apt install ssmtp
    # edit file /etc/ssmtp/ssmtp.conf and add the following content
    [email protected]
    mailhub=mail.domain.tld:587
    [email protected]
    FromLineOverride=YES
    UseSTARTTLS=YES
    [email protected]
    AuthPass=secret
    # edit file /etc/ssmtp/revaliases and add the following content
    root:[email protected]:mail.domain.tld:587
    user:[email protected]:mail.domain.tld:587
    # test your configuration
    echo "Hello World!" | ssmtp [email protected]
  • setup a cron job for the backup script
    crontab -e
    # insert the following line to the end of the file
    # it writes the output first into a log file and then sends the output to a given mail address
    0 4 * * * cd /path/to/setup && ./backup.sh >> ./.logs/$(date -u +"\%Y-\%m-\%dT\%H:\%M:\%SZ").log && cat ./.logs/$(ls -t ./.logs | head -n1) | /usr/sbin/ssmtp [email protected]

notes

list all images sorted by creation date

docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Size}}" | sort -k 4

fritz.box

  • blocks all domains mapped to local ip addresses by default

    to use domains in the local network add them to:

    Home Network > Home Network Overview > Network Settings > DNS Rebind Protection

hardware

PCPartPicker Part List

Type Item Price
CPU AMD Ryzen 5 3400G 3.7 GHz Quad-Core Processor Purchased For €149.89
CPU Cooler Noctua NH-L9a-AM4 33.84 CFM CPU Cooler Purchased For €41.10
Memory Crucial 8 GB (1 x 8 GB) DDR4-2666 Memory Purchased For €31.54
Memory Crucial 8 GB (1 x 8 GB) DDR4-2666 Memory Purchased For €31.54
Storage ADATA XPG SX6000 Pro 512 GB M.2-2280 NVME Solid State Drive Purchased For €78.90
Custom ASRock Deskmini A300 AMD - Case, Motherboard, Power Supply Purchased For €142.00
Total €474.97