Sunday, January 29, 2012

Add new YUM repository Fedora

All the RPM (RedHat Package Manager) that are based linux (such as Fedora, CentOS, RHEL) use yum for software management. Yum always help you to install application through remote repository of rpms.

Yum Repository in Deeper Sense

If you want to tween yum, you can do so by editing /etc/yum.conf (I will explain the configuration next week). And by default, all the configuration of yum repository are located on /etc/yum.d and /etc/yum/repos.d dir. (defined by reposdir)

Installing RPM direct from the repo

If you know the location of an RPM on the web, you can install it by adding it’s remote repository (so RPM does not belong to any repository) just by:

        rpm -Uhv protocol://location-of-file-in-the-web

where U means upgrade; this will install the new version (if your rpm is the new version) and remove the old one.

v means verbose; this will print verbose information - error messages or warning

h means hash; this will print 50 hash marks as the package archive is unpacked.

protocol://location-of-file-in-the-web - this represent the location of your rpm to be installed on your local computer.

        rpm -Uhv http://origin-download.mono-project.com/download-stable/openSUSE_11.4/x86_64/glib-sharp2-2.12.10-27.11.x86_64.rpm

 

Installing 3rd party repository manually

Based on the example, Let’s say I wanted to add a repository where glibsharp2 is located. So first I will create a file on /etc/yum.repos.d named mono.repo (to make it more meaningful)

        cd /etc/yum.repos.d

        vi mon.repo

Then put:

        [mono]

name=mono

baseurl=http://origin-download.mono-project.com/download-stable/openSUSE_11.4/
enabled=1
gpgcheck=1
gpgkey=http://origin-download.mono-project.com/download-stable/openSUSE_11.4/repodata/repomd.xml.key

save and close it by pressing escape and :wq and enter.

where

[mono] - repository name

name=mono - repository name in more human readable string

baseurl=http://origin-download.mono-project.com/download-stable/openSUSE_11.4/ - the url of the repository, this location must include the content which is the repodata directory. This repodata contains all the information of the repo.

enabled=1 - means this repo is enabled, 0 if disabled.

gpgcheck=1 - security feature is enabled, 0 if disabled. This uses GPG key.

gpgkey=http://origin-download.mono-project.com/download-stable/openSUSE_11.4/repodata/repomd.xml.key - location of the gpg key of the repo

Sometimes you have to manually import the gpg key of the repository which is done by:

rpm --import http://origin-download.mono-project.com/download-stable/openSUSE_11.4/repodata/repomd.xml.key


If you need more information about rpm, yum and it’s configuration just:

man yum.conf

man yum

man rpm

Hope this can help you.. :)

2 comments: