Creating Custom Repositories

This task describes how to create a separate custom repository file to override the default repositories that are created when you install Image Builder.

  1. Create a directory to store the customized repositories.
    sudo mkdir -p /etc/osbuild-composer/repositories
  2. Using a text editor, create a file for the version of Oracle Linux image you want to create.

    Alternatively, you can copy a default repository file to use as a template. For example, for an Oracle Linux 9 image, you would copy the Oracle Linux 9 JSON file from the default location.

    sudo cp /usr/share/osbuild-composer/repositories/OL9.json /etc/osbuild-composer/repositories/
  3. Following the repository JSON specification, include the following information for each repository in the file that you created:
    • System architecture of the OS.
    • name: name of the repository.
    • baseurl: the URL of the yum repository.
    • gpgkey: package GPG key block.
    • check_gpg: must always be set to true.

    The following is an example of a JSON file for an Oracle Linux 9 image:

    {
        "x86_64": [
            {
            "name": "ol9_baseos_latest",
                "baseurl": "https://yum.oracle.com/repo/OracleLinux/OL9/baseos/latest/x86_64/",
                "gpgkey": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\n (…​)",
                "check_gpg": true,
                "enabled": true,
                "metadata_expire": ""
            }
        ]
    }
  4. (Optional) Verify that the URLs in the file are correct by comparing them to the corresponding repository file in /etc/yum.repos.d.

    For the current example, you would use an Oracle Linux repository file for verification.

    cat /etc/yum.repos.d/oracle-linux-ol9.repo
  5. Restart osbuild-composer.service.
    sudo systemctl restart osbuild-composer.service