Prepare an ISO image for use with the cloud platform
If you have uploaded to the image storage 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 from ready-made images.
Prepare a Windows image
- Prepare the ISO image locally.
- Upload the ISO image to the image storage.
- Modify the Windows image properties.
1. Prepare the ISO image locally
-
On your local computer, extract the ISO image archive to a separate directory using an archiver, for example
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 to the Drivers directory using an archiver, for example
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++ utility for image management.
-
Open DISM++.
-
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
Use the Upload and create an image from a file subsection of the Upload and create an image guide.
Specify:
- file — the image that 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 listA list of images will appear in the response. 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
This is a guide for the Oracle Linux image. For other distributions, utilities, repositories, and file locations may differ.
- Upload the ISO image to the image storage.
- Create a cloud server from the uploaded image.
- Configure the cloud server.
- Create an image from the cloud server boot disk.
1. Upload the ISO image to the image storage
Use the Upload and create an image guide.
2. Create a cloud server from the uploaded image
Use the Create a cloud server guide.
Select the uploaded image as the source and a network volume as the boot disk.
3. Configure the cloud server
-
Add the Selectel OpenStack repositories to the
selectel-openstack.repofile:cat <<EOF > /etc/dnf.repos.d/selectel-openstack.repo[selectel-openstack]name=selectel-openstackbaseurl=http://mirror.selectel.org/rpm/centos/7/x86_64gpgcheck=1gpgkey=http://mirror.selectel.org/selectel-openstack.keyEOF -
Update the package manager repository list:
dnf update -
Install the packages:
dnf install crontab-randomizer \fstrim-blocks qemu-guest-agent \set-root-pw \cloud-init \cloud-utils-growpart \compat-openssl10 -
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 the
ubuntu:user:cat <<EOF > 10_no_default_users.cfgusers: []EOF -
Add data sources for cloud-init-datasources:
cat <<EOF > 91-dib-cloud-init-datasources.cfgdatasource_list: [ ConfigDrive, Ec2, None ]EOF -
Disable the warning about using cloud-init and EC2:
cat <<EOF > 92-ec2-datasource.cfg#cloud-configdatasource:Ec2:strict_id: falseEOF -
Add boot settings:
cat <<EOF > 99_boot_routines.cfgbootcmd:- sed -i '/^;/d' /etc/resolv.confEOF -
Prevent cloud-init from disabling EC2 metadata:
cat <<EOF > 99_enable_ec2.cfgdisable_ec2_metadata: falseEOF -
Add first-boot settings:
cat <<EOF > 99_first_boot_routines.cfgruncmd:- sed -i '/NetworkManager/d' /etc/resolv.conf- sed -i '/^search/d' /etc/resolv.conf- set-root-pw 2> /dev/null- crontab-randomizerEOF -
Prevent the disabling of root access via SSH:
cat <<EOF > 99_keep_root_user.cfgdisable_root: falseEOF -
Change the time zone:
cat <<EOF > 99_location.cfglocale: en_US.UTF-8timezone: UTCEOF -
Add permission for password authentication via SSH:
cat <<EOF > 99_ssh_settings.cfgssh_pwauth: trueno_ssh_fingerprints: truessh_deletekeys: trueEOF -
Configure auto-start for services to apply changes and ensure correct operation after the server reboots:
systemctl enable cloud-initsystemctl enable cloud-init.servicesystemctl enable cloud-config.servicesystemctl enable cloud-final.servicesystemctl enable qemu-guest-agent.servicesystemctl enable cockpit.socket -
Connect to the cloud server again.
A message will appear stating that the host identity has changed. This means that cloud-init is working 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 disk
-
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>— the image ID or name. You can view the list usingopenstack image list --private -
Optional: after creating the image from the disk, delete the cloud server.