Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
selfhost:home_server [2025/02/18 11:37] – willy | selfhost:home_server [2025/03/13 09:29] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 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. | 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. | ||
Line 39: | Line 39: | ||
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. | 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. | + | 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' | + | 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' |
===== Storage ===== | ===== 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, | ||
- | ===== Services ===== | + | 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 ==== | ||
- | ===== Storage ===== | + | If you choose a desktop |
- | Let's focus. You need RAID storage, which means at very least two hard-drives (or SSDs) in RAID1. Better would be many devices on RAID6 or such, but let's stick with two RAID1 mirrors for the simple | + | |
- | + | ||
- | Assuming | + | |
- | A few key concepts to follow: | + | A few key concepts to follow |
* Prefer USB-C over USB-3 | * Prefer USB-C over USB-3 | ||
* Don't go anything less than USB-3 (USB-2 and USB-1 are just too slow) | * Don't go anything less than USB-3 (USB-2 and USB-1 are just too slow) | ||
- | * Get a multi-disk enclosure (2 disks, or even better 4 disks) | + | * Get a multi-disk enclosure (2 disks minimum, or even better 4 disks) |
* Get an externally powered enclosure, always | * Get an externally powered enclosure, always | ||
* Get a JBOD (Just a Bunch Of Disks), not a RAID enclosure | * Get a JBOD (Just a Bunch Of Disks), not a RAID enclosure | ||
Line 72: | Line 77: | ||
+ | ==== 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/ | ||
+ | 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. | ||
- | ===== Storage | + | ==== USB Networking |
- | Exactly as for the simple approach, you need RAID storage, which means at very least two hard-drives (or SSDs) in RAID1. Better would be many devices on RAID6 or such, but letìs stick with two RAID1 mirrors. If your server case has the capacity, plug in more disks and research on using ZFS or some advanced RAID techniques. I strongly suggest you use all SSDs, to save on energy consumption, | + | |
- | + | ||
- | + | ||
- | ===== Services ===== | + | |
- | Your laptop will be your server and your router. Which means that all your services will run on it as well as all your routing tables, fail-over between ISPs and such. | + | |
- | + | ||
- | Your server, or your laptop then, will need to be beefy enough to host any service you will need. In my experience, this is not a big issue. For low power laptops, a good video card might be useful for on-the-fly AV1 / x265 video decoding (if you want to host a media server like [[services: | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | ===== Services ===== | + | |
- | From the service hosting, you might go for a nice desktop PC or even a workstation. Usually both kinds should be able to host at least two disks, in addition to the main NVME slot, if not even four disks. This will ensure you don't need an external USB enclosure. Also adding more than one Ethernet NIC is usually pretty easy since you can plug in a PCI-Express ethernet card. There are even multi-NIC PCI-Express cards out there if you need more than two. | + | |
- | + | ||
- | Your server will need to be beefy enough to host any service you will need. In my experience, this is not a big issue. A good video card might be useful for on-the-fly AV1 / x265 video decoding (if you want to host a media server like [[services: | + | |
- | + | ||
- | In any case, with this advanced approach, you can always spin up an additional server should the first one be saturated at a certain point in the future. | + | |
- | + | ||
- | To be honest, having a dedicated firewall appliance means that your services server don't need multiple NICs, but of course YMMV and the opportunities are endless. | + | |
+ | 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 " | ||
+ | * Keep them cooled: heat will make them fail more than often | ||