Prerequisites
Install the packages rpmdevtools and rpm-build, these packages contain 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 --> Stage your zip/tar files |-- SPECS `-- SRPMS
RPM Contents SOURCES
Once you Install Oracle Software into required directory structure and you need to that software files and add into SOURCES directory
tar -czvf oracle18.tar /export/home/oracle/.bash_profile /export/home/oracle/.profile /u01/app/oracle/product/18c/*
[root@dbadeeds rpmbuild]# pwd
/root/rpmbuild
[root@dbadeeds rpmbuild]# ls -ltr
total 0
drwxr-xr-x. 2 root root 6 Jun 6 13:41 SRPMS
drwxr-xr-x. 2 root root 6 Jun 6 13:41 BUILD
drwxr-xr-x. 2 root root 27 Jun 6 15:19 SPECS
drwxr-xr-x. 2 root root 25 Jun 6 15:22 SOURCES
drwxr-xr-x. 3 root root 19 Jun 6 15:24 RPMS
drwxr-xr-x. 2 root root 6 Jun 6 15:30 BUILDROOT
Configuration SPEC file
Now configure the SPEC file in SPEC directory. you add pre/post-installation steps as required here is my SPEC!
Configuration SPEC file
Name: DBADEEDS_oracle
Version: 18
Release: 2%{?dist}
Summary: Oracle 18c R2
Group: redhat
License: GNU
URL: https://www.dbadeeds.wordpress.com
Source0: oracle18.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,
%description
Oracle 18c R2
%build
mkdir -p $RPM_BUILD_ROOT/export/home/oracle
cp /export/home/oracle/.bash_profile $RPM_BUILD_ROOT/export/home/oracle
cp /export/home/oracle/.profile $RPM_BUILD_ROOT/export/home/oracle
mkdir -p $RPM_BUILD_ROOT/u01/app/
cp -ra /u01/app/* $RPM_BUILD_ROOT/u01/app/
%pre
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
%files
/u01/*
/export/home/*
%post
chown -R oracle:oinstall /u01
chmod -R 775 /u01
%changelog
* Thr June 6 2019 Sandeep Reddy Narani 1.0
- First version
Build your RPM
rpmbuild -bb -v SPECS/oracle18c.spec
Building the RPM Package
rpmbuild -bb -v SPECS/oracle18c.spec
The file will be generated in [root@dbadeeds x86_64]# pwd /root/rpmbuild/RPMS/x86_64 [root@dbadeeds x86_64]# ls oracle-18-2.el7.x86_64.rpm
Testing the RPM File on Application Server
[root@dbadeedsap04 ]# rpm --nodeps --nopre -ivh oracle-18-2.el7.x86_64.rpm Preparing... ########################################### [100%] 1:oracle ########################################### [100%] since my appplication already exists pre-installation steps like [oracle user & oracle dependenices] so I have skipped it. [root@cdcapdev04 ]# exit logout dbadeedsap04:/u01/app/oracle/product/18c/clhome_1 oracle:ora18c $ tnsping DBAD TNS Ping Utility for Linux: Version 18.0.0.0.0 - Production on 06-JUN-2019 15:35:53 Copyright (c) 1997, 2018, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/18c/clhome_1/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbadeedsdb)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DBAD))) OK (10 msec) dbadeedsap04:/u01/app/oracle/product/18c/clhome_1 oracle:ora18c $ sqlplus user/pwd@DBAD SQL*Plus: Release 18.0.0.0.0 - Production on Thu Jun 6 15:36:16 2019 Version 18.3.0.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Last Successful login time: Mon Jun 03 2019 16:42:24 -05:00 Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options
Leave a comment