Skip to main content

Prepare ISO image to work with the cloud platform

Last update:

If you have uploaded an ISO image with an operating system distribution to the image store, we recommend that you make it fully compatible with the Selectel Cloud Platform. From a compatible image, you can create cloud servers with the same functionality as servers from off-the-shelf images.

Prepare a Windows image

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

1. Prepare an ISO image locally

  1. On the local computer unpack the archive with ISO-image into a separate directory using an archiver, e.g. 7-zip, WinRAR, tar.

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

  3. Create a Drivers directory.

  4. Unpack the ISO-image with VirtiO-drivers into the Drivers directory using an archiver, e.g. 7-zip, WinRAR, UltraISO.

  5. Move the Drivers directory with 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 by going to the Toolkit section and selecting ISO Maker.

2. Upload the ISO image to the image repository

Use the Download and Create Image subsection from the Download and Create Image instruction file.

Specify:

  • file — the image you prepared earlier;
  • OS — Windows;
  • image format — iso;
  • container format — bare.

3. Modify the properties of the image

  1. Open the OpenStack CLI.

  2. Output the IDs of the available images:

    openstack image list

    A list of images will appear in the response.Copy the ID of the image you downloaded earlier.

  3. Optional: look at the image properties:

    openstack image show
  4. Add the desired 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> is the ID of the image you copied in step 2.

Prepare a Linux image

For your information

These instructions are for an Oracle Linux image. Other distributions may have different utilities, repositories, and file locations.

  1. Upload the ISO image to the image repository.
  2. Create a cloud server from the downloaded image.
  3. Set up a cloud server.
  4. Create an image from the cloud server boot disk.

1. Download the ISO image to the image store

Use the instructions to Download and create an image.

2. Create a cloud server from the downloaded image

Use the instructions to Create a cloud server.

Select the downloaded image as the source and the network drive as the boot disk.

3. Set up a cloud server

  1. Connect to the cloud server.

  2. Add the OpenStack Selectel repositories to the selectel-openstack.repo file:

    cat <<EOF > /etc/dnf.repos.d/selectel-openstack.repo
    [selectel-openstack]
    name=selectel-openstack
    baseurl=http://mirror.selectel.org/rpm/centos/7/x86_64
    gpgcheck=1
    gpgkey=http://mirror.selectel.org/selectel-openstack.key
    EOF
  3. Update the list of repositories for the package manager:

    dnf update
  4. Install the packages:

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

    cd /etc/cloud/cloud.cfg.d/
  6. Prohibit the creation of the ubuntu user:

    cat <<EOF > 10_no_default_users.cfg
    users: []
    EOF
  7. Add data sources for cloud-init-datasources:

    cat <<EOF > 91-dib-cloud-init-datasources.cfg
    datasource_list: [ ConfigDrive, Ec2, None ]
    EOF
  8. Disable the cloud-init and EC2 warning:

    cat <<EOF > 92-ec2-datasource.cfg
    #cloud-config
    datasource:
    Ec2:
    strict_id: false
    EOF
  9. Add download settings:

    cat <<EOF > 99_boot_routines.cfg
    bootcmd:
    - sed -i '/^;/d' /etc/resolv.conf
    EOF
  10. Prevent cloud-init from disabling EC2 metadata:

    cat <<EOF > 99_enable_ec2.cfg
    disable_ec2_metadata: false
    EOF
  11. Add first-boot settings:

    cat <<EOF > 99_first_boot_routines.cfg
    runcmd:
    - sed -i '/NetworkManager/d' /etc/resolv.conf
    - sed -i '/^search/d' /etc/resolv.conf
    - set-root-pw 2> /dev/null
    - crontab-randomizer
    EOF
  12. Prohibit disabling root access via SSH:

    cat <<EOF > 99_keep_root_user.cfg
    disable_root: false
    EOF
  13. Change the timezone:

    cat <<EOF > 99_location.cfg
    locale: en_US.UTF-8
    timezone: UTC
    EOF
  14. Add permission for password authentication via SSH:

    cat <<EOF > 99_ssh_settings.cfg
    ssh_pwauth: true
    no_ssh_fingerprints: true
    ssh_deletekeys: true
    EOF
  15. Configure services autorun to apply changes and work correctly after a server reboot:

    systemctl enable cloud-init
    systemctl enable cloud-init.service
    systemctl enable cloud-config.service
    systemctl enable cloud-final.service
    systemctl enable qemu-guest-agent.service
    systemctl enable cockpit.socket
  16. Perform a hardware reboot of the server.

  17. Reconnect to the cloud server.

    You will see a message that the host ID has changed. This means that cloud-init is successful in booting the operating system:

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

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

  2. Open the OpenStack CLI.

  3. Add properties for the created image:

    openstack image set --property x_sel_image_owner=Selectel <image>
    openstack image set --property hw_qemu_guest_agent=yes <image>

    Specify <image> — image ID or name. The list can be viewed with openstack image list --private

  4. Optional: after creating an image from the disk , remove the cloud server.