This is an old revision of the document!
Hardware selection
My set-up choice has always been some cheap stuff I had laying around that would cost little and possibly also be low-power consumption. There are many possible choices like some kind of Raspberry Pi or similar solution, some small factor minipc (like an Atx form or even smaller) or an oldish laptop, maybe with a broken keyboard or monitor.
Whichever solution you end up with, the key point is having the right network interface and storage interface. You might want to prefer a solution with at least 8gb of ram andbone or better more USB3 (usb-c maybe) ports.
As network goes, I prefer to have a wired connection but to be honest a good WiFi on the 5GHz band could probably do as well. You might want two connections if you want to strictly separate home and external links, but in practice it is not required.
As storage goes, any of the above solutions will require some kind of external storage. While external SATA exist, in my experience even if you are luckynl enough to have a link on your server, you need to check that the chipset supports more than one drive attached to it or it will be totally useless
Considering that you will be consuming your media most probably over WiFi at best, external USB3 drives are the best solutions. I choose an USB3 JBOD enclosure (Just a Bunch Of Disks) because I will be using Linux software RAID implementation which in over 20 years never failed me and proved to be really resillient and efficient.
So I will assume you have at least two (or more) data drives in addition to your main Operating System disk (which should really be an SSD nowadays). You will need to setup the data disks as software RAID-1. there are also lots of so called external RAID solutions, but I prefer to trust Linux own implementation.
Gentoo Linux installation
Why Gentoo Linux? Because its lightweight, gives you full control on your server and can be much more secure than others bloated Linux distributions.
Installing Gentoo Linux is less difficult than you might think. The great Gentoo Handbook is very well written and also fairly easy to follow if you don't rush it. I assume you are capable of following it up until you van boot a text-only system.
A few notes to follow:
- don't bother with setting up the external data disks, you will do it later
- don't install any graphical user interface, you will not need it
- don't install SystemD as all commands are not for SystemD (or install it and adapt the commands)
Storage Setup
Storage
As for storage, i don't like low-cost commercial external RAID solutions and i dont want to spend for a high-end commercial RAID option, i prefer to leverage Linux built-in software raid tools which have worked like a charm for me in the last 15/20 years: rock solid, never lost data and quite fast. So i have purchased an external USB-3 hard-drive enclosure that support JBOD mode (just a Bunch Of Disks) to avoid being tied to some random RAID implementation, you will be using Linux mdraid inerface anyway. I have populated them with big enough hard drives (in fact, SSDs, the biggest i could afford by saving on the rest) that will become a RAID-1 array (now, i am over-simplyfiing here, you can go RAID-10, RAID-0+1, more than one RAID-1… even RAID-5 i guess). I go with RAID-1 because it is the simplest option that will preserve the media collection when (and it will!) one hard drive fail. I will add a speed consideration: you will be streaming your media over your home network, which more than often means WiFi. A good USB-3 SSD is more than capable to keep up any data transfer requirement for any streamed media today, even 4K, so there is not need to worry that external disks or USB-3 might be a bottleneck.
Let's assume we have /dev/sdb and /dev/sdc as your external disks. You need to partition the two disks and create one single Linux RAID partition on each of them, i will not detail here the specific commands as they are outside the scope of this guide.
Then it's time to create the raid array:
> mdadm –create /dev/md0 –level=1 –raid-devices=2 /dev/sdb1 /dev/sdc1
format it, and mount it as /data:
> mkfs.ext4 /dev/md0 > mkdir /data > mount /dev/md0 /data
/data will be the entry point for your media collection. You will also store all the temporary files and executables for the various software stack that we will be using.
Your raid needs to be automatically mounted at every boot, so you need to add a line like this to /etc/fstab:
/dev/md0 /data ext4 noatime 0 0
(the noatime option will reduce USB traffic and wear-and-tear. You might want a different filesystem maybe, do your own research)
You also want to automate linux raid startup:
> rc-update add mdraid boot
and, maybe, you need to ensure the md0 device doesnt change name upon reboot (it happened to me sometimes), so put this line into your /etc/mdadm.conf:
ARRAY /dev/md0 UUID=1758bcfa:67af3a42:d3df2d83:ecbb0728
where the UUID can be read by the output of the command:
> mdadm -detail /dev/md0
Using the UUID ensures that even if your USB ports get shuffled around (and it happens, specially if you unplug/replug wrong) your arrays will still boot fine.
You need to create the individual collections entry points like:
> mkdir /data/Films > mkdir /data/Tv > mkdir /data/Music > mkdir /data/Books > mkdir /data/daemons
The last one will not contain actual media, but it will be used to store the installation (or the cache folders) for the various softwares described in this page.
Network
Your network configuration will be very important, and your set-up will determine lots of stuff specially from reverse-proxy and accessibility. There are a lot of different configurations, i will not bother covering them all but only my specific use-case which is the most restrictive possible (that i can think of) for a home system that is also connected to the internet.
So i have a flat home-network (1 subnet) with one upstream connection (ISP provider) that offers a private IP address and zero port-forwarding capabilties at all. I will get a bit more in details:
Flat home network: subnet 192.168.0.0/24, media server is on 192.168.0.1, ISP gateway is on 192.168.0.254. All home devices are within this range. ISP provider with private IP (like over 4G or 5G, or some fiber ISPs too) that prevent you from using any DynDNS services No port forwarding at all, even if the ISP router do provide a "port forward" section, it does not work due to the private IP.
If you are, like me, in this situation you really don't have much choice. You can still obtain remote access if you have access to some kind of public IP like a VPS or if you can lease/access a server with a public/static address… Otherwise, there might be other solutions (like Plex) which i will not get into details here.