Softpanorama

Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
May the source be with you, but remember the KISS principle ;-)
Bigger doesn't imply better. Bigger often is a sign of obesity, of lost control, of overcomplexity, of cancerous cells

How to add a new yum repository

News YUM Recommended Links Reference Yum's repository system How to add a new yum repository Proxy configuration
EPEL repository How to Enable EPEL Repository Yum Plugins How to download RPMs with yum Download Dependencies for a RPM Red Hat RPM hell
Smart Pirut Yast Horror Stories Unix History Humor Etc

Road to hell is paved with good intentions. This saying is fully applicable to RHEL repositories.

From Fedora project 4.3.5. Adding, Enabling, and Disabling a Yum Repository Section 4.3.2, “Setting [repository] Options” described various options you can use to define a Yum repository. This section explains how to add, enable, and disable a repository by using the yum-config-manager command.

Adding a Yum Repository

To define a new repository, you can either add a [repository] section to the /etc/yum.conf file, or to a .repo file in the /etc/yum.repos.d/ directory.

All files with the .repo file extension in this directory are read by yum, and best practice is to define your repositories here instead of in /etc/yum.conf.

To add such a repository to your system and enable it, you need to use the command yum-config-manager as root

NOTE: If EPEL is registered on some other system, you can copy relevant files directly into /etc/yum.repos.d. See also How to Enable EPEL Repository

Yum repositories commonly provide their own .repo file. :

To add a repository you need to use the command yum-config-manager --add-repo repository_url

For example

# yum-config-manager --add-repo http://www.example.com/example.repo
Loaded plugins: langpacks, presto, refresh-packagekit
adding repo from: http://www.example.com/example.repo
grabbing file http://www.example.com/example.repo to /etc/yum.repos.d/example.repo
example.repo                                             |  413 B     00:00
repo saved to /etc/yum.repos.d/example.repo

Sometimes repositories prevent patching (this is often the  case with R rpms installed from EPEL) you can simply disable them via command

yum-config-manager --disable repository...

 and after patching is done reenable

yum-config-manager --enable repository...

You can always check the results with the command

Be careful when using untrusted software sources

Obtaining and installing software packages from unverified or untrusted software sources constitutes a potential security risk, and could lead to security, stability, compatibility maintainability issues.

yum-config-manager --add-repo repository_url
…where repository_url is a link to the .repo file. For example, to add a repository located at http://www.example.com/example.repo, type the following at a shell prompt:
# yum-config-manager --add-repo http://www.example.com/example.repo
Loaded plugins: langpacks, presto, refresh-packagekit
adding repo from: http://www.example.com/example.repo
grabbing file http://www.example.com/example.repo to /etc/yum.repos.d/example.repo
example.repo                                             |  413 B     00:00
repo saved to /etc/yum.repos.d/example.repo

Enabling a Yum Repository

To enable a particular repository or repositories, type the following at a shell prompt as root:
yum-config-manager --enable repository
…where repository is the unique repository ID (use yum repolist all to list available repository IDs). Alternatively, you can use a glob expression to enable all matching repositories:
yum-config-manager --enable glob_expression
For example, to disable repositories defined in the [example], [example-debuginfo], and [example-source]sections, type:
~]# yum-config-manager --enable example\*
Loaded plugins: langpacks, presto, refresh-packagekit
============================== repo: example ==============================
[example]
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/6Server
baseurl = http://www.example.com/repo/6Server/x86_64/
cache = 0
cachedir = /var/cache/yum/x86_64/6Server/example
[output truncated]
When successful, the yum-config-manager --enable command displays the current repository configuration.

Disabling a Yum Repository

To disable a Yum repository, run the following command as root:
yum-config-manager --disable repository
…where repository is the unique repository ID (use yum repolist all to list available repository IDs). Similarly to yum-config-manager --enable, you can use a glob expression to disable all matching repositories at the same time:
yum-config-manager --disable glob_expression
When successful, the yum-config-manager --disable command displays the current configuration.
Top updates

Bulletin Latest Past week Past month
Google Search


NEWS CONTENTS

Old News ;-)

Howto Add a new yum repository to install software under CentOS - Redhat Linux - nixCraft

July 18, 2007 | NIX Craft | 12 comments

Understanding yum repository

yum repository configured using /etc/yum.conf file. Additional configuration files are also read from the directories set by the reposdir option (default is /etc/yum.repos.d and /etc/yum/repos.d.

RPMforge repository

Usually repository carries extra and useful packages. RPMforge is one of such repository. You can easily configure RPMforge repository for RHEL5 just by running following single RPM command:
# rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
For 64 bit RHEL 5 Linux, enter:
# rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Now you can install software from RPMforge.

How do I install 3rd party repository manually?

Let us say you would like to install 3rd party repository from foo.nixcraft.com. Create a file called foo:
# cd /etc/yum.repos.d
# vi foo

Append following code:
[foo]
name=Foo for RHEL/ CentOS $releasever - $basearch
baseurl=http://foo.nixcraft.com/centos/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://foo.nixcraft.com/RPM-GPG-KEY.txt

Save and close the file.

Where,

Also you need to import the gpg key for the repository as follows:
# rpm --import http://foo.nixcraft.com/RPM-GPG-KEY.txt

Now you are ready to install software from foo repository. For further information refer to yum.conf man page:
$ man yum.conf
$ man yum

Hope this tip will help you to configure repository as and when required.

See also:

Howto Setup yum repositories to update or install package from ISO CDROM Image

How to Add the RPMforge Repository in RHEL/CentOS 5/6

RPMforge is a third party RPM repository for Red Hat Enterprise Linux or CentOS. Adding the RPMforge repository will give you access to an extensive library of precompiled binaries. This article describes how to add the RPMforge repository in Red Hat Enterprise Linux or CentOS 5 or 6.

Adding RPMforge to Yum

The rpmforge repo package can be downloaded from the site below.

1. Launch Firefox and go to http://dag.wieers.com/rpm/FAQ.php#B2. Click on the package appropriate for your version of Red Hat Enterprise Linux or CentOS.

2. Choose Open with Software Installer (default) and click Ok.

3. The Installing packages window will appear. Click Apply to proceed.

4. Finally click Ok.

Lowering the RPMforge priority

Lowering the priority of the RPMforge repository will ensure that the base packages provided by RHEL/CentOS will not be replaced by a newer version from RPMforge.

1. Install the Yum priorities package using the command below.
yum install yum-priorities
2. Edit the file /etc/yum.repos.d/rpmforge.repo and add the line below.
priority=10
3. Test your configuration using the command below. You should see a priority protections message in the output.
yum check-update

Visit the forum to ask for help or to give a comment.

***
Posted on 6/12/2009 and last updated on 8/8/2011
Filed under CentOS 5 , CentOS 6 , Red Hat Enterprise Linux 5 , Red Hat Enterprise Linux 6 , System Administration