Skip to main content

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 Servercore 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

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

1. Prepare the ISO image locally

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

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

  3. Create a Drivers directory.

  4. Extract the ISO image with VirtIO drivers into the Drivers directory using an archiver, such as 7-zip, WinRAR, 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++ image management utility.

  7. Open DISM++.

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

  1. Open the OpenStack CLI.

  2. Display the IDs of available images:

    openstack image list

    The response will show 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 ID of the image you copied in step 2.

Prepare a Linux image

  1. Upload the ISO image to the image repository.

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

For your information

These instructions are for the Ubuntu 22.04 image.

  1. Connect to the cloud server.

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

    tee /etc/apt/sources.list <<EOF
    deb [arch=all signed-by=/usr/share/keyrings/openstack.gpg] https://mirror.servercore.com/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=Servercore \
    --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, almalinux and fedora.
    • <image> — ID or name of the image. You can view the list using openstack image list --private
  4. Optional: after creating the image from the volume, delete the cloud server.