Search This Blog

2015-04-29

Create Redhat Syncronized Repo with Reposync

Prerequisites

  • Server registered with the appropriate version of RedHat
  • HTTP/FTP server to host repo files

Instructions

Install required components for managing yum repositories and createrepo utility for building new repo indexes.

yum install yum-utils createrepo


Register with RedHat to gain access to their repos

rhn_register

OR

subscription-manager register --username $username --password $password --auto-attach


Repos will be populated automatically upon registration and you can then list them using:

subscription-manager repos --list


Download the repos to a path of your chosing

reposync --gpgcheck -l --repoid=$repoid --download_path=$path


Create the repo against the directory where your rpm packages exist

cd $path
createrepo $path


Enable the local repo

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

[rhel-repo]
name=Red Hat Enterprise Linux 7 - x86_64
baseurl=http://$server/$path
enabled=1
gpgcheck=0


Ensure the repo works, this will likely build the index at the same time. I've seen elsewhere where cache is refreshed using yum makecache but I haven't run into a scenario where I have to do that yet.

yum repolist


References:
https://access.redhat.com/solutions/23016
http://kb.kristianreese.com/?View=entry&EntryID=77

No comments:

Post a Comment