28.3. Preparing a Repository Mirror for Image Builder

For technical reasons, Image Builder cannot directly use the Red Hat content delivery network (CDN). This procedure describes how to prepare a mirror of such content on a system different from the one running Image Builder.


  • The file system containing the /var/www directory must have at least 50 GiB of free space available. To check this:
    $ df -h /var/www/
  • The system must use the same version of Red Hat Enterprise Linux as the system using Image Builder and be fully subscribed.


  1. Install the tools for handling packages and repositories, and the Apache web server:
    # yum install yum-utils createrepo httpd
  2. List the repositories enabled on this machine and note their identifiers:
    # yum repolist
  3. Create local mirrors of the repositories that you want to use in Image Builder. For each of these repositories, run:
    # mkdir -p /var/www/html
    # reposync --gpgcheck -l --download_path=/var/www/html --repoid REPO-ID --downloadcomps --download-metadata
    $ cd /var/www/html/REPO-ID
    $ createrepo -v /var/www/html/REPO-ID -g comps.xml
    Replace REPO-ID with the identifier you noted in the previous step.
  4. Make sure that the repositories have the correct SELinux context so that the httpd Apache web server can access the repository mirrors:
    # chcon -vR -t httpd_sys_content_t /var/www/html/
  5. Enable the web server to start after each reboot, configure the system firewall, and start the server for the first time:
    # systemctl enable httpd
    # firewall-cmd --add-service=http --permanent
    # firewall-cmd --add-service=http
    # systemctl start httpd