zkbro

💡 Self-host something new every day for a week

2025-06-23 18:30

Yeah I'm a sucker for punishment. It's how I avoid doing important, less fun stuff, like studying for an exam I may or may not have coming up in two weeks. But at the same time, throwing myself into a deep end is a bloody good way to learn things quickly..

So, for the next week every day I am going to attempt to self-host something new I haven't self-hosted before. I have a Raspberry Pi 4, where I am already hosting a gemini capsule and notes website. I'll continue to use the Pi for the hosting, but may throw in my old Android into the mix too. I have a rough idea of the things I want to host, but I don't have 7 things yet. I'll see where I land.

I'll write a little bit on each one as I go. Not a full on how-to, but just a dump of the gist of it (I need to sleep at some point!). Anyway, to day one...

Self-host a UniFi Network Server

Kinda cheating for day 1. I did this for work. But it was a first for me, so it makes the cut. We use UniFi Network Server to manage WiFi networks for clients who don't own a Ubiquiti router, but do own UniFi Access Points. We were previously hosting UniFi Network Server on a Digital Ocean remote server, and the boss was keen to bring it in-house after a few issues. We got a Raspi 4 for the job, because I had some (VERY limited) experience with one.

So yeah, it was on me.

First was updating the Debian 12 Bookworm OS that was on the Raspi. Pretty straight forward. Just follow the prompts. Oh I had to dig out a stray keyboard and monitor so I could set it all up in the workshop.

Once I was in the desktop environment, I opened the terminal and after sudo -i to login as root, typed:

curl -sO https://get.glennr.nl/unifi/install/install_latest/unifi-latest.sh && bash unifi-latest.sh

This installs the server using a custom script which is recommended on the official site and forums to help step through all the installation dependencies. It worked flawlessly.

I then checked it was running as a service:

sudo systemctl status unifi.service

All sweet.

I then turned off the desktop environment on boot, and rebooted into the console. I checked the service again. All good. I also want to be able to use PuTTY later to SSH into the Raspi from our work Windows laptops, for any maintenance and upkeep. So I installed, enabled, and started openssh-server:

sudo apt install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh

Note to self: I need to change the default SSH port.

By logging into the Digital Ocean-hosted server, I could download the existing .unf backup configuration file by going to any one of the sites --> Settings --> Backup --> Download. This is the file I need to load onto the new server to migrate across.

First I noted the Pi's local IP address by typing:

ip a

On my laptop I went to the address https://192.168.*.*:8334/ and it came up with the server GUI. There was a big fat button there under the login prompts asking to load from backup. Perfect! I clicked it, loaded the .unf file, and boom, everything was there just like the other one.

Now, what if we want to access it remotely? I logged into our workshop's UniFi Site Manager dashboard, found "Port Forwarding" somewhere in Settings, added 8334 incoming via TCP and pointed it towards the 192.168.. local adresss port 8334.

Test with public IP address. Works. We're good.

I could then unplug the monitor and keyboard, move the Pi up into the rack, and plug in a patch lead to the switch. Oh wait, woops, now I'm on a wired connection, no need for WiFi, got a different local IP now too, damnit.

Back in the UniFi dashboard, found the wired IP, made it a static IP so it doesn't change, updated the port forwarding address.

Remoted into the Pi (now its in the rack), and to turn off the WiFi opened the following file:

sudo nano /boot/firmware/config.txt

and added the following line to the end of the file:

dtoverlay=disable-wifi

Great. Now the Pi is running off the Cat6 wired connection only.

Job done.

Overall, a suprisingly straight forward setup. The exporting of the .unf backup file was probably the most confusing because it wasn't clear it was the configuration file for all sites on the network, not just the site that I was in the settings for. I had to figure out a number of twiddly things like disabling wifi, rebooting into console, starting the ssh server etc etc, but landed on a solution very quickly. If I hadn't played with Linux or my Raspi at home prior there's no way I could've done this, so my home hobbies are paying off. Happy days.