Tuesday, July 9, 2013

How to avoid kernel-uek is needed by oracle-rdbms-server-12cR1-preinstall on CentOS while installing Oracle Database 12c release 1

So as you should know Oracle Database Server 12c release 1 is finally out there and this is my first post about it.
I've just finished to download some fundamental documents from Oracle website such as "2 Day DBA", "New Features Guide", "Concepts Guide", "Upgrade Guide", "Administrator's Guide" (1360 pages!!!), "Backup and Recovery User's Guide" (684 pages) and "Database Installation Guide for Linux".

I'm starting to read the "Database Installation Guide for Linux" guide, setting up a running virtual CentOS machine and, of course, preparing to install the new Oracle Database 12cR1:
I want to use the so useful rpm package provided by Oracle for automatically complete default operating system configurations. There are many options described on the documentation to configure your Oracle Linux distribution with Oracle RDBMS pre-install rpm... but you can find some difficulties while using a different release such as "RedHat like" distribution like that one I'm going to use: the latest CentOS 6.4 distribution.
Do not use the following instruction on a production environment because they won't be supported by Oracle guys: this post is only for testing purpose.

So open a terminal and use wget command to get the requested rpm package from Oracle public yum repository:
[root@localhost ~]$ wget http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64.rpm
--2013-07-04 10:15:03--  http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64.rpm
While installing the rpm package, it fails because some dependencies were not satisfied. I indeed installed the default minimal CentOS distribution.
[root@localhost ~] rpm -Uvh oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64.rpm 
warning: oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
 bind-utils is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 compat-libcap1 is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 compat-libstdc++-33 is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 gcc-c++ is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 kernel-uek is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 ksh is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 libaio is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 libaio-devel is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 libstdc++-devel is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 nfs-utils is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 smartmontools is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
 sysstat is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
Execute a yum install command with the previous missing packages and one of them would not be available from the public CentOS repository. Just try to guess which one...
[root@localhost database]# yum -y install compat-libcap1 compat-libstdc++-33 gcc-c++ kernel-uek ksh libaio libaio-devel libstdc++-devel nfs-utils smartmontools sysstats smartmontools
Indeed when you issue again the command to install Oracle RDBMS pre-install package it discovers kernel-uek is still needed: UEK stands for Unbreakable Enterprise Kernel.
[root@localhost ~]# rpm -Uvh oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64.rpm 
warning: oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
 kernel-uek is needed by oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64
I don't want to use a different kernel just to install a configuration package in a testing environment so why do not recompile that package instead and exclude that dependency ?
I loved to recompile packages when I studied at the university: it was time of Red Hat 4.0 and I should still have a CD-ROM to install it at home.
So the first things you must have are the packages to rebuild a rpm package.
[root@localhost ~]# yum -y install rpm-build rpmdevtools
To avoid a rpmbuild error you have to create also the same user Oracle used to compile its package. It was called "mockbuild". So simply create it using useradd command and then set a password for him.
[root@localhost ~]# useradd mockbuild -m -s /bin/bash
[root@localhost ~]# passwd mockbuild
Changing password for user mockbuild.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
Login with the new mockbuild user and download the rpm package containing all the source information that you have to modify.
[root@localhost ~]# su - mockbuild
[mockbuild@localhost ~]$ wget http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.src.rpm
--2013-07-04 10:39:37--  http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/x86_64/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.src.rpm
Resolving public-yum.oracle.com...
Connecting to public-yum.oracle.com||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13332 (13K) [application/x-rpm]
Saving to: “oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.src.rpm”

100%[=============================================================>] 13,332      44.7K/s   in 0.3s    

2013-07-04 10:39:37 (44.7 KB/s) - “oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.src.rpm” saved [13332/13332]
Under the home directory of the mockbuild user create the RPM build environment using rpmdev-setuptree:
[mockbuild@localhost ~]$ pwd
[mockbuild@localhost ~]$ rpmdev-setuptree 
[mockbuild@localhost ~]$ ll
total 20
-rw-rw-r--. 1 mockbuild mockbuild 13332 Apr 24 03:26 oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.src.rpm
drwxrwxr-x. 7 mockbuild mockbuild  4096 Jul  4 10:40 rpmbuild
[mockbuild@localhost ~]$ ll rpmbuild
total 20
drwxrwxr-x. 2 mockbuild mockbuild 4096 Jul  4 10:40 BUILD
drwxrwxr-x. 2 mockbuild mockbuild 4096 Jul  4 10:40 RPMS
drwxrwxr-x. 2 mockbuild mockbuild 4096 Jul  4 10:40 SOURCES
drwxrwxr-x. 2 mockbuild mockbuild 4096 Jul  4 10:40 SPECS
drwxrwxr-x. 2 mockbuild mockbuild 4096 Jul  4 10:40 SRPMS
Install the source rpm:
[mockbuild@localhost ~]$ rpm -ivh oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.src.rpm 
warning: oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.src.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
   1:oracle-rdbms-server-12c########################################### [100%]
Edit the oracle-rdbms-server-12cR1-preinstall.spec file removing the kernel-uek dependency (delete or comment that line)
[mockbuild@localhost ~]$ vi rpmbuild/SPECS/oracle-rdbms-server-12cR1-preinstall.spec 
#System requirement
Requires:procps module-init-tools ethtool initscripts
Requires:bc bind-utils nfs-utils util-linux-ng pam
Requires:xorg-x11-utils xorg-x11-xauth
Once you have removed the kernel-uek dependency you can rebuild the rpm issuing the following command:
[mockbuild@localhost ~]$ rpmbuild -ba rpmbuild/SPECS/oracle-rdbms-server-12cR1-preinstall.spec
warning: line 18: prereq is deprecated: PreReq:/etc/redhat-release
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.UzkCll
+ umask 022
+ cd /home/mockbuild/rpmbuild/BUILD
+ echo RPM_BUILD_ROOT=/home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386
+ cd /home/mockbuild/rpmbuild/BUILD
+ rm -rf oracle-rdbms-server-12cR1-preinstall-1.0
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /home/mockbuild/rpmbuild/SOURCES/oracle-rdbms-server-12cR1-preinstall-1.0.tar.gz
+ '[' 0 -ne 0 ']'
+ cd oracle-rdbms-server-12cR1-preinstall-1.0
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.FUjBhi
+ umask 022
+ cd /home/mockbuild/rpmbuild/BUILD
+ cd oracle-rdbms-server-12cR1-preinstall-1.0
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.Qq9rxf
+ umask 022
+ cd /home/mockbuild/rpmbuild/BUILD
+ cd oracle-rdbms-server-12cR1-preinstall-1.0
+ rm -rf /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386
+ mkdir -p -m 755 /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/etc/sysconfig/oracle-rdbms-server-12cR1-preinstall
+ mkdir -p -m 755 /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/usr/bin
+ mkdir -p -m 755 /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/etc/rc.d/init.d
+ mkdir -p -m 755 /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/etc/security/limits.d
+ mkdir -p -m 700 /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/var/log/oracle-rdbms-server-12cR1-preinstall/results
+ install -m 700 oracle-rdbms-server-12cR1-preinstall-verify /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/etc/sysconfig/oracle-rdbms-server-12cR1-preinstall
+ install -m 700 oracle-rdbms-server-12cR1-preinstall-verify /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/usr/bin
+ install -m 600 oracle-rdbms-server-12cR1-preinstall.param /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/etc/sysconfig/oracle-rdbms-server-12cR1-preinstall
+ install -m 700 oracle-rdbms-server-12cR1-preinstall-firstboot /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/etc/rc.d/init.d
+ touch /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/etc/security/limits.d/oracle-rdbms-server-12cR1-preinstall.conf
+ ln -f -s /etc/sysconfig/oracle-rdbms-server-12cR1-preinstall/oracle-rdbms-server-12cR1-preinstall-verify /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386/usr/bin/oracle-rdbms-server-12cR1-preinstall-verify
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-static-archive
+ /usr/lib/rpm/brp-strip-comment-note
Processing files: oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386
warning: File listed twice: /etc/sysconfig/oracle-rdbms-server-12cR1-preinstall/oracle-rdbms-server-12cR1-preinstall-verify
warning: File listed twice: /etc/sysconfig/oracle-rdbms-server-12cR1-preinstall/oracle-rdbms-server-12cR1-preinstall.param
Provides: config(oracle-rdbms-server-12cR1-preinstall) = 1.0-8.el6 oracle-rdbms-server-12cR1-preinstall = 1.0
Requires(interp): /bin/sh /bin/sh /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(VersionedDependencies) <= 3.0.3-1
Requires(pre): /bin/sh /etc/redhat-release
Requires(post): /bin/sh
Requires(preun): /bin/sh /etc/redhat-release
Requires(postun): /bin/sh
Requires: /bin/bash
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386
Wrote: /home/mockbuild/rpmbuild/SRPMS/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.src.rpm
Wrote: /home/mockbuild/rpmbuild/RPMS/i386/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.t2jJoi
+ umask 022
+ cd /home/mockbuild/rpmbuild/BUILD
+ cd oracle-rdbms-server-12cR1-preinstall-1.0
+ rm -rf /home/mockbuild/rpmbuild/BUILDROOT/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386
+ exit 0
Here is my new RPM file.
[mockbuild@localhost ~]$ ls rpmbuild/RPMS/i386/
Log out the mockbuild user and as root issue the yum localinstall command:
[mockbuild@localhost ~]$ exit
[root@localhost ~]# pwd
[root@localhost ~]# yum localinstall /home/mockbuild/rpmbuild/RPMS/i386/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386.rpm 
Loaded plugins: fastestmirror, refresh-packagekit
Setting up Local Package Process
Examining /home/mockbuild/rpmbuild/RPMS/i386/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386.rpm: oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386
Marking /home/mockbuild/rpmbuild/RPMS/i386/oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: centos.intergenia.de
 * extras: centos.copahost.com
 * updates: centos.bio.lmu.de
Resolving Dependencies
--> Running transaction check
---> Package oracle-rdbms-server-12cR1-preinstall.i386 0:1.0-8.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                     Arch Version   Repository                                            Size
                             i386 1.0-8.el6 /oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386  37 k

Transaction Summary
Install       1 Package(s)

Total size: 37 k
Installed size: 37 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386                                 1/1 
  Verifying  : oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.i386                                 1/1 

  oracle-rdbms-server-12cR1-preinstall.i386 0:1.0-8.el6                                                

The oracle-rdbms-server-12cR1-preinstall.i386 0:1.0-8.el6 rpm package is finally installed and I can see it creates a new user in my machine.
[root@localhost ~]# cd /home/
[root@localhost home]# ls
mockbuild  oracle

In the next post I will continue the installation of the Oracle Database 12c relase 1.

That's all.


Chauncey said...

This is cool!

Subair said...

Thanks for this.

I just tried this for 11gR2 in Cetnos 6.4 (64 bit) and it worked well.

Anonymous said...

Is there any reason not to just install the RHEL6 packages pulled in by the preinstall rpm? Does the Oracle installer require the preinstall rpm itself?

Anonymous said...

Does the Oracle installer require the preinstall rpm itself?


Anonymous said...

Why don't you install oracle Linux. Its free just like centos and you would have access uek kernels and anything else oracle database requires.

Anonymous said...

Thanks! it works for me.