The Home Server
This is the server which will host all your private services. By private services i mean all the services that are meant to be accessed only from specific users and not by anybody from internet. These services will also need to be accessible from internet, since the same authorized users might need the services even if they are away from home.
Some examples can be:
- Calendar and contacts
- Photos
- Personal files (documents, etc)
- Notes and stuff like that
- Movies, TV shows, music…
- and so on…
This server only purpose is to provide those services to the authenticated users. For external access, when the users are not at home, it will be accomplished by using an external server as a reverse-gateway from internet to the home server.
Hardware
Since you are hosting at home, power consumption is a concern, both for peak requirement and overall energy cost. I have ditched any enterprise-grade specific hardware to keep total power consumption down. Bear in mind that this hardware will be powered up 24/7 all year long. This has some implications:
- during summer, it will overheat (installing a dedicated A/C is not taken into consideration)
- being on 24/7, energy cost will add up quickly
- a home grid could have low peak power available (3kWh is quite normal where i live)
- Power could be cut off for a bunch of reasons, without notice
The basic approach is to choose an old laptop and repurpose it to be a home server. This has some advantages:
- resilient to power black outs, it has an integrated battery.
- It's fairly low-power, which is good for something on 24/7
- It doesn't need an additional monitor+keyboard for console access
- It uses little space (specially compared to a PC with monitor&keyboard)
- Can fit vertically behind furniture, if you don't have a place for your self-hosted rig
- Come with WiFi out of the box
But it also have a lot of drawbacks:
- Limited storage space (usually one SDD or maybe one NVME and one SSD)
- Limited upgradeability CPU/RAM wise
- Louder fans under heavy load
- Usually one (or even none) internal network interface card
- An always plugged in battery will swallow over time and can be a fire hazard
There are ways to overcome these drawbacks like using USB external storage or adding more wired ethernet over USB. but it's not really worth it, specially because USB tend to have low reliability. Don't get me wrong, it can be done, and i have done it for over one year and half. But it's a pain and can lead to undesired issues.
So, after spending over one year with a laptop, i upgraded to a desktop PC, midrange and the main drawback is the loss of the conveninence of a battery, which can be mitigated with a nice UPS, one designed for home use. Afterall, all you need is that nick of time required to shut off your server then power goes away.
Which hardware depends on your needs, CPU and RAM? Get as much RAM as you can, as for the CPU, whatever entry level on the market will be more than adeguate for most services. I wouldn't waste money on a GPU unless you plan to to heavy AI stuff. I choose to max out the RAM to 48Gb and stay with an Intel I9 CPU, since that's more than capable to encode on the fly multiple AV1 video streams at 1080p.
Storage
While you could buy and deploy a NAS device, i will not cover this specific topic, rather i went trough the route of creating my own NAS leveraging the home server.
First of all you should define how much space you will need. This is not easy, but keep in mind you can always expand your storage later on when the need will arise. After you have defined your storage requirements, you should also consider your budget and your server “storage capacity” because you will definitely want RAID for storage, and that means extra drives to reach your target capacity.
I prefer SSDs to mechanical HDDs due to being so much more quiet, cooler and less power hungry. After i switched off my RADI1 made of 2x6Tb spinning 3.5“ disks and replaced with a RAID5 of 4x4Tb SSDs the difference was astounding and very noticeable also from a power consumption point of view.
You need RAID storage because hardware failure is a thing, and while RAID is no backup, at least it will let you minimize your downtime to basically a simple reboot. Which RAID level to choose from?
- RAID 0 - striping - make non sense in this scenario
- RAID 1 - mirroring - gives you the worst price-to-redoundancy ratio but it's pretty simple requiring only two disks
- RAID 5(or 6) - is the best choice since you will lose only 1/n disk space capacity while still retaining a valid recoverability in case of a single drive failure.
For speed concerns, it's better to have the operating system on an SSD or even better on an NVME.
External storage
If you choose a desktop or bigger server, then you should plan to host all the disks inside it. This will make for a much more tidy approach. If your case cannot host enough disks, or you are using a laptop, then external is the only way! In this case you need to buy an external device. PCs nowadays come with various USB connectors, so i will not talk about E-SATA or other connection types, but only USB. Those are also the less expensive, and E-SATA anyway always had seriour issues with multi-disks.
A few key concepts to follow for external drives:
- Prefer USB-C over USB-3
- Don't go anything less than USB-3 (USB-2 and USB-1 are just too slow)
- Get a multi-disk enclosure (2 disks minimum, or even better 4 disks)
- Get an externally powered enclosure, always
- Get a JBOD (Just a Bunch Of Disks), not a RAID enclosure
- Get a small UPS to keep those disks spinning on power loss
- Do not be cheap on this: get a reliable brand and model.
As i said above, USB-3 and USB-C are more than capable to sustain disk throughput and network loads, so USB will not be your bottleneck. but USB is quite unreliable, bot the protocol or bus itself, but the USB devices are usually low-quality. To ensure you have no issues over time, buy only reputable brands enclosures, do not save money on this item, and avoid RAID enclosures because i will be showing you how to leverage Linux built-in software raid, and JBOD enclosures have a better quality/price ratio.
Since laptops have limited USB ports, get only one big enclosure to fit all your drives, not many smaller ones. Prefer one which is externally powered, because they are more resilient, and buy a cheaper UPS power strip (anything in the lower end should fit) to keep the disks spinning then the occasional power outage will strike. In fact, having a laptop which will survive a blackout while the disks don't, it's not a good nor safe idea. (remember: UPS batteries will need to be replaced every year or two, do it)
RAID and Filesystem
ZFS is all the rage nowadays. It still has issues with Linux kernels and require not only careful approach, but also a lot of study. I prefer to stick with old consolidated Linux Software Raid and BtrFS.
The root filesystem can be left in classic Ext-4, or anything else you fancy.
Networking
You server will need to have more than one wired network interfaces (NIC = network interface card). Yes WiFi is all the rage today, but i don't recoment it for backbone critical services.
Your server will need to have:
- One NIC for the LAN: which will be connected to your home network
- One NIC for the WAN: which will be connected to internet, with the only intent of hosting a Wireguard tunnel to your external server. This is better to be dedicated, as this will de-couple your home gateway from your home server.
- One optional NIC to act as a DMZ toward the gateway, this allows for additional security if you don't want to use a dedicated WAN NIC on the server, and allows for seamless routing ot packets from inside and outside (more on this in the networking/routing pages).
If you cannot add enough NICs to your server via PCI-Express or similar bus, go for an USB-Ethernet adapter. In my experience, they are of very low quality and tend to bug out and die within one year of continuative usage. You have been warned.
USB Networking
If you need to go the USB networking route, this is where things get a bit complex because USB network cards are quite unreliable. Luckily Linux nowadays support most of existent USB network cards, but in my experience they tend to fail quite easily. Some suggestions:
- Buy a known brand, stick to 1Gbps cards
- Prefer USB-3 ro USB-C (seems more solid kernel drivers?)
- Avoid “multi-hubs-with-also-ethernet” and buy devices that does only one thing: networking
- Keep them cooled: heat will make them fail more than often