Raspberry Pi home server

2023-12-24

When we lived in London we had an old HP Compaq Elite 8300 desktop tower that we used as a home server. The server ran Ubuntu minimal server 18.04. I used the server to back up important documents, and used Samba to connect our laptops to access music, movies etc.

The server was very convenient for me, but it was a bit awkward for others to connect to if they weren’t familiar with network shares or SSH. Additionally, the server was quite power hungry. I set it up to wake on LAN, but this meant I was the only one in the house who could turn it on.

In our new flat I aimed to upgrade the home server setup to reduce power consumption, increase storage capacity, and improve accessibility for less techy people.

Hardware

The RPi is connected to the router via a short ethernet cable, and to the SSD via USB. The RPi boots from a 64 GB Micro SD.

I used zipties to mount the three bits of hardware onto a section from a plastic crate, the kind used to hold fruits and vegetables. I then hung the “rack” under a gateleg table using screw-in hooks.

To play music in the living room the RPi is connected to a Yamaha CRX-M170 micro Hi-Fi system via a 3.5 mm to phono cable. Unfortunately, the 3.5 mm jack in the RPi 4 is terrible. The sound comes through very tinny with lots of interference. To get decent audio quality I had to buy an IQaudIO DAC Pro hat for the RPi. The DAC Pro connects via the GPIO pins to the RPi.

Server setup mounted to plastic tray 'rack'.

Software

We don’t have internet in our new flat, instead we just use our mobile phones. The GL-A1300 router has a USB port that can connect an Android phone to use it for USB tethering. On the rare occasion that we need to connect the home LAN network to the internet we can tether a phone, but mostly we can remain offline.

The RPi runs Raspberry Pi OS Lite version 2023-12-05. This version of the OS doesn’t include a desktop environment and works well as a server.

I installed Jellyfin to serve video and audio from the RPi to all our devices. Jellyfin has an app for Android that works quite well, and a web app that is accessible over the local network that works well on laptops. Jellyfin can cast directly to a TV using DLNA.

I installed Mopidy to play audio on the Hi-Fi from the RPi. I installed the Mopidy MPD extension , which allows MPD clients like M.A.L.P. to connect to the Mopidy instance. I installed the Mopidy MusicBox extension to provide a web client music player. I ran into a problem where Raspberry Pi OS wouldn’t let me install any python packages via pip, including the Mopidy Jellyfin extension. All I had to do to fix the issue was to delete this file:

sudo rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED

It took me some time to figure out how to get Mopidy and Jellyfin to both access .m3u8 playlists. Playlists are stored in Music/Playlists/, where Music/ is the directory where all other music is stored. I don’t use the Mopidy Jellyfin extension , because I can’t get it to play well with playlists. Playlists show up in both Jellyfin and Mopidy, but I have to create the playlists manually in the terminal. Mopidy doesn’t have the ability to create playlists, and Jellyfin stores playlists as .xml files which Mopidy can’t read. Yet, Jellyfin will happily add songs to an existing .m3u8 playlist; weird. It seems others have had similar problems judging by various Github issues .

I installed Samba to make it easier for others to add media from their devices, and I installed qBittorrent (-nox variant with no X-server) to download media directly onto the server when it’s connected to the internet.

To create backups I have an additional 1TB SSD which is synced using rsync once a week. I have a third SSD that is synced every month, which I keep at work.