User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
selfhost:home_server [2025/02/18 11:05] – created willyselfhost: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:external_server|external server]] as a reverse-gateway from internet to the home server.
  
  
-====== The Simple Approach ====== +===== Hardware =====
-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 cheapsave on hardware using something you already have available and adapting to it's limitationsMy choice has been an olderbut powerfullaptop which has quite a few advantages: +Since you are hosting at home, power consumption is a concernboth for peak requirement and overall energy cost. I have ditched any enterprise-grade specific hardware to keep total power consumption downBear in mind that this hardware will be powered up 24/7 all year long. This has some implications: 
-  * Doesn't need an UPS, it has an integrated battery.+  * during summerit will overheat (installing a dedicated A/C is not taken into consideration) 
 +  * being on 24/7energy 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 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't need an additional monitor+keyboard for console access   * It doesn't need an additional monitor+keyboard for console access
Line 15: 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 22: 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 with modern USB devicesToday'USB-C bandwidthbut even older USB 3.0 bandwidthis more than enough to cater for your home needsIn factif you use WiFieven the cheapest USB drive enclosure will be faster than that. If you have wired Ethernet at home, 1Gbps will still be faster than your mechanical drives, and USB will not be a bottleneckIf you have all SSD's over USB and perfectly wired 10Gbps Ethernet cables **and** plugswell, why cheap out on an older laptop then?+There are ways to overcome these drawbacks like using USB external storage or adding more wired ethernet over USB. but it'not really worth itspecially because USB tend to have low reliabilityDon't get me wrongit can be done, and i have done it for over one year and halfBut it's a pain and can lead to undesired issues. 
 + 
 +Soafter spending over one year with a laptopi 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. Afterallall you need is that nick of time required to shut off your server then power goes away.  
 + 
 +Which hardware depends on your needsCPU 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 servicesI wouldn't waste money on GPU unless you plan to to heavy AI stuff. I choose to max out the RAM to 48Gb and stay with an Intel I9 CPUsince that's more than capable to encode on the fly multiple AV1 video streams at 1080p.
  
-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, all of your home network will be offline. Your kids will be pestering you that their online-gaming is broken, their social media doesn't work, and your wife will be pissed off that the streamed movie doesn't work. 
  
 ===== 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, you need to buy an external device. Laptops nowadays only 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, so it's a win-win for the simple approach.+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 disksor 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:+A few key concepts to follow for external drives:
   * 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 45: 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 for hosting your services is also good idea for scalability, to avoid USB nuisances, and in general to benefit from better performances overallThe main drawback is the loss of the conveninence of a batterywhich can be mitigated with better UPS than the one you where already using (right?) for your RAID disks on the simple approach.+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 DMZ toward the gatewaythis 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 adapterIn 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 bit complex because USB network cards are quite unreliable. Luckily Linux nowadays support most of existent USB network cardsbut in my experience they tend to fail quite easily. Some suggestions: 
 +  * Buy 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
  
  
-===== Storage ===== 
-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, heat generation and noise. The price per gigabyte will be higher, tough.  
  

This website uses technical cookies only. No information is shared with anybody or used in any way but provide the website in your browser.

More information