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. ]
About the author
More like this
Browse by channel
Automation
The latest on IT automation for tech, teams, and environments
Artificial intelligence
Updates on the platforms that free customers to run AI workloads anywhere
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
The latest on how we reduce risks across environments and technologies
Edge computing
Updates on the platforms that simplify operations at the edge
Infrastructure
The latest on the world’s leading enterprise Linux platform
Applications
Inside our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Customer support
- Developer resources
- Find a partner
- Red Hat Ecosystem Catalog
- Red Hat value calculator
- Documentation
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit