There are many reasons you may want a local Red Hat Enterprise Linux or Centos repository. Bandwidth is a major factor as downloading updates from the Internet can be time and bandwidth consuming. Another reason may be that your servers are not connected to the Internet and thus need to get their updates from a local source. You may have a development environment that you would prefer to not spend money on licenses for but still need to update. Whatever your reason, this tutorial will walk you through the process of getting your local repository setup.

Firslty ,you have to install below packages.

yum install yum-utils createrepo httpd

mkdir /var/www/html/rhel7

reposync –gpgcheck -l –repoid=rhel-7-for-power-rpms –download_path=/var/www/html/rhel7 –downloadcomps –download-metadata

Once the packages have been downloaded all that is needed is the createrepo command below for each repo.

createrepo /var/www/html/rhel7/rhel-7-for-power-rpms

Its OK.For clients

vi /etc/yum.repos.d/ana.repo

name=Ana Red Hat Enterprise Linux $releasever – $basearch

Create Script and Cron Job to Update Your Repositories

On server,

vi /usr/local/bin/

echo Update script started at $(date) >> /var/log/updaterepo.log

reposync –gpgcheck -l –repoid=rhel-7-for-power-rpms –download_path=/var/www/html/rhel7 –downloadcomps –download-metadata

echo Update script ended at $(date) >> /var/log/updaterepo.log


chmod 600 /usr/local/bin/

Create a file in /etc/cron.d and name it updaterepo with the following content.

vi /etc/cron.d/updaterepo

@weekly root /usr/local/bin/