[Linux] : How to configure yum to use CentOS repository in RHEL machine

Updated on September 3, 2017

One of our Techglimpse reader “Clooney”, asked us whether it is possible to install packages from CentOS repository on a RHEL machine ? Sometimes you might want do that; For instance, you might have installed RHEL operating system, but you should have registered to Red Hat Network for using its repository. In such case, you will not be able to use yum and not all packages are easy to install from source (especially if the package has plenty of dependencies !). Thankfully, you can make CentOS repository on RHEL machines and then yum to resolve those dependencies automatically. Ok ! Here we go :

Configure YUM Repo in RHEL
Configure YUM Repo in RHEL

STEP 1 : When you run YUM, on a non-registered RHEL machine, you will end up in the below error (highlighted).

[root@catest ~]# yum install tkinter
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
No package tkinter available.
Nothing to do
[root@catest ~]#

Open ‘rhnplugin.conf’ file using your favorite text editor as shown below :

vim /etc/yum/pluginconf.d/rhnplugin.conf

Modify to look like below :

[main]
enabled = 0
gpgcheck = 0

[rhel-i386-server-5]
enabled = 0

And see the error message vanish !

[root@catest pluginconf.d]# yum install tkinter
Loaded plugins: security
Setting up Install Process
Parsing package install arguments
No package tkinter available.
Nothing to do
[root@catest ~]#

STEP 2 : Add CentOS repository, by creating this file using your favorite text editor :

[root@catest pluginconf.d]# vim /etc/yum.repos.d/centos.repo

Adding the following contents. [note: the ’5′ has to be hardcoded to either 5 or 6 depending on your RHEL version]

[centos]
name=CentOS $releasever - $basearch
baseurl=http://ftp.heanet.ie/pub/centos/5/os/$basearch/
enabled=1
gpgcheck=0

Once you’ve completed this step, you can now use “yum” to install packages :

[root@catest pluginconf.d]# yum install tkinter
Loaded plugins: security
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package tkinter.x86_64 0:2.4.3-56.el5 set to be updated
--> Processing Dependency: libTix8.4.so()(64bit) for package: tkinter
--> Running transaction check
---> Package tix.x86_64 1:8.4.0-11.fc6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
tkinter x86_64 2.4.3-56.el5 centos 282 k
Installing for dependencies:
tix x86_64 1:8.4.0-11.fc6 centos 333 k

Transaction Summary
================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 615 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): tkinter-2.4.3-56.el5.x86_64.rpm | 282 kB 00:01
(2/2): tix-8.4.0-11.fc6.x86_64.rpm | 333 kB 00:00
--------------------------------------------------------------------------------
Total 235 kB/s | 615 kB 00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : tix [1/2]
Installing : tkinter [2/2]

Installed: tkinter.x86_64 0:2.4.3-56.el5
Dependency Installed: tix.x86_64 1:8.4.0-11.fc6
Complete!

Was this article helpful?

Related Articles

Leave a Comment