Wednesday, January 6, 2016

How to modify the preinstall rpm for non-OEL

Oracle Enterprise Linux (OEL) is a wonderful thing.  Oracle does a lot of work to streamline and perfect the Redhat OS to work efficiently.  Customer Support is extremely competitive relative to support directly from RH too.  Unfortunately, asking a company to switch OS vendors is a little like asking somebody to switch religions.  Most companies would rather be burned at the stake and become saints than switch from Linux to MS or MS to Linux or even RH to Centos or OEL.  This prevents Oracle's database customers from taking advantage of some of the features available in OEL.

If you read the database install documents (and you should), they don't cover everything...there are a lot of best practices left out re:configuring your server.  Some of it was discovered as bugs after the install documentation was published.  The Oracheck utility is updated ~quarterly...and has the most recent best practices over and above the installation documents. The idea is that, after an install...you run oracheck and it points out anything in your configuration that differs from the current best practices.  This is great...but there's an even better way....

One of the features OEL offers is the "Oracle Validate RPM", now called the preinstall RPM.  This is the latest, greatest set of system configuration settings and prerequisites from Oracle, but it requires OEL.  If you're forced to use RH or Centos, how can you use this RPM?  You can get the open source RPM from Oracle's YUM site and modify it.  When you're done, you're be able to very quickly set up a RH server for Oracle.  If you run POC's for the Oracle database where you need to install the OS over and over, this can really speed things along.  After you modify it, you can add it to your local yum repository.  After a minimal install of RH, you just have to say "yum install my_new_rpm" and it'll set up all the prerequisites and system configurations for Oracle in a few seconds.

NOTE:  If you already have a preinstall RPM for your distro, you can proceed to step 21.  If you don’t, and you’re not running OEL (ie, you use Centos or RH) start at step 1.

1. Depending on your version, you either need to edit the existing or create a new repo file with the information below (change this to match your OS version...this is for 7:

1.      vi /etc/yum.repos.d/public-yum-ol7.repo
[ol7_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=0

enabled=1

2. yum install wget


3. yum install yum-utils

4. yum install rpm-build

5. cd ~

6. mkdir src

7. cd src

8. yumdownloader --source oracle-rdbms-server-12cR1-preinstall

9.  Unpack the rpm into .spec and .tar.gz:
rpm2cpio oracle-rdbms-server-12cR1-preinstall-1.0-4.el7.src.rpm | cpio –idmv

10. vi oracle-rdbms-server-12cR1-preinstall.spec

11. In vi, search for Requires:kernel-uek (and anything else that looks suspiciously OEL-specific) and
            comment it:
      Requires:kernel-uek
      Becomes:
      #Requires:kernel-uek

12. tar xvzf oracle-rdbms-server-12cR1-preinstall-1.0.tar.gz

13.  vi oracle-rdbms-server-12cR1-preinstall-1.0/oracle-rdbms-server-12cR1-preinstall-verify

14. Search in the file for USERID and GROUPID and change them to the userid of the oracle OS user and the oinstall group at your company. ie:
USERID="5061"
GROUPID="5011"

15. Optionally, vi oracle-rdbms-server-12cR1-preinstall-1.0/oracle-rdbms-server-12cR1-preinstall.param and change parameters as needed.

16. mv oracle-rdbms-server-12cR1-preinstall-1.0.tar.gz oracle-rdbms-server-12cR1-preinstall-1.0.tar.gz.old

17. tar -zcvf oracle-rdbms-server-12cR1-preinstall-1.0.tar.gz oracle-rdbms-server-12cR1-preinstall-1.0/oracle-rdbms-server-12cR1-preinstall-verify oracle-rdbms-server-12cR1-preinstall-1.0/oracle-rdbms-server-12cR1-preinstall-firstboot oracle-rdbms-server-12cR1-preinstall-1.0/oracle-rdbms-server-12cR1-preinstall.param

18. mkdir -p /root/rpmbuild/SOURCES
cp oracle-rdbms-server-12cR1-preinstall-1.0.tar.gz /root/rpmbuild/SOURCES/oracle-rdbms-server-12cR1-preinstall-1.0.tar.gz

19. rpmbuild -ba oracle-rdbms-server-12cR1-preinstall.spec
…look for “+ exit 0” at the last line.

20. ls ~/rpmbuild/RPMS/x86_64/oracle-rdbms-server-12cR1-preinstall*
[root@rhel7 src]# ls ~/rpmbuild/RPMS/x86_64/oracle-rdbms-server-12cR1-preinstall*
/root/rpmbuild/RPMS/x86_64/oracle-rdbms-server-12cR1-preinstall-1.0-4.el7.x86_64.rpm
/root/rpmbuild/RPMS/x86_64/oracle-rdbms-server-12cR1-preinstall-debuginfo-1.0-4.el7.x86_64.rpm

21.  At this point, you have an RPM and you’re ready to go.  If you can, add the new RPM to your repository and just do a yum install.  ...if you don't have your own yum repository, you can do it manually:


rpm -ivh /root/rpmbuild/RPMS/x86_64/oracle-rdbms-server-12cR1-preinstall-1.0-4.el7.x86_64.rpm
(You’ll likely get output of missing rpm’s.  Use yum to install everything missing.)

22.  yum install [each item listed above]
  You can install multiple at once, just add a space between them.

23. After the prereq's are installed...add the new RPM:
1.      rpm -ivh /root/rpmbuild/RPMS/x86_64/oracle-rdbms-server-12cR1-preinstall-1.0-4.el7.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracle-rdbms-server-12cR1-preinst################################# [100%]

24. At this point, you’re ready to install Oracle 12c. J


No comments:

Post a Comment