Monday, December 24, 2012

Setting up Oracle Linux 5 with public-yum

Download yum repo file from oracle public yum.

Login as root and run below commands:
cd /etc/yum.repos.d/
wget http://public-yum.oracle.com/public-yum-el5.repo

You will see messages like: 

Saving to: `public-yum-el5.repo'
100%[======================================>] 3,974       --.-K/s   in 0.001s 
2012-12-23 23:14:53 (5.44 MB/s) - `public-yum-el5.repo' saved [3974/3974]

Now run yum command like "yum repolist" to ensure yum setup is working fine.

#yum repolist
file://localhost/tmp/common1/x86_64/redhat/50/base/ga/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: '/tmp/common1/x86_64/redhat/50/base/ga/Server/repodata/repomd.xml'
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again


The reason for this error is an invalid baseurl in "/etc/yum.conf"
"baseurl" in /etc/yum.conf looks like

[base]
name=Red Hat Linux - Base
baseurl=file://localhost/tmp/common1/x86_64/redhat/50/base/ga/Server
 
Need to replace baseurl to the remote yum repository location present in "/etc/yum.repos.d/public-yum-el5.repo". This file has sections for all

Check for OS version and update

cat /etc/redhat-release

 Red Hat Enterprise Linux Server release 5.6 (Tikanga)


 Check the section for OEL 5 update 6 in /etc/yum.repos.d/public-yum-el5.repo

  [ol5_u6_base] is the corresponding section and the baseurl looks like

"baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/6/base/$basearch/"

access the above url in browser and you will see two folders "i386" and "x86_64".
replace  $basearch with "x86_64" it you are using 64 bit OS

edit /etc/yum.conf and change base url to

 baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/6/base/x86_64/  
Now run "yum repolist" again

#yum repolist
base                                                                                                     | 1.1 kB     00:00     
base/primary                                                                                             | 1.5 MB     00:00     
base                                                                                                                  4551/4551
el5_latest                                                                                               | 1.4 kB     00:00     
el5_latest/primary                                                                                       |  12 MB     00:06     
el5_latest                                                                                                            9867/9867
ol5_u6_base                                                                                              | 1.1 kB     00:00     
ol5_u6_base/primary                                                                                      | 1.5 MB     00:00     
ol5_u6_base                                                                                                           4551/4551
repo id                           repo name                                                                       status
base                              Red Hat Linux - Base                                                            enabled: 4,551
el5_latest                        Oracle Linux 5 Latest (x86_64)                                                  enabled: 9,867
ol5_u6_base                       Oracle Linux 5 Update 6 installation media copy (x86_64)                        enabled: 4,551
repolist: 18,969


7 comments:

Jayachanthar said...

useful information. Thank you.

Jayachanthar said...

This is a very useful info. Thank you Rajiv.

Unknown said...

This post was very helpful !! Thanks !

Unknown said...

Very useful !! Thanks a lot !

Unknown said...

This post was very helpful !! Thanks !

Swati said...
This comment has been removed by the author.
Gustavo Barizon said...

Awesome!

Thanks for sharing!