To have a smooth cloud experience with Windows it has to be customized for usage in a VPS.

If you do not have a Custom Windows Installation start creating a fresh new installation of the desired Windows version locally using VirtualBox.

  • Create the VM, install all the drivers you will need.
  • Power Off the local VM.
  • Compress (compact) virtual box disk image to save storage:
VBoxManage modifyhd --compact "disk.vdi"
  • Clone the virtual disk from the VirtualBox to an image file:
VBoxManage clonemedium --format RAW W10.vdi W10.img

VPS

  • Create a VM in Linode, Digital Ocean, or any other cloud provider with enough storage to contain the W10.img.
    • Minimum of 2 CPU, 4GB RAM, and 25 GB Disk.
    • Power Off the VM.

LINODE

The copy can be done resizing and creating another disk (Method 1) or Booting into Rescue Mode (Method 2).

Method 1 is necessary when Booting into Rescue Mode has no network connection.

  • On the Storage menu, Resize the main partition to 10000MB.
  • Create another Disk allocating all the available space.
  • On the Configuration tab click on Edit and associate the new disk as /dev/sdc.
  • Save and Power On.
  • Log in and log out to test the SSH service is running properly.
  • Issue the copy command:
dd if=W10.img | ssh [email protected] "dd of=/dev/sdc"
# the opposite copy would be: ssh [email protected] "dd if=/dev/sda " | dd of=W10.img
  • Power Off the VM.
  • On the Configuration tab click on Edit and set:
    • VM Mode: Full Virtualization
    • Select Kernel: Direct Disk
    • Block Device Assignment: /dev/sda to the new disk.
  • Delete all the other disks and Resize the new disk to max capacity.
  • Power On and use the LISH Console to get access to the VM.

Method 2 is very similar but does not have to resize the disk before copy.

  • Boot into Rescue Mode.
  • Open the LISH Console.
  • Check internet connectivity.
  • Download the image file from the VPS itself using:
wget -O- https://example.com/W10.gz | gunzip | dd of=/dev/sda
  • Or Start SSH:
service ssh start
  • Log in and out to test the SSH service is running properly.
  • Then copy the disk image:
dd if=W10.img | ssh [email protected] "dd of=/dev/sda"
  • Power Off the VM.
  • On the Configuration tab click on Edit and set:
    • VM Mode: Full Virtualization
    • Select Kernel: Direct Disk
    • Block Device Assignment: /dev/sda to the new disk and None to the others.
  • Power On and use the LISH Console to get access to the VM.


No matter the Method it will not get the IP address from DHCP, configure it manually for the Public and Private IPs if applicable.

For more than one IP click Advanced and after it is recommended to restart the VM.


Of course, RDP will be the way to connect to the new VM. Configure it following the step-by-step:

  • Start Menu > System (Control Panel) > Advanced System Settings > Remote > Remote Desktop > Allow Remote Connections to this Computer.
  • Windows Defender Firewall > Allow an App or Feature Through Windows Firewall > Change Settings > select Remote Desktop on both Public and Private networks.


At this point, create a Firewall in Linode to wrap up your Windows, allowing only RDP connections (TCP port 3389), and preferentially only from your own IP.


DIGITALOCEAN

Go to Recovery > Select Boot from Recovery ISO > Power OFF > Power ON.

On the Console, type 6 then Enter to get a shell.

Issue the command to download the image into the virtual disk. Note that the disk is at /dev/vda instead of /dev/sda.

wget -O- https://example.com/W10.gz | gunzip | dd of=/dev/vda

Once the download is finished go back to Recovery > Select Boot from Hard Drive > Power OFF > Power ON.

On the Console, change the network adapter to the configurations as shown on the footer and using the DNS server of your preference.

Follow the first speed test for a Droplet with 2vCPU and 2 GB of RAM over the Console.

Repeated the speed test over RDP with improved performance.


MIGRATION

The migration procedure can be used to transfer VM between cloud providers or to upload or download from local.

Check the connectivity between both VMs and test the SSH connection from one to another (preferentially using password and not SSH-Key).

You can push or pull the image. It depends on what you want or what you can easily connect over SSH.

Pushing from Local to Remote:

dd if=/dev/sda | gzip -1 - | ssh root@remote_ip dd of=/dev/sda

OR

dd if=image.gz | gzip -1 - | ssh root@remote_ip dd of=/dev/sda

Pulling from Remote to Local:

ssh user@remote_ip "dd if=/dev/sda | gzip -1 -" | dd of=/dev/sda

OR

ssh user@remote_ip "dd if=/dev/sda | gzip -1 -" | dd of=image.gz

One way to see if the transfer is happening is by monitoring the process on the remote VM.

Another way is adding one application in the middle of the pipe:

dd if=/dev/sda | gzip -1 - | pv | ssh user@remote_ip dd of=/dev/sda

WINDOWS SERVER

It is recommended that you really customize the image before pushing it to the cloud.

The main problem is on the login window that neither Linode nor Digital Ocean will offer a method to press Ctrl + Alt + Del.

In this case, you better create and enable a user to log via RDP and set manually the IP before pushing it to the cloud. The only exception is when you have a cloud infrastructure that you created VLANs and a gateway that will provide DHCP service to the Windows machine but will still need the user enabled to RDP anyway.

One Reply to “Deploying Windows on Linode and DigitalOcean”

Comments are closed.