Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts

Monday, December 24, 2012

Install VirtualBox on Oracle Linux 5

Download latest version from http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html

Install rpm 


rpm -ivh VirtualBox-4.2-4.2.6_82870_el5-1.x86_64.rpm
warning: VirtualBox-4.2-4.2.6_82870_el5-1.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID 98ab5139
Preparing...                ########################################### [100%]
   1:VirtualBox-4.2         ########################################### [100%]

Creating group 'vboxusers'. VM users must be member of that group!

No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.

Stopping VirtualBox kernel modules [  OK  ]
Recompiling VirtualBox kernel modules [FAILED]
  (Look at /var/log/vbox-install.log to find out what went wrong)

Installation of VirtualBox is partially complete.
Lets look at vbox-install log.
cat  /var/log/vbox-install.log
Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again.  Stop.

Basically recompiling kernel to include vboxdrv kernel module failed. 
Because its not able to locate kernel headers.
Run rpm command again and it shows that virtualbox is already installed, even though the
vboxdrv kernel module is not loaded.


 rpm -ivh VirtualBox-4.2-4.2.6_82870_el5-1.x86_64.rpm
warning: VirtualBox-4.2-4.2.6_82870_el5-1.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID 98ab5139
Preparing...                ########################################### [100%]
        package VirtualBox-4.2-4.2.6_82870_el5-1.x86_64 is already installed



To install the kernel module  run "sudo /etc/init.d/vboxdrv setup"
#sudo /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel modules                         [  OK  ]
Recompiling VirtualBox kernel modules                      [FAILED]
  (Look at /var/log/vbox-install.log to find out what went wrong)
[root@slc03dml downloads]# cat /var/log/vbox-install.log
Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again.  Stop.
Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again.  Stop. 

 Tried below commmand to install kernel headers


#yum install kernel-headers-`uname -r`
base                                                                                                     | 1.1 kB     00:00   
el5_latest                                                                                               | 1.4 kB     00:00   
ol5_u6_base                                                                                              | 1.1 kB     00:00   
Setting up Install Process
No package kernel-headers-2.6.18-238.0.0.0.1.el5xen available.
Nothing to do
/usr/include/asm-generic/fcntl.h from install of
kernel-headers-2.6.18-308.24.1.0.1.el5.x86_64 conflicts with file from package kernel-uek-headers-2.6.32-100.26.2.el5.x86_64

....similar error messages...
Installation of kernel headers fails as kernel-uek-headers is already installed.
List the kernel-uek packages using "yum list kernel-euk"

#yum list kernel-uek
base                                                                                                     | 1.1 kB     00:00   
el5_latest                                                                                               | 1.4 kB     00:00   
ol5_u6_base                                                                                              | 1.1 kB     00:00   
Installed Packages
kernel-uek.x86_64                                       2.6.32-100.26.2.el5                                           installed
Available Packages
kernel-uek.x86_64                                       2.6.32-300.39.2.el5uek                                        el5_latest

Remove kernel-uek headers using " rpm -ev --nodeps kernel-uek-headers"

 # rpm -ev --nodeps kernel-uek-headers
Now install kernel-headers 
#yum install kernel-headers
base                                                                                                     | 1.1 kB     00:00   
ol5_u6_base                                                                                              | 1.1 kB     00:00   
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-headers.x86_64 0:2.6.18-238.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved
================================================================================================================================
 Package                           Arch                      Version                              Repository               Size
================================================================================================================================
Installing:
 kernel-headers                    x86_64                    2.6.18-238.el5                       base                    1.2 M

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

Total size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test

 Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : kernel-headers                                                                                           1/1

Installed:
  kernel-headers.x86_64 0:2.6.18-238.el5                                                                                        

Complete!

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