How I Built a Homelab on the Budget
In my previous article, I discussed what is a Homelab and why you should (or should not) have one for yourself.
Now, can anyone who wants or need, have a homelab? It depends on several things but money or resources can be worked around. In this article, I will explain how I have managed to have my own Homelab without investing a fortune in it. As a matter of fact, it costed me less than US $1,000 and it works good enough to manage my home's infrastructure requirements.
That being said, it is important to mention as a disclaimer: this article doesn't describe the best way to do things. It just describes how I manage to make it work even knowing there are some issues and risks with it but for now, I am fine to live with these.
First of all: the hardware
Setting up a homelab requires a computer that you can basically use to only host continuously. An old (but moderated powerful) laptop can do the job or if you have some money that you can use, you can purchase the parts and build your own computer.
If you have a little extra cash, you can probably even purchase a repurposed small server that any IT company has got ridden of due to its age. Those servers can still serve a good purpose for a project like this, although it might get off the concept of “on a budget”.
You can also use Raspberry Pi like devices.
The most important part about the main server, is: try to get a motherboard and a CPU which can handle virtualization, specially that have IO passthrough capacity. For Intel, make sure the processor hast VT-x capacity, for AMD it should have AMD-v capacity. Without this, you will not be able to do much.
If you don't plan to invest in a separated GPU like and NVIDIA or AMD graphics card, then try to get a CPU which has an integrated GPU at least.
Then, you require having some disk space for this. The size of the disk depends on what you are going to use it for. In my case, I wanted to have a media player, a gaming PC, a Firewall/DNS server and probably a very small DVR console, so I bought a 2 TB hard disk. This is the part where you can have budget issues. If money is not an issue, you want to have as many space as you want and double it so you can work with RAID. Again, in my case I have to settle with a single 2 TB (not even SSD) hard disk, period.
I had a couple of 1 TB USB hard disks laying there, they were more than 10 years old but with very small usage (after the cloud, I honestly avoid storing too many things locally). These would be very slow to be used for processing or VMs but for backup purposes they would do.
Then you want to focus on RAM. The more, the better. In my case, I only could afford 8 GB.
Then, assuming you want to have this integrated into your own home and interact with the rest of the network and devices, you probably will need at least a small router or network switch. If you want to set up a small router or DNS small server inside your place, then you need to have at least a second NIC card. I had a USB NIC card which I used as my secondary one to be able to run a virtualized firewall/routing solution.
The software: Hypervisor
You need virtualization and for that you need a hypervisor. Hypervisor is categorized into Type 1 and Type 2. Read our article to know more on this.
To summarize: if you go with a Type-1 hypervisor, you have to be more technical but you have more control and therefore you can use GPU and some other resources on your virtual machines.
With a Type-2 hypervisor, it gets easier to handle as you have less control of things, but you can't perform some things like passing GPU power to your VMs. If you want to have a VM to work and edit videos or play games, then you will not be able to do that with Type 2. If that is not the purpose, then you probably will suffice with a Type-2.
I used to have Virtualbox, and used the main host machine as my own media server. This worked well. The main machine was capable of video transcoding. However, when I wanted to try different media servers in order to experiment, I started to struggle because I had to affect my main server for an experiment that could go wrong.
This made me migrate to a Type-1 hypervisor and start over. I moved to Proxmox as my hypervisor, as I love Open Source. I found VMWare ESXI too hard to implement as I don't even have a Windows machine at home, so I couldn't even re-work the ISO images to allow me to inject the correct hardware drivers to even install it.
Homelab is up, now what?
I have set it up, and I started creating the initial set of things based on what I wanted to use. I wanted a media server, but, I am limited on the power (Intel i5 with internal GPU) and I want to host several things. So, I had to decide (and research) how to make it work for me.
If I wanted a VM that hosted my Plex or Jellyfin server and was capable of transcoding, I had to pass the GPU to this media server. That would make me not be able to use it for a gaming PC, at least not simultaneously. You can only pass GPU to one single VM at a time.
This was a problem because I might want to play at the same time my kid or my wife wants to watch a movie or a TV show. So I worked around it.
I set up a basic NFS server using Debian (for its lightness) where I would host my files. I would simply process all video files I own, to be in a universal format that most devices would not need to transcode from: MP4.
This would require me to be on top of the files and make sure that I always convert them prior to index them into my media server. You can easily automate using cron and handbrake-cli. I didn't even have to write the cron script, I searched for one of the many available on GitHub.
With my files centralized in a NFS server, I no longer needed a VM. I only used a Container to run my media server and the amount of resources used were as minimal as possible. I just mapped the NFS server as a folder within my container!
Then, for the Firewall, I setup pFSense, again, to have as much resources optimal shared, I used a container for it.
Next, for gaming machine I just set it up a Windows VM. The reason is that I wanted to set up a Steam and also be able to play games from GOG.com, both have a lot more support for Windows than any other system. Hence, I set up a VM for this and set it up with GPU passthrough, so that virtual machine would get the GPU power my Intel i5 had within.
Known issues and risks assumed
As I mentioned at the beginning of this article, I didn't do things the optimal or the best way necessarily. I just adapted to what my budget was and worked around problems and issues from there.
Having one single hard disk, puts me in danger if something happens to the disk (and hard disks are like humans: they are born and start dying from that specific moment). I would lose a lot of things if I don't backup. I don't backup all VMs as I don't have enough disk space to store everything.
Also, having only one disk, makes read speed to not be so fast. Using a RAID configuration would make the disk read optimal and therefore faster. In addition to that, I have a lot of IO delay at some points. This is because several VMs and Containers are accessing the same NFS server. If I am not careful to set up automated tasks or crons at different times to avoid overlapping, I could end with data corruption.
My GPU is just Intel's integrated one, it's just decent for very basic things, so it would be ideal to have a real GPU, even an old NVIDIA. Still, not only money is a problem, I am using a small mini-ITX case, so I would have to look for a small model that can fit.
Lastly, using my hardware in these conditions, specially hard disk, reduces its life expectancy, but as I don't plan to have lots of usage but only moderate home usage I think for now it's worth to keep this architecture.