HOWTO Set up a Yum repository for provisioning

HOWTO Set up a Yum repository for provisioning

From Consultancy.EdVoncken.NET

Jump to: navigation, search

Our provisioning server uses Cobbler and Koan for both bare-metal and virtual installations. During PostInstall, additional software may need to be installed. This is where a private Yum repository comes in handy.

Contents

Create the repository

Create directories on the Yum server

The Yum directory structure contains a $releasever/$basearch/ component. Create the subdirectories for Yum:

 cd /var/www/html
 mkdir -pv yum/el/{4,5,6}/{noarch,i386,x86_64}
 mkdir -pv yum/fedora/{14,15}/{noarch,i386,x86_64}

Add content to the repository

The EPEL (Extra Packages for Enterprise Linux) repository is managed by the Fedora team. It provides many useful packages that are missing from the standard RHEL / CentOS installations.

If we want to make this repository available to our clients, we can either set up a local Yum mirror or have each client download their own packages directly from EPEL. In the example below, clients will be configured to download their packages directly from EPEL.

 cd /var/www/html/yum/el
 wget -nd  http://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL
 wget -nd  http://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL-6
 
 cd /var/www/html/yum/el/4/noarch
 wget -nd http://download.fedora.redhat.com/pub/epel/4/x86_64/epel-release-4-10.noarch.rpm
 
 cd /var/www/html/yum/el/5/noarch
 wget -nd http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
 
 cd /var/www/html/yum/el/6/noarch
 wget -nd http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm

Create the repository index

 createrepo -s sha /var/www/html/yum/el/4
 createrepo -s sha /var/www/html/yum/el/5
 createrepo /var/www/html/yum/el/6

Integrate the repository with Cobbler

Define the repository in Cobbler

Assuming that our webserver is known as "provisioning.example.com", make the repository known to Cobbler as follows:

 cobbler repo add --name=el4-local --breed=yum --mirror=http://provisioning.example.com/yum/el/4/ --mirror-locally=no
 cobbler repo add --name=el5-local --breed=yum --mirror=http://provisioning.example.com/yum/el/5/ --mirror-locally=no
 cobbler repo add --name=el6-local --breed=yum --mirror=http://provisioning.example.com/yum/el/6/ --mirror-locally=no
 cobbler reposync

Attach the repository to a Cobbler profile

 cobbler profile edit --name=rhel56-server-i386 --repos=el5-local

Access the repository from the Yum clients

t.b.d.

Navigation