Prepare an ISO image for use with the cloud platform
If you uploaded to the image repository an ISO image with an operating system distribution, we recommend making it fully compatible with the Selectel Cloud Platform. From a compatible image, you can create cloud servers that will have the same functionality as servers created from pre-built images.
Prepare a Windows image
- Prepare the ISO image locally.
- Upload the ISO image to the image repository.
- Modify Windows image properties.
1. Prepare the ISO image locally
-
On your local computer, extract the archive with the ISO image to a separate directory using an archiver, such as
7-zip,WinRAR,tar. -
Download the VirtIO drivers as an ISO image from the Fedora People repository.
-
Create a Drivers directory.
-
Extract the ISO image with VirtIO drivers into the Drivers directory using an archiver, such as
7-zip,WinRAR,UltraISO. -
Transfer the Drivers directory containing the VirtiO drivers to the directory of the Windows ISO image you unpacked in step 1.
-
Install the DISM++ image management utility.
-
Open DISM++.
-
Build the installation image: to do this, go to Toolkit and select ISO Maker.
2. Upload the ISO image to the image storage
Follow the Upload and create image from file subsection of the Upload and create image instructions.
Specify:
- file — the image you prepared in step 1;
- OS — Windows;
- image format —
iso; - container format —
bare.
3. Modify image properties
-
Display the IDs of available images:
openstack image listThe response will show a list of images. Copy the ID of the image you uploaded in step 2.
-
Optional: view image properties:
openstack image show -
Add the necessary properties:
openstack image set \--property hw_disk_bus=scsi \--property hw_firmware_type=uefi \--property hw_qemu_guest_agent=yes \--property hw_scsi_model=virtio-scsi \--property os_type=windows \--property x_sel_image_agent_type=cloudbase-init \--property x_sel_image_os_arch=amd64 \--property x_sel_image_os_dist=windows \--property x_sel_image_os_type=windows \--property x_sel_image_type=master \--property x_sel_kpti_patch=true \<image_id>Specify
<image_id>— the ID of the image you copied in step 2.
Prepare a Linux image
1. Upload the ISO image to the image repository
Follow the instructions in Upload and create an image.
2. Create a cloud server from the uploaded image
Follow the instructions in Create a cloud server.
Select the uploaded image as the source and a network volume as the boot volume.
3. Configure the cloud server
Ubuntu
Debian
Oracle
CentOS
Rocky Linux
AlmaLinux
Fedora
These instructions are for the Ubuntu 22.04 image.
-
Add to the
sources.listfile the Selectel OpenStack repositories:tee /etc/apt/sources.list <<EOFdeb [arch=all signed-by=/usr/share/keyrings/openstack.gpg] https://mirror.selectel.ru/3rd-party/cloud-init-deb/jammy/ jammy mainEOF -
Update the repository list for the package manager:
apt update -
Install the packages:
apt install -y cloud-init \cloud-utils \growpart \qemu-guest-agent \set-root-pw \crontab-randomizer \fstrim-blocks -
Go to the
/etc/cloud/cloud.cfg.d/directory to create cloud-init configuration files:cd /etc/cloud/cloud.cfg.d/ -
Disable the creation of default users:
tee /etc/cloud/cloud.cfg.d/10_no_default_users.cfg <<EOFusers: []EOF -
Add datasources for cloud-init-datasources:
tee /etc/cloud/cloud.cfg.d/91-cloud-init-datasources.cfg <<EOFdatasource_list: [ OpenStack, ConfigDrive, EC2, None ]EOF -
Prevent disabling root access via SSH:
tee /etc/cloud/cloud.cfg.d/99_keep_root_user.cfg <<EOFdisable_root: falseEOF -
Change the time zone:
tee /etc/cloud/cloud.cfg.d/99_locale_timezone.cfg <<EOFlocale: en_US.UTF-8timezone: UTCEOF -
Add host SSH fingerprint removal from logs and key removal for SSH to work properly on cloud servers created from the image:
tee /etc/cloud/cloud.cfg.d/99_ssh_settings.cfg <<EOFno_ssh_fingerprints: truessh_deletekeys: trueEOF -
Optional: allow password authentication via SSH:
tee /etc/cloud/cloud.cfg.d/99_ssh_settings.cfg <<EOFssh_pwauth: trueEOF -
Configure service autostart to apply changes and ensure proper operation after server reboot:
systemctl enable cloud-initsystemctl enable qemu-guest-agentsystemctl enable cloud-finalsystemctl enable cloud-init-localsystemctl enable cloud-config -
Connect to the cloud server again.
A message will appear indicating that the host key has changed. This means that cloud-init runs successfully when the operating system boots:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!Someone could be eavesdropping on you right now (man-in-the-middle attack)!It is also possible that a host key has just been changed.
4. Create an image from the cloud server boot volume
-
Add properties to the created image:
openstack image set --property x_sel_image_owner=Selectel \--property hw_qemu_guest_agent=yes \--property x_sel_image_os_dist=<distribution_name> \--property x_sel_image_os_type=linux \--property x_sel_image_os_arch=amd64 \<image>Specify:
--property hw_qemu_guest_agent=yes— the property is responsible for cloud server power management and the correct operation of the metric collection and display subsystem in the control panel;<distribution_name>— OS name of the cloud server that you configured in step 3. Available values:ubuntu,debian,oraclelinux,centos,rocky,almalinuxandfedora.<image>— ID or name of the image. You can view the list usingopenstack image list --private
-
Optional: after creating the image from the volume, delete the cloud server.