Skip to main content

Prepare an ISO image for use with the cloud platform

If you uploaded to the image storage an ISO image with an operating system distribution, we recommend making it fully compatible with the Selectel Cloud Platform.

Prepare a Windows image

  1. Prepare the ISO image locally.
  2. Upload the ISO image to the image storage.
  3. Modify the Windows image properties.

1. Prepare the ISO image locally

  1. On your local computer, extract the archive containing the ISO image into a separate directory using an archiver, such as 7-zip, WinRAR, or tar.

  2. Download VirtIO drivers as an ISO image from the Fedora People repository.

  3. Create a Drivers directory.

  4. Extract the ISO image containing the VirtIO drivers into the Drivers directory using an archiver, such as 7-zip, WinRAR, or UltraISO.

  5. Transfer the Drivers directory containing the VirtiO drivers to the directory of the Windows ISO image you unpacked in step 1.

  6. Install the DISM++ utility for image management.

  7. Open DISM++.

  8. Build the installation image: to do this, go to the Toolkit section and select ISO Maker.

2. Upload the ISO image to the image storage

Follow the Upload and create an 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

  1. Open the OpenStack CLI.

  2. Display the IDs of available images:

    openstack image list

    The output will display a list of images. Copy the ID of the image you uploaded in step 2.

  3. Optional: view image properties:

    openstack image show
  4. 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 image ID that you copied in step 2.

Prepare a Linux image

  1. Upload the ISO image to the image storage.

  2. Create a cloud server from the uploaded image.

  3. Configure the cloud server.

  4. Create an image from the cloud server boot volume.

1. Upload the ISO image to the image repository

Follow the Upload and create image instructions.

2. Create a cloud server from the uploaded image

Follow the Create cloud server instructions.

Select the uploaded image as the source and a network volume as the boot volume.

3. Configure the cloud server

For your information

These instructions are for the Ubuntu 22.04 image.

  1. Connect to the cloud server.

  2. Add Selectel OpenStack repositories to the sources.list file:

    tee /etc/apt/sources.list <<EOF
    deb [arch=all signed-by=/usr/share/keyrings/openstack.gpg] https://mirror.selectel.ru/3rd-party/cloud-init-deb/jammy/ jammy main
    EOF
  3. Update the repository list for the package manager:

    apt update
  4. Install the packages:

    apt install -y cloud-init \
    cloud-utils \
    growpart \
    qemu-guest-agent \
    set-root-pw \
    crontab-randomizer \
    fstrim-blocks
  5. Go to the /etc/cloud/cloud.cfg.d/ directory to create cloud-init configuration files:

    cd /etc/cloud/cloud.cfg.d/
  6. Disable the creation of default users:

    tee /etc/cloud/cloud.cfg.d/10_no_default_users.cfg <<EOF
    users: []
    EOF
  7. Add datasources for cloud-init-datasources:

    tee /etc/cloud/cloud.cfg.d/91-cloud-init-datasources.cfg <<EOF
    datasource_list: [ OpenStack, ConfigDrive, EC2, None ]
    EOF
  8. Prevent disabling root access via SSH:

    tee /etc/cloud/cloud.cfg.d/99_keep_root_user.cfg <<EOF
    disable_root: false
    EOF
  9. Change the time zone:

    tee /etc/cloud/cloud.cfg.d/99_locale_timezone.cfg <<EOF
    locale: en_US.UTF-8
    timezone: UTC
    EOF
  10. 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 <<EOF
    no_ssh_fingerprints: true
    ssh_deletekeys: true
    EOF
  11. Optional: allow password authentication via SSH:

    tee /etc/cloud/cloud.cfg.d/99_ssh_settings.cfg <<EOF
    ssh_pwauth: true
    EOF
  12. Configure service autostart to apply changes and ensure proper operation after server reboot:

    systemctl enable cloud-init
    systemctl enable qemu-guest-agent
    systemctl enable cloud-final
    systemctl enable cloud-init-local
    systemctl enable cloud-config
  13. Perform a hard reboot of the server.

  14. 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

  1. Create an image from the cloud server boot volume.

  2. Open the OpenStack CLI.

  3. 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 proper functioning of the metrics collection and display subsystem in the control panel;
    • <distribution_name> — the OS name of the cloud server you configured in step 3. Possible values: ubuntu, debian, oraclelinux, centos, rocky, almalinux, and fedora;
    • <image> — ID or name of the image. You can view the list of images using the command openstack image list --private.
  4. Optional: after creating the image from the volume, delete the cloud server.