How to pack Oracle database’s binaries in a RPM file
This article describes how to create a RPM file with oracle’s binaries in it, in order to make easier the process of database installation.
Prerequisites
Install the packages rpmdevtools and rpm-build, these packages contains command line like rpmdev-setuptree and rpmbuild that will help to create the RPM structure
#yum install rpmdevtools rpm-build
The oracle database software must be installed on the machine
Generate the RPM structure
Inside the oracle’s home directory execute the command:
#rpmdev-setuptree
This command will create the following directory structure:
|-- rpmbuild |-- BUILD |-- RPMS |-- SOURCES |-- SPECS `-- SRPMS
RPM Contents SOURCES
The directory SOURCES must have a tar file with all files desired to be added in the RPM file
#tar -cvf oracle11.tar /home/oracle/.bash_profile /u01/app/oracle/product/11.2.0/rhdb/*
Configuration SPEC file
The directory SPEC is where the spec file with the instructions to create our RPM must be placed
One of the key parameter in this file is the “requires”, where a list of packages dependencies is configured.
Create a file called oracle11G.spec with the content bellow:
Name: oracle Version: 11 Release: 2%{?dist} Summary: Oracle 11G R2 Group: redhat License: GNU URL: http://www.redhat.com Source0: oracle11.tar #BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) Requires: binutils >= 2, glibc >= 2, nss-softokn-freebl >= 3, compat-libstdc++ >= 33, glibc-common >= 2, glibc-devel >= 2, glibc-headers >= 2, elfutils-libelf, elfutils-libelf-devel, gcc >= 4, gcc-c++ >= 4, ksh, libaio, libaio-devel, libgcc >= 4, libstdc++ >= 4, libstdc++-devel >= 4, make >= 3.81, numactl-devel >= 2, ld-linux.so.2()(32bit), sysstat >= 9 libfreebl3.so()(32bit), libc.so()(32bit), libaio.so.1()(32bit), libaio.so()(32bit), libgcc_s.so.1()(32bit), libstdc++.so.6()(32bit), libstdc++.so.5()(32bit) %description Oracle 11G R2 %build mkdir -p $RPM_BUILD_ROOT/home/oracle cp /home/oracle/.bash_profile $RPM_BUILD_ROOT/home/oracle mkdir -p $RPM_BUILD_ROOT/u01/app/oracle/product/11.2.0/rhdb/ cp -ra /u01/app/oracle/product/11.2.0/rhdb/* $RPM_BUILD_ROOT/u01/app/oracle/product/11.2.0/rhdb/ %pre groupadd oinstall groupadd dba useradd -g oinstall -G dba oracle echo redhat|passwd --stdin oracle %files /u01/* /home/* %post chown -R oracle:oinstall /u01 chmod -R 775 /u01 %changelog * Fri Sep 23 2011 Leandro Abite 1.0 - First version
Generating RPM file
The generation of the RPM file is made by the command rpmbuild passing the spec file as parameter
#rpmbuild -ba oracle11G.spec
if every thing is ok the rpm file should be created in the directory SRPMS
Requires