How to run a CentOS 8 instance on OpenStack
How to add CentOS 8 cloud / KVM image to OpenStack? How to run CentOS 8 instance / VM on OpenStack? The Openstack Glance service enables users to discover, register and retrieve virtual machine images. The default storage location for these images is / var / lib / glance / images / Its backend is a file. In this guide, we upload the CentOS 8 KVM cloud image to the Openstack Glance service.
For RHEL 8: How to add RHEL 8 qcow2 image to OpenStack Glance
Vagrant and Cloud images for CentOS 8 were released when CentOS Linux 8 (1911) was opened to the public. This version is derived from the Red Hat Enterprise Linux 8.1 source code. Both CentOS 8 and CentOS 8 Stream can obtain Cloud images from cloud.centos.org.
OpenStack Glance supports the following image formats:
- raw (Unstructured format)
- qcow2 (Qemu / KVM, support copy-on-write)
- iso (Archive format for discs; for example, CD)
- VCR (Hyper-V, common in virtual machine monitors of companies such as VMware, Xen, Microsoft, VirtualBox, etc.)
- vdi (Qemu / VirtualBox)
- vmdk (VMware)
- bare (Excluding metadata)
- Autumn / Amy / Ali (Amazon kernel, ramdisk or machine image)
- and many more.
Upload CentOS 8 Cloud Image to OpenStack Glance
Install wget to download the cloud image:
--- Debian / Ubuntu ---
$ sudo apt install -y wget
--- CentOS / Fedora ---
$ sudo yum -y install wget
$ sudo dnf -y install wget
Download the latest Cloud image from cloud.centos.org.
--- CentOS 8 Linux x86_64 ---
wget https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.1.1911-20200113.3.x86_64.qcow2
--- CentOS 8 Stream Linux x86_64 ---
wget https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20200113.0.x86_64.qcow2
Before uploading, you can use our guide as a reference to further customize qcow2 images.
How to customize Qcow2 / Raw Linux OS disk image with virt-customize
Then get the openstack environment.
source ~/.keystonerc
And upload CentOS 8 Cloud Images to OpenStack Glance.
--- CentOS 8 Linux x86_64 ---
$ openstack image create
--container-format bare
--disk-format qcow2
--file CentOS-8-GenericCloud-8.1.1911-20200113.3.x86_64.qcow2
CentOS-8
--- CentOS 8 Stream Linux x86_64 ---
$ openstack image create
--container-format bare
--disk-format qcow2
--file CentOS-Stream-GenericCloud-8-20200113.0.x86_64.qcow2
CentOS-8-Stream
If you do not have the OpenStack CLI, please check: How to install and configure the OpenStack Client on Linux
Confirm if the image is available in Glance:
$ openstack image list | grep CentOS-8
| adbe1f0c-665e-481a-b689-e32414339415 | CentOS-8 | active |
| 035221af-97e4-4801-b171-fc1b6fc2245d | CentOS-8-Stream | active |
You can also upload images using the Horizon web interface-navigate to Project> Calculation > image > Create image
Provide image name, description, browse and select image from source, select image visibility, and click “Create image“Button.
After the picture is uploaded, the details will be in Pictures section.
You can now launch instances from the uploaded images. See the following example:
$ openstack server create
--image CentOS-8
--key-name jmutai
--flavor m1.small
--security-group 7fffea2a-b756-473a-a13a-219dd0f1913a
--network private
mycentos8
Confirm server creation:
$ openstack server list
+--------------------------------------+-------------------+---------+-----------------------------------+-----------+----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+-------------------+---------+-----------------------------------+-----------+----------+
| 9e1e1b14-db2c-405e-9361-6b1b08c707b8 | mycentos8 | ACTIVE | private=10.10.1.138 | CentOS-8 | m1.small |
+--------------------------------------+-------------------+---------+-----------------------------------+-----------+----------+
Let’s test if we can SSH to the created server.
$ ssh [email protected] Warning: Permanently added '10.10.1.138' (ECDSA) to the list of known hosts. Enter passphrase for key '/home/jmutai/.ssh/id_rsa': Activate the web console with: systemctl enable --now cockpit.socket [[email protected] ~]$ cat /etc/os-release NAME="CentOS Linux" VERSION="8 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="8" [[email protected] ~]$ exit logout Connection to 10.10.1.138 closed.
We can confirm that we are logged in to the CentOS 8 instance by checking the / etc / os-release content.
More guides on CentOS and OpenStack:
How to manage CentOS 8 Linux with Cockpit Web Console
Enable automatic software update on CentOS 8 / RHEL 8
How to join CentOS 8 / RHEL 8 system to Active Directory (AD) domain
How to install CentOS 8 Linux-step by step screenshot
How to resize / expand Cinder in OpenStack
How to rename an instance / server in OpenStack
How to assign a floating IP address to an instance in OpenStack
How to create an OpenStack instance with a fixed / static IP address
How to create OpenStack projects, users and roles