- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 5
- Red Hat Network (RHN)
- Red Hat Subscription Management (RHSM)
- 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, or 7 without using Satellite server
- Need to download all packages / rpms from specific channel locally
Red Hat provides a utility called
reposync which can be used to download the packages from RHN. 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.
Note: below steps will sync a repository locally just one time, please read this knowledge base completely for details on setting up a mirror which frequently pulls down the newest packages.
Example: If a Red Hat Enterprise Linux 6 system is subscribed to
reposync can sync the contents only from these 2 channels. If you try to sync contents from
rhel-6-server-optional-rpms or any other channels to which system is not subscribed then
reposync will not work.
Install the required packages
First install the "yum-utils" and "createrepo" packages on the system which is registered:
# yum install yum-utils createrepo
Create a basic local repository
NOTE: Please change the
--repoid=<repo-id> according to what repo id the system is currently using.
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. Inside there is all the packages.
# cd /var/www/html/<repo-id> # createrepo -v /var/www/html/<repo-id>
Create a local repository that allows clients to install groups and use the security plugin
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=channel-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 with as follows:
# cd /var/www/html/<channel-id> # createrepo -v /var/www/html/<channel-id>/ -g comps.xml
Then configure the repository on the client system which you want to update using this repository.
- Above commands sync one or multiple current repository or repositories. To keep the sync current, for example cronjobs can be used. The
--updateto efficiently update existing repositories. Please note that
createrepo-0.9.9-26.el6.noarchwhich is part of RHEL6.9GA has an issue regarding
--update, refer to bz1434369 for details.
- Above commands create a local copy of the repository. This 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).
reposyncutility will create the local mirror for the channel to which system is subscribed.
- For creating local security repositories the procedure to be followed is different, as the metadata for security rpms differs from that for regular rpms .
createrepowill not create the
updateinfo.xmlfile. Please visit this link for more information on how to create a local security repository. Note that the server which will act as a local security repository should be of the same RHEL version as the clients. (Example: if clients' version is RHEL6.6, server should also be RHEL 6.6).
- 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.