Prepare ISO image to work with the cloud platform
If you have 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 for which the same functionality is available as servers from out-of-the-box images.
These are the instructions for the Oracle Linux image. Utilities, repositories, and file locations may differ for other distributions.
- Upload the ISO image to the image store.
- Create a cloud server from the downloaded image.
- Configure cloud server.
- Create an image from the cloud server boot disk.
1. Download the ISO image to the image repository at
Use the Download and create image instructions.
2. Create a cloud server from the downloaded image
Use the Create cloud server instruction.
Select the downloaded image as the source and the network drive as the boot disk.
3. Set up a cloud server
-
Add the OpenStack Selectel repositories to the
selectel-openstack.repo
file:cat <<EOF > /etc/yum.repos.d/selectel-openstack.repo
[selectel-openstack]
name=selectel-openstack
baseurl=http://repo.os.selectel.org/rpm/centos/7/x86_64
gpgcheck=1
gpgkey=http://repo.os.selectel.org/selectel-openstack.key
EOF -
Update the list of repositories for the package manager:
yum update
-
Install the packages:
yum install crontab-randomizer {
fstrim-blocks qemu-guest-agent {
set-root-pw {
cloud-init {
cloud-utils-growpart {
compat-openssl10 -
Navigate to the
/etc/cloud/cloud.cfg.d/
directory to create the cloud-init configuration files:cd /etc/cloud/cloud.cfg.d/
-
Prevent the
ubuntu
user from being created:cat <<EOF > 10_no_default_users.cfg
users: []
EOF -
Add data sources for cloud-init-datasources:
cat <<EOF > 91-dib-cloud-init-datasources.cfg
datasource_list: [ ConfigDrive, Ec2, None ]
EOF -
Disable the cloud-init and EC2 warning:
cat <<EOF > 92-ec2-datasource.cfg
#cloud-config
datasource:
Ec2:
strict_id: false
EOF -
Add download settings:
cat <<EOF > 99_boot_routines.cfg
bootcmd:
- sed -i '/^;/d' /etc/resolv.conf
EOF -
Prevent cloud-init from disabling EC2 metadata:
cat <<EOF > 99_enable_ec2.cfg
disable_ec2_metadata: false
EOF -
Add first-boot settings:
cat <<EOF > 99_first_boot_routines.cfg
runcmd:
- sed -i '/NetworkManager/d' /etc/resolv.conf
- sed -i '/^nameserver 10\./d' /etc/resolv.conf
- sed -i '/^nameserver 192\./d' /etc/resolv.conf
- sed -i '/^nameserver 172\./d' /etc/resolv.conf
- sed -i '/^search/d' /etc/resolv.conf
- set-root-pw 2> /dev/null
- crontab-randomizer
EOF -
Prohibit disabling root access via SSH:
cat <<EOF > 99_keep_root_user.cfg
disable_root: false
EOF -
Change the timezone:
cat <<EOF > 99_location.cfg
locale: en_US.UTF-8
timezone: UTC
EOF -
Add permission for password authentication via SSH:
cat <<EOF > 99_ssh_settings.cfg
ssh_pwauth: true
no_ssh_fingerprints: true
ssh_deletekeys: true
EOF -
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 -
A message will appear indicating 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
-
Add properties for the created image:
glance image-update --property x_sel_image_owner=Selectel <image>
glance image-update --property hw_qemu_guest_agent=yes <image>Specify
<image>
— ID or image name, can be viewed withopenstack image list --private
. -
Optional: after creating an image from disk delete cloud server.