Creating Custom Repositories

Learn how to create a custom repository.

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.

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

    sudo cp /usr/share/osbuild-composer/repositories/ol-8.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.

    • check_gpg: must always be set to false.

    • rhsm: must always be set to false.

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

    {
        "x86_64": [
            {
                "name": "baseos",
                "baseurl": "https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/baseos/latest/x86_64",
                "check_gpg": false,
                "rhsm": false
            },
        ]
    }
  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 8 repository file for verification.

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