How to create yum repository in Redhat Linux ?

The Yellowdog Updater Modified (YUM) is an rpm package management opensource tool which is available for Redhat Linux  and other Linux flavors.In earlier days, its very difficult to install packages in Linux systems since it will ask for many dependencies.After yum introduction,its become very simple and yum has algorithm to select all the dependencies automatically once you configured the yum repository.

After reading this article you will get fair idea about installing yum packages,configuring yum repository  and installing  new packages using yum repo.

Install yum packages from Redhat Linux OS DVD. 

     # rpm -i deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm 
# rpm -i python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
# rpm -i createrepo-0.9.8-4.el6.noarch.rpm

Configuring  Yum repository.
       1.Create the Directories:
          mkdir -pv /home/repo/yum

       2. Copy the RPMs from the CDs/DVD to /home/repo/yum

       3.Create the base repository headers:
         createrepo -v /home/repo/yum

       4.Go to /etc/yum.repos.d and create file with any name 
          (i.e repo would be fine with .repo extension)

[root@localhost yum.repos.d]# cat myyum.repo

That’s all.We have successfully created the yum repository .

YUM configuration files





Testing our work:1
[root@mylinz ~]# yum clean all
Loaded plugins: refresh-packagekit, rhnplugin
Cleaning up Everything
[root@mylinz ~]# yum list |head
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Installed Packages
ConsoleKit.x86_64 0.4.1-3.el6 @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
ConsoleKit-libs.x86_64 0.4.1-3.el6 @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
ConsoleKit-x11.x86_64 0.4.1-3.el6 @local-installation
DeviceKit-power.x86_64 014-1.el6 @local-installation
GConf2.x86_64 2.28.0-6.el6 @local-installation
GConf2-devel.x86_64 2.28.0-6.el6 @local-installation
GConf2-gtk.x86_64 2.28.0-6.el6 @local-installation
MAKEDEV.x86_64 3.24-6.el6 @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
Now you can see yum commands started working and you can list available packages using the above command.

To find packages in yum,here i just searching for vnc server package.

[root@mylinz ~]# yum list |grep -i vnc
This system is not registered with RHN.
RHN support will be disabled.
gtk-vnc.i686 0.3.10-3.el6 local-installation
gtk-vnc.x86_64 0.3.10-3.el6 local-installation
gtk-vnc-python.x86_64 0.3.10-3.el6 local-installation
libvncserver.x86_64 0.9.7-4.el6 local-installation
tigervnc.x86_64 1.0.90-0.10.20100115svn3945.el6
tigervnc-server.x86_64 1.0.90-0.10.20100115svn3945.el6

To install specific package,

[root@mylinz ~]# yum install tigervnc-server.x86_64
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64 0:1.0.90-0.10.20100115svn3945.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository Size
tigervnc-server x86_64 1.0.90-0.10.20100115svn3945.el6 local-installation 1.0 M

Transaction Summary
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 1.0 M
Installed size: 2.8 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : tigervnc-server-1.0.90-0.10.20100115svn3945.el6.x86_64 1/1

tigervnc-server.x86_64 0:1.0.90-0.10.20100115svn3945.el6


We have completed the test successfully and yum is working fine.

Thank you for reading this article.Please leave a comment if you have any doubt.I will get back to you.


One comment

  1. Thanks for sharing such a nice article !

    We have created a local repository now. How to keep this repository “current” i.e. in-sync with the latest available packages on the web ?