Windows Server 2019 – Implementing a new virtual server

How to Setup a Node.js Application Using PM2

Now we are ready to spin up our first virtual server! Similar to creating new virtual switches, the process for creating a new VM is fairly straightforward, but there are some steps along the way that might need some explanation if you haven’t been through this process before. We start in the same management interface from which we do everything in the Hyper-V world. Open up Hyper-V Manager and right-click on the name of your Hyper-V Server. Navigate to New | Virtual Machine… to launch the wizard:

The first screen where we need to make some decisions is Specify Name and Location. Create a name for your new VM, that is easy enough. But then you also have the chance to store your VM in a new location. If you set a good default location for your virtual machines during Hyper-V role installation, chances are that you won’t have to modify this field. But in my case, I chose the default options when I installed the role, and so it was going to place my VM somewhere in C:\ProgramData, and I didn’t like the look of that. So I selected this box, and chose a location that I like for my VM. You can see that I am using a dedicated disk to store my VMs, which generally a good practice. An even better practice in a larger network would be to utilize resilient disk space that was accessed through the network, such as a Storage Spaces Direct infrastructure:

Next, you have to decide whether you are creating a Generation 1 or Generation 2 VM. We don’t need to discuss this in very much detail, because explanations of the two are clearly stated on the page and in the following screenshot. If your VM is going to be running an older operating system, you should likely go with Generation 1 to ensure compatibility. Alternatively, if you are planning for a recent operating system to be installed on this new VM, selecting Generation 2 is probably in your best interests from a new features and security perspective:

Now, define how much memory you want to assign to this particular VM. Keep in mind that this is a setting that you can change in the future on this server, and so you don’t have to plan too hard for this. The amount of RAM you dedicate to this virtual machine will depend on how much RAM you have available in the Hyper-V host system, and on how much memory is required to run whatever roles and services you plan to install on this VM. You can specify any amount of memory in this field. For example, if I wanted roughly 2 GB, I could type in around 2,000 MB. However, what I find in the field is that most people still stick with the actual amount of MB, because that is what we have always done with hardware. So instead of rounding to 2,000, I am going to set my 2 GB VM to an actual 2 GB—or 2,048 MB.

Leaving the box unchecked for dynamic memory means that Hyper-V will dedicate an actual 2,048 MB of its physically-available RAM to this specific VM. Whether the VM is using 2,048 MB or 256 MB at any given time, the full 2,048 MB will be dedicated to the VM and will be unusable by the rest of the Hyper-V Server. If you select  Use Dynamic Memory for this virtual machine, the VM only takes away from the Hyper-V host what it is actually using. If you set it to 2,048 MB, but the VM is sitting idle and only consuming 256 MB, it will only tax Hyper-V with a 256 MB load:

Configure Networking is the next screen we are presented with, and here we are simply choosing which virtual switch our VM’s NIC gets plugged into. We do have the ability to add additional NICs to this VM later, but for now we get a standard single NIC during the creation of our new VM, and we just need to choose where it needs to be connected. For the time being, this new web server I am building will be connected to my Test Lab internal corporate network, so that I can build my web app and test it out, before introducing it into a real production network. If I drop down a list of available connections here, you will see that my original external virtual switch, as well as the two new private virtual switches that I created, are available to choose from:

A few details are also needed so that this new VM can have a hard drive. Most commonly, you will utilize the top option here so that the new VM gets a brand new hard drive. There are also options for using an existing virtual hard disk if you are booting from an existing file, or to attach a disk later if you aren’t prepared yet to make this decision. We are going to allow the wizard to generate a new virtual hard disk, and the default size is 127 GB. I can set this to whatever I want, but it is important to know that it does not consume the full 127 GB of space. The disk size will only be as big as what is actually being used on the disk, so only a fraction of that 127 GB will be used. I mention this to point out that the number you specify here is more of a maximum size, so make sure to plan your disks appropriately, specifying enough size so that you and your applications have the necessary room to grow:

Our last screen of options in the wizard allows us to define the specifics of the operating system our new VM is going to run on. Or rather, where that operating system will be installed from. We are going to purposefully leave this set to Install an operating system later, because that is the default option, and it will give us the chance to see what happens when you do not specify any settings on this screen:

Starting and connecting to the VM

We have now created a VM, which you can see inside the  Hyper-V Manager console. Starting the VM is as simple as right-clicking on it, and then selecting Start. After selecting the option to start the VM, right-click on it again and click on Connect…. This will open a console window from which you can watch the boot process of your new server:

Now that our new VM has been started, what can we expect to see inside the console window? A boot failure error, of course:

Installing the operating system

We get a boot failure message because we didn’t specify any operating system media during our wizard, and so Hyper-V has created our VM and our new hard disk, but just like when you build a new server out of fresh hardware, you need software to be installed onto that hard disk in order for it to do something. Luckily, installing an operating system onto a VM is even easier than installing it onto a physical server. Heading back into Hyper-V Manager console, right-click on the name of your new VM and go to Settings…

Inside the settings, you will see that this VM has a DVD Drive automatically listed in IDE Controller 1. If you click on DVD Drive, you can easily tell it to mount any ISO to that drive. Copy the ISO file of the operating system installer you wish to run onto the hard drive of your Hyper-V Server.

I typically place all of my ISOs inside a dedicated folder called ISOs, right alongside my VMs folder, and then Browse… to it from this screen. Connecting an ISO to your VM is the same as if you were plugging a physical installation DVD into a physical server:

After mounting the media, restart the VM and you will see that our operating system installer kicks off automatically:

Comments are closed.