- What is
reposyncutility and how to use it?
- How to create a local mirror of the latest update for Red Hat Enterprise Linux 5, 6, 7, 8, 8.x or 9 without using Satellite server
- Need to download all packages / rpms from specific channel locally
- How to make a local repository
# mkdir /var/repo # reposync --gpgcheck -l --repoid=rhel-5-server-els-rpms --download_path=/var/repo --downloadcomps # cd /var/repo/rhel-5-server-els-rpms # createrepo -v /var/repo/rhel-5-server-els-rpms # yum clean all # yum list-sec # find /var/cache/yum/ -name *updateinfo.xml* # mv /var/cache/yum/rhel-5-server-els-rpms/365ae03ca85bb9d3bc509ea9129d1d3fb9a18381-updateinfo.xml.gz /tmp # cd /tmp # gzip -d 365ae03ca85bb9d3bc509ea9129d1d3fb9a18381-updateinfo.xml.gz # mv 365ae03ca85bb9d3bc509ea9129d1d3fb9a18381-updateinfo.xml updateinfo.xml # cp updateinfo.xml /var/repo/rhel-5-server-els-rpms/repodata/ # modifyrepo /var/repo/rhel-5-server-els-rpms/repodata/updateinfo.xml /var/repo/rhel-5-server-els-rpms/repodata/
- Create a basic repository
- Create a repository that allows clients to install groups
- Modify repodata to identify which packages are security related
RHEL 8 & 9
Install the required packages
Install the "yum-utils" and "createrepo" packages on the registered system.
# yum install yum-utils createrepo
Create a basic local repository
<repo-id> to the repository you intend to sync
Sync all the packages from a specified repository to a specified directory
# reposync --gpgcheck -l --repoid=<repo-id> for example: # reposync --gpgcheck -l --repoid=rhel-6-server-rpms --download_path=/var/www/html
In the targeted directory, there will be a new directory named after the Repository ID. All the downloaded packages will be inside this directory.
# cd /var/www/html/<repo-id> # createrepo -v /var/www/html/<repo-id>
Create a local repository that allows clients to use groups
How to download all the metadata for the repository that is being synced which will allow the use of various plugins such as 'yum groupinstall'
On RHEL6 and later, reposync supports the
--downloadcompsoptions. For example:
# reposync --gpgcheck -l --repoid=repo-id --downloadcomps --download-metadata for example: # reposync --gpgcheck -l --repoid=rhel-6-server-rpms --download_path=/var/www/html --downloadcomps --download-metadata
To have access to the group data for the newly synced repo, please run the
createrepocommand as follows:
# cd /var/www/html/<repo-id> # createrepo -v /var/www/html/<repo-id>/ -g comps.xml
Modify the repodata to define which packages are security related.
These steps require that the createrepo command has already been run.
# yum clean all # yum list-sec # find /var/cache/yum/ -name updateinfo.xml ##For RHEL 5 use '-name *updateinfo.xml*'
From the find command above, identify the
updateinfo.xmlthat matches the
<repo-id>that you ran
reposyncagainst and move that file into your repodata directory.
# mv updateinfo.xml /var/www/html/<repo-id>/repodata/updateinfo.xml # modifyrepo /var/www/html/<repo-id>/repodata/updateinfo.xml /var/www/html/<repo-id>/repodata
Create a local repo with Red Hat Enterprise Linux 8/9
- Only a RHEL 8 system, Red Hat Satellite, or a Capsule can sync RHEL 8 content correctly.
- While the fetch procedures for RHEL8 and RHEL9 are similar, a RHEL8 system can not fetch RHEL9 streams, and vice versa. If you want to save resources and need to fetch streams for both releases, then for example a RHEL used as hypervisor could host a KVM RHEL8 and a KVM RHEL9 guest, and these guests could fetch into NFS exports offered by the hypervisor. The hypervisor could then offer the directories, for example via HTTP(S).
- On RHEL8, ensure you have
yum-utils-4.0.8-3.el8.noarchor higher installed so
reposynccorrectly downloads all the packages.
Sync all enabled repositories and their repodata
# reposync -p <download-path> --download-metadata --repo=<repo id>
To sync a specific minor release
For systems registered to the CDN or Red Hat Satellite you must release lock the system with
# subscription-manager release --set=8.4 && rm -rf /var/cache/dnf
At this point your system will only have access to content released for RHEL 8.0- 8.4. If you are syncing multiple minor releases, you must keep these separate from each other. For example to sync both 8.4 and 8.5:
# subscription-manager release --set=8.4 && rm -rf /var/cache/dnf # reposync -p /var/www/html/8.4 --download-metadata --repo=<repo id> # subscription-manager release --set=8.5 && rm -rf /var/cache/dnf # reposync -p /var/www/html/8.5 --download-metadata --repo=<repo id>
To sync only the latest content for a specific minor release, you must set the
subscription-manager version-lock. Then run
reposync with the
-n option to specify that you only wish to download the latest content (and not content for older minor release versions as well):
# subscription-manager release --set=8.4 && rm -rf /var/cache/dnf # reposync -n -p /var/www/html/8.4 --download-metadata --repo=<repo id>
Note: The command
createrepo is not required for RHEL 8 or 9.
reposync will download everything including the repodata. Any createrepo_c version prior to 0.16.2-1.el8 is not capable to handle module information and hence tends to remove the module data if run on RHEL 8 system. If you have the older version and have run createrepo, check How to add the modules information after cloning the RHEL8 repository
- To keep the sync current, for example, cronjobs can be used. The
--updateto efficiently update existing repositories.
- The locally created repository is typically used by other RHEL clients via LAN, for example via HTTP/HTTPS (for example provided by the apache webserver which is part of RHEL), via FTP (i.e. vsftpd) or NFS (nfs-utils package). Share this local repository with the offline systems to update the offline systems.
reposyncutility can only mirror repositories which the system is entitled to.
- Related information How do I delete old packages in local repository server?
- For RHEL 7.7+, The Red Hat Customer Portal assumes that if all Red Hat provided CDN repositories are disabled the system lacks access to the latest content, and will not show errata information. If you need/want to see a systems errata information in the Red Hat Customer Portal, subscription manager must have at least one official redhat repository enabled. Note that only the enabled repositories are considered as part of the errata applicability calculation.
Red Hat provides a utility called
reposync which can be used to download the packages from the CDN. In order to download all packages from a specific channel, the system should be subscribed to that channel. If the system is not subscribed to the required channel then
reposync will not be able to download and sync those packages on local system.
createrepo-0.9.9-26.el6.noarchwhich is part of RHEL6.9GA has an issue regarding
--update, refer to bz1434369 for details.
- Learn more
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.