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:06] – willy | selfhost:home_server [2025/03/13 09:29] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== B) 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 [[selfhost: | ||
- | ====== The Simple Approach ====== | ||
- | This is how i started, and while it has it's limitations and possible issues, it's a perfectly valid self-hosted approach. | ||
- | The basic idea is to stay cheap, save on hardware using something you already have available | + | ===== Hardware ===== |
- | * Doesn' | + | |
+ | Since you are hosting at home, power consumption | ||
+ | * 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's fairly low-power, which is good for something on 24/7 | ||
* It doesn' | * It doesn' | ||
Line 14: | Line 30: | ||
* Come with WiFi out of the box | * Come with WiFi out of the box | ||
- | But it also have some drawbacks: | + | But it also have a lot of drawbacks: |
* Limited storage space (usually one SDD or maybe one NVME and one SSD) | * Limited storage space (usually one SDD or maybe one NVME and one SSD) | ||
* Limited upgradeability CPU/RAM wise | * Limited upgradeability CPU/RAM wise | ||
Line 21: | Line 37: | ||
* An always plugged in battery **will** swallow over time and can be a fire hazard | * An always plugged in battery **will** swallow over time and can be a fire hazard | ||
- | Most of the drawbacks can be overcome | + | There are ways to overcome |
+ | |||
+ | 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 | ||
- | As a final word, this **simpler** approach works very well and might be all you need. The limitations come from the **single point of failure** that having only one piece of hardware implies: when it goes down, for hardware failure, software bugs or just maintenance, | ||
===== Storage ===== | ===== Storage ===== | ||
- | 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 approach. | ||
- | Assuming your laptop cannot host two drives internally, | + | While you could buy and deploy a NAS device, i will not cover this specific topic, rather i went trough |
- | A few key concepts to follow: | + | 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, |
+ | |||
+ | 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 | ||
* 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 44: | 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. | ||
- | Going with something more solid than an old laptop | + | 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 | |
- | ===== Storage ===== | + | * One optional NIC to act as a DMZ toward |
- | Exactly as for the simple approach, you need RAID storage, | + | |
- | + | ||
- | + | ||
- | ===== Services ===== | + | |
- | Your laptop | + | |
- | + | ||
- | 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 | + | |
- | + | ||
- | Your server | + | |
- | + | ||
- | 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 | + | If you cannot add enough NICs to your server |
+ | ==== 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 " | ||
+ | * Keep them cooled: heat will make them fail more than often | ||