Applicable to:
- SolusVM 2
Question
How to create a custom Windows image from SolusVM 2 Windows VPS?
Answer
-
Create a SolusVM 2 VPS with Windows image.
-
Enter the VPS via RDP or VNC and perform the necessary changes inside VPS.
-
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"
-
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 fileCONFIG_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 - Find the Network Adapter via Powershell:
# Get-NetAdapter | Select-Object Name, InterfaceIndex
The command will shows network adapter InterfaceIndex
-
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.
-
Shutdown the VPS.
-
Get Hypervisor ID of VPS in SolusVM 2 > Virtual Servers
-
Connect over SSH to Compute Resource where VPS exists.
-
Find the VPS image path:
# virsh domblklist ID | grep da | awk {'print $2'}
where ID is the Hypervisor ID from step 6.
For example:
# virsh domblklist 1d908a4276bc26d017101a2a15381b1e | grep da | awk {'print $2'}
/var/lib/libvirt/images/287/1d908a4276bc26d017101a2a15381b1e -
С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
-
Upload the image to the necessary hosting.
Comments
0 commentsPlease sign in to leave a comment.