Menu Close
Chapter 3. Managing repositories
3.1. Image Builder default system repositories
The osbuild-composer
backend does not inherit the system repositories located in the /etc/yum.repos.d/
directory. Instead, it has its own set of official repositories defined in the /usr/share/osbuild-composer/repositories
directory. To override the official repositories, you must define overrides in /etc/osbuild-composer/repositories
. This directory is for user defined overrides and the files located here take precedence over those in the /usr
directory.
The configuration files are not in the usual DNF repository format known from the files in /etc/yum.repos.d/
. Instead, they are simple JSON files.
3.2. Overriding a system repository
You can configure a repository override in the /etc/osbuild-composer/repositories
directory by following these steps.
Prior to RHEL 8.5 release, the name of the repository overrides is rhel-8.json. Starting from RHEL 8.5, the names also respect the minor version: rhel-84.json, rhel-85.json, and so on.
Prerequisites
- You have a custom repository that is accessible from the host system
Procedure
Create a directory that contains the repository overrides you want to use:
$ sudo mkdir -p /etc/osbuild-composer/repositories
Create a JSON file with the following structure, for example:
{ "<ARCH>": [ { "name": "baseos", "metalink": "", "baseurl": "http://mirror.example.com/composes/released/RHEL-8/8.2.0/BaseOS/x86_64/os/", "mirrorlist": "", "gpgkey": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\n (...)", "check_gpg": true, "metadata_expire": "", } ] }
Specify only one of the following attributes:
metalink
,mirrorlist
, orbaseurl
. The remaining fields are optional.Save the file using a name corresponding to your RHEL version, for example:
/etc/osbuild-composer/repositories/rhel-84.json /etc/osbuild-composer/repositories/rhel-85.json /etc/osbuild-composer/repositories/rhel-90.json
Alternatively, you can copy the file for your distribution from
/usr/share/osbuild-composer/
and modify its content.Copy the repository file to the directory you created.
$ cp /usr/share/osbuild-composer/repositories/rhel-version.json /etc/osbuild-composer/repositories/
Replace rhel-version.json with your RHEL version, for example: rhel-85.json
Using the editor of your choice, edit the
baseurl
paths in therhel-85.json
file. For example:$ vi etc/osbuild-composer/repositories/rhel-85.json
As a result, the repository points to the correct URLs which are copied from the /etc/yum.repos.d/redhat.repo
file.
3.3. Overriding a system repository with support for subscriptions
osbuild-composer
service can use system subscriptions that are defined in the /etc/yum.repos.d/redhat.repo
file. To use a system subscription in osbuild-composer
, you need to define a repository override which has:
-
The same
baseurl
as the repository defined in/etc/yum.repos.d/redhat.repo
. -
The value of
”rhsm”: true
defined in the JSON object.
Prerequisites
-
System with a subscription defined in
/etc/yum.repos.d/redhat.repo
- You have created a repository override. See Overriding a system repository.
Procedure
Get the
baseurl
from the/etc/yum.repos.d/redhat.repo
file:[AppStream] name = AppStream mirror example baseurl = https://mirror.example.com/RHEL-8/8.5.0/AppStream/x86_64/os/ enabled = 1 gpgcheck = 0 sslverify = 1 sslcacert = /etc/pki/ca1/ca.crt sslclientkey = /etc/pki/ca1/client.key sslclientcert = /etc/pki/ca1/client.crt metadata_expire = 86400 enabled_metadata = 0
Configure the repository override to use the same
baseurl
and setrhsm
to true:{ "x86_64": [ { "name": "AppStream mirror example", "baseurl": "https://mirror.example.com/RHEL-8/8.5.0/AppStream/x86_64/os/", "gpgkey": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\n (...)", "check_gpg": true, "rhsm": true } ] }
osbuild-composer
does not automatically use repositories defined in /etc/yum.repos.d/
. You need to manually specify them either as a system repository override or as an additional source
using composer-cli
. System repository overrides are usually used for “BaseOS” and “AppStream” repositories, whereas composer-cli
sources are used for all the other repositories.
Additional resources