Homelab
Selfhosting
I started my first homelab project as I watched a YouTube video about PiHole. Since I had a spare Raspberry Pi 3 at home, I immediately started setting it up, and I’ve been hooked ever since. My current server is an HP thin client which has more memory and a better storage solution than the Pi.
Overview #
architecture-beta
group homenetwork(cloud)[Homenetwork]
service disk(disk)[HDD Storage] in homenetwork
service server(server)[Server] in homenetwork
service gateway(internet)[PiVPN] in homenetwork
service diskbackup(disk)[Backup HDD Storage] in homenetwork
service internet(internet)[Internet]
disk:L -- R:server
gateway:R -- L:server
gateway:L <-- R:internet
diskbackup:T <-- B:server
Services #
PiHole (DNS-Adblocker) #
I started by flashing the SD card using the official Raspberry Pi operating system (previously called Raspbian). After boot, I installed the firewall management software UFW and denied all incoming requests and allowed all outgoing connections. Since I want to access the web interface from my local network, I allowed connections from my local address space to port 80.
I disabled the password login via SSH and created an SSH key on my local machine and disabled the root user on the Raspberry Pi.
Installing the PiHole software was done using this single command:
curl -sSL https://install.pi-hole.net | bashAfter the setup prompt, I needed to change the DNS server for the connected devices to use the PiHole instance. By doing this on the router, I can change the DNS server on all devices.
PiVPN (VPN) #
In some cases, it is necessary to access my home network from outside, e.g. when I forget to push some local development progress to GitHub, or when I want to access the computational power of my PC at home. For this, I wanted to host a VPN service to connect to my local network. The software solution chosen was PiVPN.
PiVPN provides a simple setup for a WireGuard or OpenVPN service on the Raspberry Pi. As a first start, you need to check if your ISP gives you a static IP. Since I did not have one, I did the setup of the VPN service using my FQDN.
The installation of the PiVPN software is as simple as the installation of the PiHole.
curl -L https://install.pivpn.io | bashSamba (NAS) #
In addition to my VPN and PiHole, I used a spare HDD and connected it via USB to my Raspberry Pi. After installing Samba with
sudo apt install samba samba-common-binI now have a personal cloud which I can access from anywhere using my VPN.
Nextcloud #
For my photo backup, personal calendar and my contacts, I switched to Nextcloud.
Backup #
For a backup I tried to implement the 3 - 2 - 1 rule. The server does weekly backups (because data barely changes in one week) to a secondary HDD disk using Borg.