Configuring a Windows Server install with Cloudbase Init
Grabbing the software
Links
- https://www.microsoft.com/en-us/evalcenter/download-windows-server-2019
- https://go.microsoft.com/fwlink/p/?LinkID=2195167&clcid=0x409&culture=en-us&country=US
- https://www.cloudbase.it/downloads/CloudbaseInitSetup_Stable_x64.msi
- https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
Sources
- https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers
- Proxmox Forum
Creating the VM
First, we need to make a VM to install the drivers on.
VM Options
General
- Pool: needed for permissions
OS
- Use CD/DVD: server.iso
- Guest OS: Windows
- Add additional drive: virtio-win.iso
System
- Machine: q35
- BIOS: OVMF (UEFI)
- SCSI: Virtio (single)
- Qemu Agent
Disks
- Make sure to set correct destination LV under Storage: (local-XXXX usually)
- Enable SSD if applicable
CPU
- Default x86-64-v2-AES is fine
Memory
- Set your intended amount as Memory
- Set minimum to 512 or 1024 depending on version
- Disable Ballooning if host does not require over-provisioning
Network
- Bridge: this will vary per lab enviornment
- VLAN Tag: leave blank if VLANs are not being used. You will either have your allowed VLANs in your permissions or an SDN will have the VLAN tags assigned and named already
- Model: Virtio
- Firewall disabled
Booting the VM
Go ahead and boot the VM to ensure everything works. If everything is good, we can continue to add hardware to the machine. When we install the drivers, we will reboot to ensure the hardware is added properly.
Adding hardware
- Serial port: 0
- Display: SPICE (QXL)
- CloudInit drive: select storage LV
Installing Windows
- Ensure everything is US
- When prompted for install version
- Standard Evaluation is "Server Core" (CLI only)
- Standard Evaluation (Desktop Experience) is GUI
- Continue to Custom install
- Load Driver
- Pick the version appropriate for your server (VirtIO... 2kXX)
- Clicking Next on the drive page will auto fill the first drive available
Post install
Desktop Experience (GUI)
Initial setup
Upon first boot, you will be asked to set a password. Something like Password1 is strong enough. In order to unlock the lock screen, you will need to open the NoVNC menu on the left and click the A icon to enable CTRL and ALT then click the DEL key on your physical keyboard. Remember to unlatch them when done.
Setting up drivers
Go ahead and open file explorer and find the DVD called virtio-win. Run virtio-win-gt-x64 completely and install everything. Next run virtio-win-guest-tools. You should now have internet and SPICE support. In order to enable SPICE, you will want to restart the VM. Do not restart from Windows (this will ignore the VM hardware changes), instead do a shutdown command then restart the VM manually. You should see the orange options in the Hardware tab update.
SPICE
At this point, I would recommend relaunching the VM Console using SPICE for clipboard usage . If you do not have this ability, download virt-viewer which will be the second program listed on the virt-manager website. On Linux, it may be installed under Remote Viewer in which case you may have an issue with Mime Types (which program to open .vv files with) if it still does not open. SPICE also has some issues with proxies like CloudFlare Tunnels.
Cloudbase-init
Now we are going to take that URL from earlier and paste it into this command in PowerShell.
Invoke-WebRequest -UseBasicParsing [https://www.cloudbase.it/downloads/CloudbaseInitSetup_Stable_x64.msi](https://www.cloudbase.it/downloads/CloudbaseInitSetup_Stable_x64.msi) -OutFile cloudbaseinit.msi
C:\Users\Administrator
When running the installer, you can select a new username, be sure to do this if you are planning a theme for your competition or box so you do not have to script it later. Also select the COM1 port to link it to the Serial port for debugging purposes. Check run as LocalSystem as well. Now would be a good time to run a full backup of the VM (should be about 5gb). Once cloudbase-init runs, it should prompt you to run sysprep. Check both boxes for sysprep and shutting down. It should open sysprep then immediately shut down the VM once done. Do not run the VM again. It is imperative you do not open the VM as this will turn the sysprep "image" back into a real machine.
Making the template
Click "More" in the top right corner of the Proxmox VM control panel. Click "Convert to template." This will make the VM no longer accessible. Now you will have the ability to create clones which can be initialized quickly with cloudinit