Appendix A - Create a Local Yum Repository

Introduction

What is Yum?

"Yum is an automatic updater and package installer/remover for rpm systems. It automatically computes dependencies and figures out what things should occur to install packages. It makes it easier to maintain groups of machines without having to manually update each one using rpm. Yum has a plugin interface for adding simple features. Yum can also be used from other python programs via its module inteface." - http://yum.baseurl.org/

Install createrepo

In order to create a local Yum repository you will need to install the createrepo package via Yum as follows:

yum install createrepo

Create Local Yum Repository

  1. Copy the RPMs that will be included in the repository to a shared directory, e.g. /mnt/rpms/;
  2. Run the createrepo command, e.g.:
createrepo /mnt/rpms

The createrepo application will generate a repodata directory underneath /mnt/rpms directory. Inside the directory you will find the following files:

  • filelists.xml.gz
  • other.xml.gz
  • primary.xml.gz
  • repomd.xml

At this point you can either access the Yum repo where it sits on the file system or you can move the contents of the directory (rpms and repodata) to another location that is accessible to Yum. The key is to create a .repo file (within /etc/yum.repos.d) that points to the location of the RPMs and repodata. The example below shows a .repo that points to to the /mnt/rpms directory for access to the repository on a local machine:

[ikanow]
name=Infinit.e Repository
baseurl=file:///mnt/rpms
gpgcheck=0

The following example is a repo file that points yum to a repository accessible via the web (note that the infinit.e-repos directory could be a virtual directory pointing to /mnt/rpms):

[ikanow]
name=Infinit.e Repository
baseurl=http://www.ikanow.com/infinit.e-install-repo
gpgcheck=0

.

Copyright © 2012 IKANOW, All Rights Reserved | Licensed under Creative Commons