My Raspberry Pi 4 Setup
These blog posts will help me document my journey and projects, incuding my newly bought Raspberri Pi 4B, this website you’re seeing right now, and some other stuff that I might pick up later on.
What does my SBC need to do?
My Raspberry Pi 4B needs to serve as a home server that can handle multiple tasks simultaneously. Here’s what I want it to do:
- Host a development server to run some code
- Provide a VPN-Tunnel so I can connect to my network from anywhere
- Block all the ads on my network by acting as a DNS-Resolver
- Notify me when services are down or unresponisive
- Run all of that in their own Docker containers
Where to start
First, we want to install the OS. To do that, we need to download the Raspberry Pi OS Lite (because I have no monitor at the moment anyways, so doesnt’t really matter if I have a desktop environment) image from the official website and flash it onto the SD-Card. While still being on the electronic device where you’re downloading from, you’ll get to configure the basic stuff like hostname, username, password, and WiFi. This is where you can also enable SSH, which we’ll need to access the device remotely.
After that, we can put the SD-Card into the Raspberry Pi and boot it up. You’ll see the board light up on one side, so make sure to look out for that. If booted up, we can connect to it via SSH and start configuring it.
Basic Configuration
To enhance the configuration and to make it easier to navigate I first created a user that provides me with the right permissions so I get to skip the ‘sudo’ command everytime I want to do something. This is done by running the following command:
After that I gave it a static-ip, so I don’t have to worry about the IP changing and the Pi getting lost somewhere. While being in the config file of the Pi already, I configured the fan controls, so that the fan doesn’t spin unless it hits 60°C. While it isn’t any more than a weird little humming sound, it’s still nicer to have it off, if not needed. After that, I configured the UFW Firewall by allowing the port(s) needed to SSH onto my Pi. This prevents any other ways of entering it and accessing my data.
Tailscale
To be able to access my network remotely, I installed Tailscale on my Pi. It’s a really easy to use VPN-Service, that’s also free for up to 20 devices. It’s also really easy to configure and use. I just had to install Tailscale onto my Pi and connect it to my account, where we can also configure other devices like your Laptop, PC or Phone. Now, by enabling Tailscale on one of those devices, which enables the VPN so I can access my network, I can access my Pi from anywhere by adressing its new Tailscale IP address.
Docker
To safely host multiple services on my Pi, I installed Docker. Docker allows me to run multiple services in their own containers, which are isolated from each other and from the host system. This way, if one service crashes, it won’t affect the others. I also installed Docker Compose, which allows me to run multiple containers at the same time.
Next Steps
Now that Docker is set up, I plan to start deploying my services. The first thing I’ll be setting up is Adguard Home, which will act as a DNS-Resolver and block ads on my network. After that, I’ll set up a monitoring service like Uptime Kuma, which will notify me when services are down or unresponsive. I’ll also be looking into setting up a development server, so I can run and test code directly on the Pi.
Stay tuned for more posts where I’ll document each of these setups in detail!
