CentOS Stream 8
Sponsored Link

OpenStack Yoga : Add VM Images2022/05/31

 
Add Virtual Machine images in Glance.
For example on here, add a CentOS Stream 8 virtual machine image.
[1]
Install KVM HyperVisor, refer to here.
It's unnecessarry to set Bridge networking on the section [2] of the link.
Furthermore, Install VM management tools, refer to here.
[2] Create a CentOS Stream 8 image on Glance service Host.
Download the ISO image of CentOS Stream 8 first into a directory before it.
# create a directory for disk image

[root@dlp ~(keystone)]#
mkdir -p /var/kvm/images
# create a disk image

[root@dlp ~(keystone)]#
qemu-img create -f qcow2 /var/kvm/images/centos-st8.img 10G
# install

[root@dlp ~(keystone)]#
virt-install \
--name centos-st8 \
--ram 4096 \
--disk path=/var/kvm/images/centos-st8.img,format=qcow2 \
--vcpus 2 \
--os-variant centos-stream8 \
--network network=default \
--graphics none \
--console pty,target_type=serial \
--location /home/CentOS-Stream-8-x86_64-latest-dvd1.iso \
--extra-args 'console=ttyS0,115200n8'
Starting install...
# after installing OS, login to the VM and configure necessary settings

CentOS Stream 8
Kernel 4.18.0-348.2.1.el8_5.x86_64 on an x86_64

Activate the web console with: systemctl enable --now cockpit.socket

localhost login: root

# replace the interface name [enp1s0] to your own environment

[root@localhost ~]#
useradd centos

[root@localhost ~]#
passwd centos

[root@localhost ~]#
vi /etc/sysconfig/network-scripts/ifcfg-enp1s0
# disable the [UUID] line and also set [dhcp] for [BOOTPROTO] line

#UUID="3ebe29b4-b7a3-49d6-997a-ee8b78749840"

BOOTPROTO=dhcp

[root@localhost ~]#
dnf -y install cloud-init openssh-server

[root@localhost ~]#
vi /etc/cloud/cloud.cfg
# line 5 : if you'd like to allo SSH password auth, change to [1]
ssh_pwauth:   1

# line 57, 58 : change to [centos] as default user
# if you'd like to allow SSH password auth to the user, chage like follows
system_info:
  default_user:
    name: centos
    lock_passwd: false

[root@localhost ~]#
systemctl enable cloud-init sshd

[root@localhost ~]#
shutdown -h now

[3] Add the virtual image to Glance.
[root@dlp ~(keystone)]#
openstack image create "CentOS-Stream-8" --file /var/kvm/images/centos-st8.img --disk-format qcow2 --container-format bare --public

+------------------+---------------------------------------------------------------------------+
| Field            | Value                                                                     |
+------------------+---------------------------------------------------------------------------+
| container_format | bare                                                                      |
| created_at       | 2022-05-31T01:17:58Z                                                      |
| disk_format      | qcow2                                                                     |
| file             | /v2/images/7be5b7ab-36e8-43c7-95dd-34b4139a0e44/file                      |
| id               | 7be5b7ab-36e8-43c7-95dd-34b4139a0e44                                      |
| min_disk         | 0                                                                         |
| min_ram          | 0                                                                         |
| name             | CentOS-Stream-8                                                           |
| owner            | 0609d3b3b398456187fb705ec9224c4a                                          |
| properties       | os_hidden='False', owner_specified.openstack.md5='', owner_specified..... |
| protected        | False                                                                     |
| schema           | /v2/schemas/image                                                         |
| status           | queued                                                                    |
| tags             |                                                                           |
| updated_at       | 2022-05-31T01:17:58Z                                                      |
| visibility       | public                                                                    |
+------------------+---------------------------------------------------------------------------+

[root@dlp ~(keystone)]#
openstack image list

+--------------------------------------+-----------------+--------+
| ID                                   | Name            | Status |
+--------------------------------------+-----------------+--------+
| 7be5b7ab-36e8-43c7-95dd-34b4139a0e44 | CentOS-Stream-8 | active |
+--------------------------------------+-----------------+--------+
[4] By the way, if you got an image from internet, it's OK to simply add it like follows.
[root@dlp ~(keystone)]#
wget http://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img
[root@dlp ~(keystone)]#
openstack image create "Ubuntu2204-Official" --file ubuntu-22.04-server-cloudimg-amd64.img --disk-format qcow2 --container-format bare --public

+------------------+-----------------------------------------------------------------------------+
| Field            | Value                                                                       |
+------------------+-----------------------------------------------------------------------------+
| container_format | bare                                                                        |
| created_at       | 2022-05-31T01:21:20Z                                                        |
| disk_format      | qcow2                                                                       |
| file             | /v2/images/2c1c506d-53f7-4a19-8ac9-9fe20fc1cc5a/file                        |
| id               | 2c1c506d-53f7-4a19-8ac9-9fe20fc1cc5a                                        |
| min_disk         | 0                                                                           |
| min_ram          | 0                                                                           |
| name             | Ubuntu2204-Official                                                         |
| owner            | 0609d3b3b398456187fb705ec9224c4a                                            |
| properties       | os_hidden='False', owner_specified.openstack.md5='', owner_specified.o..... |
| protected        | False                                                                       |
| schema           | /v2/schemas/image                                                           |
| status           | queued                                                                      |
| tags             |                                                                             |
| updated_at       | 2022-05-31T01:21:20Z                                                        |
| visibility       | public                                                                      |
+------------------+-----------------------------------------------------------------------------+
Matched Content