Introduction
I’ve recently been gripped by the fascinating world of Linux. Initially, my curiosity led me like most of us, to dual-boot Windows with the Ubuntu flavour of the month, hoping to integrate Linux into my everyday computing. However, these experiments, undertaken repeatedly throughout highschool and then throughout life in gereral were short-lived. Constantly, I found myself reverting to Windows, never really understanding the reasons why people would chose to use an operating system with so little ‘polish’. That coupled with the inconvenience of switching between operating systems, with two seperate file systems, and changes which seemingly for no reason would cause my Ubuntu installation to get stuck on the obscure GRUB screen, soon outweighed my enthusiasm. Eventually, the Linux partition would be removed, leading me back to the relative safety of windows 7.
Enter Virtualbox, a simple way for me to run a linux distribution inside of my windows computer, allowing me to not only play around with the linux desktop environments and programs but also, easily share files between the OSes. This was good and well but as many who have used Virtualbox before are well aware, the performance is terrible, even if you don’t want a desktop environment with all those fancy graphics, the machines tend to be almost unusably slow. This is partly due to the fact virtualbox is having to ask your machine to do a bunch of task all at once, going between the VM and host operating system repeatedly, introducing latency and reducing the efficiency of your hardware. Who wants all those cpu cycle taken up by virtualbox asking windows ‘can you do this for my vm?’
So is there a way to have this virtualbox like experience but without the latency or efficiency loss? can I get VM’s which respond as if they were real machines? The answer: yes.
Types of Hypervisors
So what is virtualbox anyway? or more how do virtual machines work? Well VirtualBox, like many other similar solutions, is a piece of software that allows you to run virtual machines on a host machine. At the core of these virtualization solutions is a component called a “hypervisor”.
A hypervisor, also known as a Virtual Machine Monitor (VMM), is a layer of software that enables the creation, management, and execution of virtual machines (VMs) on a host machine. It acts as the arbitrator between the VMs and the physical hardware, ensuring that each VM has access to the necessary resources such as CPU, memory, storage, and networking capabilities.
There are two main types of hypervisors, which differ in their architecture and how they interact with the host machine and its hardware:
Type 2 Hypervisors: These are installed on top of an existing operating system, just like any other application. VirtualBox falls into this category, along with others like VMware Workstation and Parallels. Because they have to go through the host operating system to access hardware resources, they tend to be less efficient than Type 1 hypervisors. However, they are easier to set up and use, especially for individual users or small-scale applications.
Type 1 Hypervisors: Also known as “bare-metal hypervisors,” these are installed directly on the host’s hardware. They have direct access to the physical resources, bypassing any underlying operating system. This direct access enables them to offer higher performance and efficiency, making them ideal for enterprise environments where resource optimization is crucial. Examples include VMware ESXi, Microsoft Hyper-V, and Xen.
Both types of hypervisors manage the execution of VMs by virtualizing the hardware components. This means they create virtual versions of hardware devices, allowing multiple VMs to run simultaneously on a single host machine. Each VM operates in an isolated environment, believing it has its own set of hardware resources, while in reality, these resources are being shared and managed by the hypervisor.
But Windows
If you’re like me you’d probably spin up a linux distro once in a while to test something out, maybe looking for a specific linux distro that you’d be able to transition to from the Mac or Windows install your computer came with.
But what if you wanted to go a step further and rather than moving from a windows install to arch linux you could move from one windows install to half a dozen windows installs to play with enterprise management, a mac os vm for xcode and ios development, a couple linux servers, and why not some kind of gaming vm, all on the one machine?
This is one of the reason I moved from traditional single operating system builds to having all my computers running type 2 hypervisors which allow me not only to run multiple vm’s with full hardware functionality, to move these virtual machines over a network to other computers around my house or even over a vpn to a remote site, to backup an entire OS and then redeploy it when needed, and to automatically spin up a server when it’s needed using only a few text files.
If you’re asking yourself “Why?” then maybe there’s somewhere else you’d rather be however if these things sound kind of interesting then my hope is that this might be a good jumping off point for your homelab journey!
Lets get back to some of the kkey players in Type 2 Hypervisors:
- ESXi: Think of this as the Rolls Royce; it’s fancy but costly.
- Hyper-V Server: Microsoft’s offering. Integrates well with Windows but sort of treats Linux like a second-class citizen.
- RHEV: Red Hat’s enterprise solution. Open-source, of course.
- Xen: The O.G. of open-source hypervisors.
- Proxmox: My personal favorite. Open-source, and it has both VM and LXC container support. A bit of a Swiss army knife.
So you’ve probably heard of some of these names, or if you haven’t you’re having a google of each and trying to decide what you want to try out, and obviously like me, you want to try all of them.
And while you can actually install most of these in a type 2 hypervisor, known as nested virtualisation, to get a feel for the UI and to just have a little bit of a play around it’s definitely advised that you want to have these baremetal hypervisors running on baremetal. That means either dual booting, or find a spare drive to boot from and get toying around.
Why I Use Proxmox
For me I really wanted to learn a lot more about linux operating systems, and I figured going with a flexible opensource hypervisor would mean i could do stupid things that weren’t best practice and then learn why, rather than just being outright prevented. It’s also based on Debian which means it’s kind of familiar to those who’ve used an OS, not to mention the incredible community support and documentation means that you can typically find a solution to any problem that might come up.
You get advanced features which initially might not be super important like clustering and distributed filesystems but it’s there if you ever feel like testing it out. There’s an incredibly powerful backup system developed along side the Proxmox Virtual Environment, Plus, it’s free if you can live without the enterprise support.
So without further rambling, let’s dive in. If you’ve been holding off installing a type 1 hypervisor I can’t help but encourage you to give it a go.
Installing Proxmox
Firstly you’re going to need some hardware to install it on, any old machine will do, but the more cpu cores and ram, the better. Ohh and the machine should be on a network so that you can manage it. Typically the to be proxmox server will be administered using a web interface which is accessible on through a browser on any locally networked machine.
You’ll also need to jump in to the machines bios and enable either Intel Virtualization Technology (VT-x) or AMD Virtualization (AMD-V), depending on your platform. While you’re there, look out for Intel Virtualization Technology for Directed I/O (VT-d) or AMD I/O Virtualization Technology (AMD-Vi), these aren’t strictly necessary to get going but they’re going to help down the line when we start doing things like passing graphics cards to a VM for increased performance.
You’ll also want to set your boot order to have usb booting before your harddrive so we can launch the proxmox installer.
Finally download the proxmox installer iso and write it to a usb stick with something like rufus or if you don’t know about it, check out Ventoy it’s incredibly useful.
: A screenshot showing a Ventoy boot screen is installed and configured.
Heads up: If you’re having trouble getting the proxmox installer to start, note that Modern BIOS settings can mess with you. Turn off things like fast boot or secure boot.
The proxmox installer is pretty straight forward, accept a license agreement, choose a location to install proxmox to (this will wipe everything on that drive so say good bye to windows if you’ve got it running off of that drive), choose a timezone, create a root password, install.. it should all be smooth sailing.
Then once the install is complete, rip out that ventoy usb and enjoy the beauty that is the proxmox terminal.. you haven’t done anything wrong, proxmox doesn’t have a local gui, but it will tell you the address that you can access it’s web interface.
All you need to do is open a web browser and type in
https://{the address it tells you}:8006/
The https and :8006 are important so don’t skip them, also get excited for your browser to try stopping you visiting that web address. Because we’re using https and the browser doesn’t recognize proxmox’s secure certificate, it likes to let you know that maybe the site isn’t so secure, but we know proxmox is secure because we’ve just made that server ourselves, so lets click on advanced and then proceed to the site.
Finally we’re here, at the web ui. isn’t it just a thing of beauty, and empty as the eye can see. If you haven’t already logged in you can do so using the user ‘root’ and the password you created when setting up the installation.
Just a side note, we’re going to use the root user to do most things throughout these guides but it really is not a secure way to do things, ideally you’d set up a user to complete different actions, like administering VMs or LXCs, or managing nodes and clusters, or maybe one for managing backups. But we’re keeping things straight forward.
Creating A VM
We’re finally here, proxmox is running, you’ve poked around the web ui and seen some things which look enticing but you gotta hold off! because we’re creating a virtual machine god damn it! it’s the thing we came here to do.
Take note that there are advanced options which can be very useful but we’ll ignore them for now, and perhaps come back to them at a later date.
First: Give proxmox an iso
Let’s first go over to the left and under the proxmox logo change to folder view (or what ever view you like, folder is just my preference). Then we’re gonna select the “local (your-server-name)” this is where proxmox keeps some of the more administrative stuff like installation ISOs, lxc templates, and backups (for now).
Then you can either choose to download one from the internet, Ubuntu Server is what I’d reccomend for the moment, or you can upload one from your computer.
Step 2: Press the Button
Now lets press that button that’s been staring at us for far too long.. “Create VM”
General
: Proxmox webui
For the moment we’ve only got the one node, but that’ll change as we get more and more addicted to this virtualisation thing. So we set a VM ID, these values are more organisational than anything as we can change them at a later date. And finally give that beast a name
OS
: Proxmox webui
Then we choose the ISO we’ve uploaded, and if the Guest OS Type and Version wasn’t picked automatically you’re going to need to change it to your needs.
System
: Proxmox webui
Next up we choose some system settings, leave the graphics card alone for now, it’s unlikely that our default is going to cause any issues. Then it’s worth changing the Machine to q35, a more modern chipset which supports a wider range of modern OS operations, i440fx is used more for when you’re trying to create (or clone) and older operating system, like a pentium 2.
Selecting a OVMF bios is a good starting point and then falling back to SeaBios if you can’t the OS installed. Make sure you choose an EFI-Storage location as this is where your bootloader is going to look for which operating system to start.
Also important to note that unchecking pre-enroll keys will help you with avoid a bunch of OS problems when it comes to failing to boot after installing, it’s to do with using Secure Boot with a vm, something which is out of scope at the moment.
As for SCSI Controller let’s leave it as VirtIO SCSI single, that’s a nice performant virtual SCSI controller that we will be able to use with most operating systems without additional driver (we will have to add drivers for it when installing windows).
For now just take note of that Qemu Agent checkbox but leave it unticked.
For Windows 11 you’ll want to check the Add TPM module.
Disks
: Proxmox webui
Lets leave everything the way it is, we’ll use the scsi controller we selected earlier, the disk size of 32gb should be enough for our test vm but feel free to increase it if you’re feeling generous.
Leaving the cache as default is the best bet it’ll be a bit slower than directly using the drive but it will save you from having a corrupt guest os when you’ve got to force your server to shutdown due to some unforseen cat hair related house fire.
Discard is useful if you’re installing a VM on to an ssd, effectively working like TRIM, telling proxmox that blocks of data are no longer in use, freeing up space and evening out wear. While IOThreads will request that promox starts different process threads specifically for handling I/O, speeding up certain kinds of workloads.
CPU
Lets keep the sockets to one and the cores to the total number of cpu cores we have, were we to set the sockets to 2 then we’d have 2x times our maxium. Sockets might seem like a strange thing when we’ve only got a single processor but they can come in handy when working with obscure operating systems like MacOS where having 6 cores will cause massive instability if you can even get the system to boot, but having 3 sockets with two cores is more than okay!
Now this might seem like we’re giving a lot of our resources to one of our VM’s especially because we could be running dozens of VMs at once, but now’s the time to talk about overprovisioning.
Overprovisioning is the process of allocating more virtualized CPUs (vCPUs) or memory to virtual machines than the physical host has available. The logic behind this is that not all VMs will need to use their allocated resources at the same time, thus allowing for greater resource utilization. This can be especially useful for VMs that have sporadic resource demands.
For example, if you have a server with 8 cores, you might run 4 VMs each allocated 4 vCPUs. While this adds up to 16 vCPUs total, as long as they don’t all try to max out their CPU usage at the same time, everything runs smoothly.
However, there are risks with overprovisioning. If too many VMs try to claim resources at the same time, it can cause performance degradation. This is why monitoring is key when you’re doing this.
Let’s close out this out by selecting a processor type, while the default is fine for most purposes, it can be handy to use either a specific type of processor if you’re aiming at virtualising a very specific system, or by using the host cpu argument to allow the VM to utilise all the features your specific cpu has to offer.
Memory
Memory is really dependent on the service you’re running, in using traditional computers where we have a single active user, often times it’s our processor that we’re most concerned about when choosing hardware but in the realm of servers, it’s ram, and it’s lots of it. We can still use our system of overprovisioning ram here but you’re going to find your server typically sits at only a few percent of processor usage 99% of the time while you are using ridiculous amounts of ram.
But for our first VM we’ll set it to a sensible 4096, 4Gb, enough for a tab or two of chrome.. maybe.
Network
We’re going to sick with the default bridge here, the bridge is basically a virtual network adaptor which is linked to the hardware device you use for networking, that probably means the ethernet interface you’re supplying that good internet juice through.
There are various NIC models you can choose for your VM. If unsure, the virtio model (short for virtual I/O) is a good default choice. It is a paravirtualized network driver optimized for performance in virtual machines. If you’re deploying a Windows VM, remember that you might need to install additional drivers for the virtio network adapter to be recognized.
If you want to limit the amount of bandwidth this VM can use, you can set a rate limit. For now, let’s leave this field blank.
If you’re using VLANs in your network, you can specify a VLAN tag for this VM. We won’t dive deep into VLANs here, but they can be used to segment network traffic into different virtual networks on the same physical network, that means you can have one cable broken in to more than one network! Let’s skip this for now though.
Proxmox will automatically generate a MAC address for the network adapter. Unless you have a specific reason to set a custom MAC, it’s best to leave the automatically generated one.
You can leave the firewall setting alone, whether or not it’s on there are no rules configured for proxmox so it wont do us any harm either way.
Confirm
We’re at the end of our VM setup now, that might have taken a while but now you’ve got a decent overview of what different settings do and you’ll be able to break things and hopefully have a little bit of an idea of why it broke.
In the future you’ll be running through those setups at great speed, so fast it’ll be as if a computer is doing it for you ;).
But for now lets finish and start our vm!
…Uneventful right?
Interacting with a VM
I think the Vm is running? It’s got a green play icon, but like, how do I do the VM?
If you haven’t already found it, go to the console window, and BAM, there it is, hopefully, some kind of graphical display getting ready to talk you through installing an OS.
And that’s kinda it The VM is running, now you can install the operating system on the machine!
Typically you’ll only ever use the vm through the console either initially setting up the machine or when all hell breaks loose. Otherwise you’re going to be using something like SSH, or perhaps a more performant remote desktop solution like RDP or Moonlight/Parsec.
Windows tips
If you’re using a windows install lets do some quick tricks to help you out.
Shut down the VM you’ve just created, and go to the ‘hardware’ section below ‘console’. Were going to press add and select CD/DVD drive.
Then we’re going to go back to the ‘local’ storage area where we downloaded the iso and we’re going to download VirtIO Drivers). These will allow windows to see our virtio scsi controller (the thing that’s virtually managing our guest’s hard drive) and also our VirtIO nic for a bit of network action.
Once you’ve got that iso downloaded, head back to the hardware section of the VM and double click that second disk drive you just created, select the virtio-win iso, and press okay.
Placeholder: hardware with two disk drives
This time when we get to the disks section of installing windows there should be an option to select additional drivers, select the windows version you’re running and voilà, the harddrive and network drivers will be installed and working.
But don’t throw out that virtio iso just yet, once you’ve got windows booted, open the virtio disk and install the qemu-guest-agent.
Finally lets head in to the options of VM and change QEMU Guest Agent to Enabled, now we can get a more accurate view of what our VM is doing and use a more graceful shutdown method.
Now What!?
Congratulations, you’ve now successfully set up a Proxmox server and have a basic understanding of how to create and configure a virtual machine! From here, there’s a world of possibilities. You can start playing around with different OS installations, clone your VMs, set up backups, and more.
Remember that while virtualization is a powerful tool, it’s essential to monitor and manage your resources carefully. Overprovisioning can be useful, but be cautious and regularly check the health and performance of your Proxmox server.
There are many more advanced features and optimizations to explore within Proxmox, such as clustering, high availability, containerization with LXC, and more. But, you now have a solid foundation to build upon.