订阅 RSS 源

I was involved in a demo of Red Hat Enterprise Linux (RHEL) for Edge, and I experienced some problems with the network driver for Raspberry Pi 4 in RHEL 8. To solve this problem, I decided to create a custom image based on RHEL 9 instead, where the Ethernet network driver works.

(Note: At the time of this writing, there is no RHEL support for Raspberry Pi. RHEL for ARM is available only for larger 64-bit ARMv8 platforms. However, this is based on a demo, and if you need a supported Linux system, try Fedora on Raspberry Pi. Fedora 29 and later versions support the Raspberry Pi Model 2B and 3 series of devices, including the 3B, 3B+, 3A+, 3CM, and 3CM+.) 

There was no RHEL 9 Amazon Machine Image (AMI) in the AWS marketplace when I was working on these problems. AMIs are standard prepackaged images required to launch instances on AWS. Even if there is a RHEL 9 AMI by the time you're reading this article, it's worth understanding how to build a custom image.

Key technologies

There are three key technologies involved in this process:

  • Qcow2 is the most common (and the native) format of disk images used by QEMU. The AWS import-image tool cannot import qcow2 images directly (at the time of writing).
  • AWS CLI, the AWS command-line interface, is a unified tool to manage AWS services. It enables you to control multiple AWS services from the command line and automate them through scripts.
  • Red Hat Enterprise Linux for ARM 64 is designed to meet the needs of the hybrid cloud environment. It can be deployed on physical infrastructure, as a guest operating system on supported hypervisors, in public cloud environments, and in containers using the RHEL Unified Base Image (UBI).

I used RHEL 8 as my workstation and the RHEL 9.0 KVM Guest Image to create my custom image. If you do not have an active Red Hat Customer Portal account but you are interested in following this tutorial, you can use the no-cost RHEL for developers subscription. Here, you can download the ISO, boot or full (for offline or disconnected environments) version, and convert it to qcow2 thanks to qemu-img convert.

I'll assume you're familiar with routine AWS and Linux tasks, such as assigning the correct permissions to the AWS Simple Storage Service (S3) bucket, installing tools such as AWS CLI, and so on. If you're new to AWS and Linux, you can follow the steps in my Git repository.

[ Learn how to modernize your IT with managed cloud services. ]

Convert qcow2 to RAW

Use the qemu-img to convert the qcow2 image into the RAW format:

$ qemu-img convert rhel-baseos-9.0-beta-5-aarch64-kvm.qcow rhel-baseos-9.0-beta-5-aarch64-kvm.raw

Create an S3 bucket

Create the S3 bucket, copy the RAW image into it, and import the image:

$ aws s3api create-bucket \
--bucket my-rhel9-img \
--region eu-west-1 \
--create-bucket-configuration LocationConstraint=eu-west-1

$ aws s3 cp rhel-baseos-9.0-beta-5-aarch64-kvm.raw s3://my-rhel9-img

$ aws ec2 import-snapshot \
--description "Red Hat Enterprise Linux 9.0 Beta Update 5 KVM Guest Image" \
--disk-container "file://container.json"

[ Try Red Hat's interactive scenarios to learn Red Hat OpenShift at your own pace. ]

Register the image

Finally, register your image with AWS:

$ aws ec2 register-image \
--name RHEL9-baseos-arm64 --architecture arm64 \
--virtualization-type hvm --ena-support \
--root-device-name /dev/xvda \
--block-device-mappings DeviceName=/dev/xvda,Ebs={SnapshotId=snap-0d3e61728b16d7f48}

Run your image

Using the aws ec2 run-instances command, you can run EC2 instances of your custom golden image.

In my next article, I'll explain how to build MicroShift into your custom image. MicroShift is an exploratory project from Red Hat's edge computing team. It tailors Red Hat OpenShift for field-deployed devices, providing a consistent development and management experience across all footprints.

[ You might also be interested in reading How MicroShift and Kubernetes help manage edge devices at scale. ]


关于作者

UI_Icon-Red_Hat-Close-A-Black-RGB

按频道浏览

automation icon

自动化

有关技术、团队和环境 IT 自动化的最新信息

AI icon

人工智能

平台更新使客户可以在任何地方运行人工智能工作负载

open hybrid cloud icon

开放混合云

了解我们如何利用混合云构建更灵活的未来

security icon

安全防护

有关我们如何跨环境和技术减少风险的最新信息

edge icon

边缘计算

简化边缘运维的平台更新

Infrastructure icon

基础架构

全球领先企业 Linux 平台的最新动态

application development icon

应用领域

我们针对最严峻的应用挑战的解决方案

Virtualization icon

虚拟化

适用于您的本地或跨云工作负载的企业虚拟化的未来