How to create a custom Windows image from SolusVM 2 Windows VPS?

Have more questions? Submit a request

Applicable to:

  • SolusVM 2

Question

How to create a custom Windows image from SolusVM 2 Windows VPS?

Answer

  1. Create a SolusVM 2 VPS with Windows image.

  2. Enter the VPS via RDP or VNC and perform the necessary changes inside VPS.

  3. Download Cloudbase-init:
    https://cloudbase.it/downloads/CloudbaseInitSetup_Stable_x64.msi
  4. Double-click the Cloudbase-Init installation package.
  5. Click Next.
  6. Select I accept the terms in the License Agreement and click Next.
  7. Retain the default path and click Next.
  8. In the Configuration options window, enter Administrator for Username, select COM1 for Serial port for logging, and ensure that Run Cloudbase-Init service as LocalSystem is not selected:
    ______.JPG
  9. Click Next.
  10. Click Install.
  11. In the Completed the Cloudbase-Init Setup Wizard window ensure that neither option is selected.
  12. Remove the Cloudbase registry key by opening the command line in Windows VPS and executing:

    # reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Cloudbase Solutions\Cloudbase-Init"

  13. Adjust the config file C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf so that it has the following content:

    Content of configuration file

    CONFIG_TEXT: [DEFAULT]
    # What user to create and in which group(s) to be put.
    username=Administrator
    groups=Administrators
    inject_user_password=true
    first_logon_behaviour=no
    # Which devices to inspect for a possible configuration drive (metadata).
    config_drive_raw_hhd=true
    config_drive_cdrom=true
    # Path to tar implementation from Ubuntu.
    bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
    mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin
    # Logging debugging level.
    verbose=true
    debug=true
    # Where to store logs.
    log_dir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log
    log_file=cloudbase-init.log
    default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN
    logging_serial_port_settings=
    # Enable MTU and NTP plugins.
    mtu_use_dhcp_config=true
    ntp_use_dhcp_config=true
    # Where are located the user supplied scripts for execution.
    local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts
    # Services that will be tested for loading until one of them succeeds.
    metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService
    # What plugins to execute.
    plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,
                  cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,
                  cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,
                  cloudbaseinit.plugins.common.userdata.UserDataPlugin,
                  cloudbaseinit.plugins.common.networkconfig.NetworkConfigPlugin,
                  cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin,
                  cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin
    # Miscellaneous.
    allow_reboot=false
    stop_service_on_exit=false

  14. Find the Network Adapter via Powershell:

    # Get-NetAdapter | Select-Object Name, InterfaceIndex

    The command will shows network adapter InterfaceIndex

  15. Remove IP and routes from network interfaces using PowerShell:

    # Remove-NetIPAddress -InterfaceIndex 3; Remove-NetRoute -InterfaceIndex 3

    SVM_WARN: After this step network in VPS will stop working - RDP connection will be lost.

  16. Shutdown the VPS.

  17. Get Hypervisor ID of VPS in SolusVM 2 > Virtual Servers

  18. Connect over SSH to Compute Resource where VPS exists.

  19. Find the VPS image path:

    # virsh domblklist ID | grep da | awk {'print $2'}

    where ID is the Hypervisor ID from step 8.

    For example:

    # virsh domblklist 1d908a4276bc26d017101a2a15381b1e | grep da | awk {'print $2'}
    /var/lib/libvirt/images/287/1d908a4276bc26d017101a2a15381b1e

  20. Сonvert the image into qcow2 format:

    # qemu-img convert -O qcow2 /var/lib/libvirt/images/287/1d908a4276bc26d017101a2a15381b1e /var/lib/libvirt/images/287/windows-2019-custom.qcow2

  21. Upload the image to the necessary hosting.

  22. Add image to SolusVM 2.

Articles in this section

Was this article helpful?
0 out of 0 found this helpful
Share

Comments

0 comments

Please sign in to leave a comment.