Build Your Homelab: 10 – Our First Virtual Machine

Homelab 10 - Ubuntu on VM

Now that we have a Dynamic DNS set up to access our home lab from outside of our home network, we also looked at free SSL Certificates from Let’s Encrypt. But before we get to installing SSL certificates and getting our Homelab connections a bit more secure, we need to make a quick change to our setup. Should you feel it is not necessary to access your Homelab from outside of your home LAN Network, or that SSL is not required, feel free to skip this step. However, if your homelab is accessible from the open internet, it is HIGHLY recommended to (at least) get SSL installed. There are other securing techniques we will look at later, but SSL is the quickest and easiest.

The reason we need to make a change to our setup is due to snap not being as easy to get up and running in an LXC container, which is what we are currently using for NGINX. We used the Turnkey Linux LXC template to deploy NGINX but there are other options when using helper-scripts.com as per the page here: https://community-scripts.github.io/ProxmoxVE/scripts?id=nginxproxymanager Note that you can install the plugins for Certbot as per the instructions. However, after looking at the differences between an LXC container and a full-blown VM, one difference makes the world of sense in our setup: isolation. With a VM comes total isolation from the Host (in our case the Proxmox server host) and thus it makes it easier and more secure (in future at least) than using a LXC container. It also puts us in a bit more control over the setup, the running and config of the machine.


Step 1: Getting an operating system ISO

We are going to run the latest version of Ubuntu for our NGINX Virtual Machine. We can get the latest version from ubuntu.com and then navigating to the server download page to get to the download of the latest version at the time of writing: Ubuntu Server 24.04.02. Once the download completes, we need to upload it to our Proxmox server. Go to your Proxmox url, in our case https://192.168.1.2. In the left navigation pane, expand datacenter as well as the Proxmox node below it. Select the storage called local (Proxmox) which is the directory where all templateswill be stored. In the middle navigation pane, select ISO Images. In the main window, at the top, click Proxmox Upload Button.

Browse to the location of the downloaded Ubuntu ISO and select it so that upload can begin. Upload should be fairly quick as it now is running over your Wi-Fi network and not over your internet connection. Once upload completes, a window will appear that copies the ISO to the correct location, ready for use.


Step 2: Create a new VM

Now that we have the ISO on the Proxmox Host, we can create a new VM by clicking Create VM Button (If you are following along with the Build Your Homelab series, you might need to delete the NGINX LXC Template running on CT ID 101 if you want to use CT ID 101 for the NGINX VM).

Create the VM with the following values:

  • General
    In the general screen, fill in the CT ID field, this can be any number normally in the 100 – 999 range, and this is just an ID for the container. Fill in the hostname (NGINX) You will see there is no option for a password, like we have with a LXC container. We will get to the password.
  • OS
    In the OS screen, select the uploaded Ubuntu ISO we created in step 1. The rest of the options can stay on their default values
  • System
    In the System screen, the default values will suffice. We don’t need to change anything, but feel free if you know what the fields mean.
  • Disks
    Now we come to the location where the container will be installed. Select any disk of your choosing and disk size as well. The default 32GB of storage is more than enough but we are only going to run NGINX in this VM, so we can make it a lot less. In our example we made it 16GiB.
  • CPU
    This is just the maximum amount of CPU cores the VM has access to. This does not mean that those cores are onlyassigned to this container, it merely states that the container cannot access more than these. We opted for 1 as it should be more than enough for only running NGINX. If wee need more, we can assign more later. If you have access to more cores than we have (we only have 8 cores in total), you are also welcome to increase this amount as you see fit.
  • Memory
    Same as CPU, this states the maximum. We are using 1GB, if we see we need more we can always increase later. Again, if you have more than our example’s 16Gb, feel free to increase more.
  • Network
    Leave as is and just continue to the next screen.
  • DNS
    Again, leave as Use Host Settings, we might change this in a future container or VM, but seeing as we don’t even have our own DNS server up and running yet (At the time of writing), there is no need to change this.
  • Confirm
    Check that you are happy with all of the settings, and if you are, hit Proxmox - Finish. The VM will now be created, with the ISO loaded, but not yet installed.

Step 3: Install the VM

Now that the VM is created, the install disk (in our case the Ubuntu Server image) is mounted, but not installed yet. To start the installation process, select the VM in the left navigation pane. If the VM is not running, click Proxmox Start Buttonto start the VM. Once it is started, in the middle navigation pane, go to Proxmox Conosole Button. When the console opens, you will be greeted with the installation process. The first screen will have a prompt as to what we want to do, we want to select Try or Install Ubuntu Server.

The decompressing and process to start installation will now start. This process can take some time, so please be patient. While the decompression continues, the font size and screen layout will change a bit as the relevant display services are loaded in. Once everything is done, the install will commence with the prompt to select your language. Select the language and continue to the following screens:
Keyboard Configuration – select your keyboard config or use Identify Keyboard and continue
Choose the type of installation – We want to install Ubuntu server.
Network Configuration – Can stay as the default values. You are welcome to change values here if you know what they do.
Proxy Address – We are not using a proxy, so we are leaving this as is.
Ubuntu archive mirror configuration – Normally leave these values as is, the mirror location will be tested. Wait until the test completes and select Done.
Guided storage configuration – We already partitioned the disk with the creation of the VM, so just select Use an entire disk and continue
Storage Configuration – We are just leaving everything as default and continuing. A confirmation dialog will pop up informing you of a destructive action. Just continue.
Profile Configuration – Fill in your details, taking note of usernames only containing lowercase characters and root as well as admin cannot be used.
Upgrade to Ubuntu Pro – Not necessary for us. So we can Skip for now
SSH Configuration – We already SSH into the VM via Proxmox, so we are not going to install an SSH server. We might change this later.
Featured server snaps – We want to install NGINX, so we are not selecting any snaps

The actual install will now start. This might take a verylong time to complete, please be patient. (Ours took over 20 mins). Once completed, you can reboot the instance. Congratulations, you now have your first VM up and running in Proxmox. Stay tuned for our steps in getting NGINX up and running in this new VM.


Conclusion

We’ve successfully started transitioning our NGINX setup from an LXC container to a dedicated Ubuntu Server virtual machine within our Proxmox environment with the creation of a brand new Ubuntu server Virtual Machine. This move, driven by the need for enhanced isolation and control, lays a more robust foundation for securing our homelab. By opting for a VM, we’ve gained the flexibility and security necessary to effectively implement SSL certificates and explore further security measures. While the initial setup involved downloading and uploading an Ubuntu ISO, creating a new VM, and navigating the installation process, the resulting isolated environment is crucial for protecting our homelab from potential external threats. With our Ubuntu VM now running, we’re well-prepared to proceed with installing and configuring NGINX, enabling us to secure our connections with Let’s Encrypt SSL certificates. This transition marks a significant step towards a more secure and manageable homelab, and we look forward to sharing the next steps in our journey.