Creating Your own Yum Repository

YUM or Yellowdog Updater Modified is an interactive, automated update program which can be used for maintaining system using rpm. 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.
Yum makes it easier to maintain groups of machines without having to manually update each one using rpm.

What is a Repository ?
A repository is a collection of list of rpm[s]. It contain various information regarding the rpm like its dependencies etc.

Why to use Yum if I can install RPM using rpm command?
Well if you want to install RPM you have to make sure that its dependencies are also installed . But this is not in the case of YUM you can simply install package with its dependencies. YUM take care of your all install things . Also update feature is not available in the rpm installation method but it is available in yum.

Here are some key features of “Yum”:
• Multiple Repositories
• Simple config file
• Correct dependency calculation
• Fast operation
• rpm-consistent behavior
• comps.xml group support, including multiple repository groups
• Simple interface

Starting With Creating Your Own Repository [Server Side Configuration]

Step First : Check Prequisites
-Have Your Distro CD/DVD

-Check if you have free space on your Hard Disk or not [Total space required vary from Distro to Distro]

Step Two : Copy Disc to Hard Disk
First mount your CD/DVD and copy it to hard disk
cp -avr /cd/dvd/mount/point/ /destination/directory/

Step Three : Intalling CreateRepo Package
Now go to your directory where you copied the files and search for createrepo-*.rpm file * may be different from version to version and system architecture
Install that rpm using rpm command
install using following command
rpm -ivh –aid createrepo-*.rpm

Repeat this step with your all you cd .
Note:- If you want install Repository on your network thrugh ftp or http upload in their respective default directories i.e /var/ftp/pub for ftp server and /var/www/html for http server.

Step four: Run createrepo
Go to the directory where you copied the file and run the createrepo command
createrepo -v .
[please note that “.” {dot} after that command as we are in present directory ]

Now you have done all thing.
Now we will see Client side setting

Client Side Setting For YUM

Create a repo file in /etc/yum.repos.d/ directory [ you can name anything to ur file make sure a .repo extension is added later on]
vim /etc/yum.repos.d/my.repo

add following date in that file

[Myrepo]
name=Any name you want to put
baseurl=file:///destination/directory/
enabled=1
gpgcheck=0

The first line is alias given for your repository . This help to indicate/find that from which repository the package is available.
Second line is name which you can put any thing
Next comes baseurl
base url supports different protocols like file:// ftp:// httpd:// etc. if you are running repository from local pc then give absolute path after file:// . for ftp give ftp://server_ip_or_domain/pub_dir_or_accessable_dir or http://server_ip_or_domain/dir
next line is enabled this specify if yum should enable that repo server for installtion or not 1 is for enable and 0 is for disable
gpgcheck is for checking gpg key. as I don’t required it so I disabled it if you enabled it then you hav to add one more line after that
gpgkey=/your/path/to/key

after this save that repo file and run following command
yum clean all [ will clean yum database ]
yum list [will list the files / packages available on that directory ]

If you find some difficulty in using it please feel free to contact us

Note:- SElinux or Firewall may conflict sometimes [ for ftp and http service ]
Note:- I used RHEL server 5 edition . This process is same for RHEL 4,5 FC [versions I don’t know]

By | 2018-04-09T06:43:26+00:00 June 13th, 2008|Editorial, Featured Post, Information, Script, Tips, Tutorials|4 Comments

About the Author: