User Tools

Site Tools


linux:redhat:repodata

Create a Local Repository

Create a RHEL/CentOS local yum repo from the OS disk

First you need to install the createrepo rpm

Creating a local yum repository from the OS installer disk(s) (CD/DVD) can be useful in many situations where the machine doesn’t have Internet access to install additional packages. While the installer disk can still be used after the initial OS installation, it is more convenient to use a local repository especially if more than one machine need access to the packages.

mkdir -p /opt/yum/rhel6/repodata

cp -a /media/Redhat-DVD/Packages/*.rpm /opt/yum/rhel6

copy the main xml file from main repodata folder to the new repo path:

cp /mnt/cd/repodata/*comps*.xml /opt/yum/rhel6.3/repodata/comps.xml

Note: This is not necessarily needed, but it is useful if you want to use yum to query / install package groups (e.g. yum grouplist).

generate local repository files

cd /opt/yum/rhel6/
createrepo -g repodata/comps.xml .

Create new yum repository (e.g. rhel-local.repo)

nano /etc/yum.repos.d/rhel-local.repo
[rhel6-local]
name=RHEL 6 local repository
baseurl=file:///opt/yum/rhel6/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1

Thats it you should now be able to use YUM

linux/redhat/repodata.txt · Last modified: by 127.0.0.1