RHEL CoreOS (RHCOS) is a derivative of Red Hat Enterprise Linux (RHEL), CentOS Strema CoreOS (SCOS) and Fedora CoreOS (FCOS). The tool to build RHCOS, SCOS and FCOS is coreos-assembler. The process detailled here is thus very similar to the one described in Building Fedora CoreOS or Building and developing CentOS Stream CoreOS but requires access to Red Hat internal resources.
Note that this documentation applies only to RHCOS versions starting with 4.19 and later. For version from 4.9 to 4.18, see the documentation from openshift/os (4.18 branch). For versions older than 4.9, see the internal documentation.
-
Make sure you're meeting the prerequisites.
-
Make sure that you have setup the Red Hat internal CA on your system and that you are connected to the Red Hat VPN.
-
Setup a
cosaalias, following the upstream documentation.- Note: If you encounter DNS resolution issues with COSA when on the Red Hat
VPN, you should try adding
--net=hostto the podman invocation.
- Note: If you encounter DNS resolution issues with COSA when on the Red Hat
VPN, you should try adding
-
Create and use a dedicated directory:
$ mkdir rhcos $ cd rhcosIf you're going to work on RHCOS based on different versions of RHEL, using a dedicated directory for each RHEL version is recommended:
$ mkdir rhcos-rhel-10.2 $ cd rhcos-rhel-10.2 -
Make sure that you have setup the latest internal Red Hat root certificates on your host system. See the internal documentation.
-
Make sure that you have the latest
cosaalias from the documentation. Then ask COSA to use those certificates:$ export COREOS_ASSEMBLER_ADD_CERTS='y' -
Get the following value from the internal documentation:
$ export RHCOS_REPO="..." -
Clone the config repo (
coreos/rhel-coreos-config), passing as argument the internal Git repo which includes the RPM repo configs and optionaly the specific branch:# Main developement branch, default version $ cosa init --yumrepos "${RHCOS_REPO}" https://github.com/coreos/rhel-coreos-config.git # Main developement branch, selecting a specific variant $ cosa init --yumrepos "${RHCOS_REPO}" --variant rhel-10.2 https://github.com/coreos/rhel-coreos-config.git # Specific develepment branch, selecting a specific variant $ cosa init --yumrepos "${RHCOS_REPO}" --variant rhel-10.2 --branch foobar https://github.com/coreos/rhel-coreos-config.git -
Authenticate to the Red Hat Stage Registry (
registry.stage.redhat.io):The base container images for RHCOS are hosted on
registry.stage.redhat.io, which requires authentication. Without this,cosa buildwill fail with anunauthorizederror when pulling the base image.-
Create an account at Red Hat Subscription Management (Ethel) if you don't already have one.
-
Log in to the registry from your host:
$ podman login registry.stage.redhat.io -
Share the registry credentials with the COSA container so that
buildahinside the container can pull fromregistry.stage.redhat.io:$ export COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS="-v /run/user/$(id -u)/containers/auth.json:/tmp/auth.json:ro -e REGISTRY_AUTH_FILE=/tmp/auth.json"
-
-
Fetch packages and build RHCOS ostree container and QEMU image:
$ cosa fetch $ cosa build
- You can build images for platforms that are supported in COSA using the
buildextendcommands:$ cosa osbuild aws $ cosa osbuild openstack
- You may then run an ephemeral virtual machine using QEMU with:
$ cosa run
- You may then run tests on the image built with
kola:# Run basic QEMU scenarios $ cosa kola run basic* # Run all kola tests (internal & external) $ cosa kola run --parallel 2
- If you need to override a file or a package for local testing, you can place
those into the
override/rootfsoroverride/rpmdirectory before building the image. See the Using overrides section from the COSA documentation.