Raymond's Blog

A simple technical blog to keep my findings

Create a local repository (with group options) on RHEL 6.5

This is an useful mini guide to create a RHEL local repository with package group support, the idea is to create a local repository in order to share it with other host on our local network principally for study cases or when we haven’t a Red Hat subscription or simply when we haven’t Internet access.

In addition to create a classic local repository we are going to setup the package group support which usually be a good tool to manage entire group of required packages for an specific propose or to cover a requirement.

i.e. Install the Desktop environment or X support for a system where they weren’t installed.


Pre-requisites

Mount CD/DVD media disk

# mount -o loop /dev/cdrom /mnt

Create your repository layout

 # mkdir -p /var/repo/rhel/6/u5/x86_64 

Copy the rpm files and go to the new packages directory

 # cp -a /mnt/Packages/*.rpm /var/repo/rhel/6/u5/x86_64/ 
 # cd /var/repo/rhel/6/u5/x86_64

Install the necessary packages

 # rpm -iUvh deltarpm-* python-deltarpm-* createrepo-* 

Create the repository

Now we are ready to create our new local repository.

 # createrepo . 

Enable group support

 # cp /mnt/repodata/*comps*.xml repodata/comps.xml 
# createrepo -g repodata/comps.xml . 

Setup your local repo file

Create a file called /etc/yum.repos.d/rhel65-local.repo and add the follow lines and save it:

 [rhel65_x64-local]
 name=RHEL 6.5 local repository
 baseurl=file:///var/repo/rhel/6/u5/x86_64
 enabled=1
 gpgcheck=0

Clean and recreate the yum db

 # yum clean all 
 # yum makecache 

Test it

 # yum list 
 # yum grouplist 
 # yum groupinstall "X Window System" Desktop -y 

Enjoy it!! :)

Questions??? Google is your friend! ;)