Fast Oracle 12c Installation on Linux with RPMs (2/2)

IMG_0077

The first part of this article explains how to build an RPM that contains an Oracle Database 12c Release 1 Enterprise Edition and use it with Oracle Linux 6 x86_64 and “rpm --install“. You can easily adapt this method to your needs and build your own packages, with your release or edition. Poke me on my twitter to go further into the discussion and provide some feedback on the building scripts.

Nevertheless, once you’ve built an RPM, you’re only halfway there. If you want to deploy Oracle on Linux fast, you need to create your YUM repository and add the RPM to it. This is what you’ll find in this second part of the article.

An easy way to publish a YUM repository is with an HTTP server, like Apache HTTP server. In the case of Apache HTTP server, your directory should be accessible with the following options “Indexes FollowSymLinks Multiviews”. In the next sections of this article we will assume the YUM repository is provided by this kind of infrastructure and:

  • The server local directory is /var/www/html/yum/OracleSoftware/x86_64
  • It is accessible from http://yum.arkzoyd.com/OracleSoftware/x86_64; don’t try it, this URL doesn’t exist on the Web ;-)

Step 1 – Copying RPMs in your directory

 

As you can easily guess the 1st step of building a YUM repository consists in pushing the RPMs onto the YUM server directory. You can use the method of your choice to do this, including SCP as shown below:

ssh root@yum.arkoyd.com mkdir -p /var/www/html/yum/OracleSoftware/x86_64/getPackage
cd ~/rpmbuild/RPMS/x86_64/
scp *.rpm root@yum.arkoyd.com:/var/www/html/yum/OracleSoftware/x86_64/getPackage/.

Step 2 – Creating Metadata files

 

Once you’ve pushed the files, you need to create the index and metadata files so that YUM can find the right RPM easily. The createrepo command does the job for you:

ssh root@yum.arkoyd.com
yum install createrepo
cd /var/www/html/yum/OracleSoftware/x86_64/getPackage
createrepo .

Note:
That is indeed all you need to do to create a repository. For some odd reasons, the 167283.sh script provided as part of “How to Create a Local Yum Repository for Oracle Linux”[1] creates RPM headers. With the RPM version shipped with Oracle Linux 6, the metadata is enough and there is no more need to create those files.

Step 3 – Referencing the YUM repository in your server

 

Once the YUM repository created and indexed, it should be usable by any Oracle Linux 6 x86_64 servers that can access it. In order reference it, create a file name x.repo in /etc/yum.repos.d. This is an example of such a file on my server:

cat /etc/yum.repos.d/internal-oracle-ol6.repo
[ol64_oracle]
name=Oracle Software for $releasever ($basearch)
baseurl=http://yum.arkzoyd.com/OracleSoftware/$basearch/
gpgkey=http://yum.arkzoyd.com/RPM-GPG-KEY-arkzoyd-ol6
gpgcheck=1
enabled=1

Note:
If you did not sign your RPMs, set gpgcheck to 0.

Step 4- Searching RPMs and their metadata

 

You can check RPMs are accessible from your server with yum or repoquery:

yum info oracledb-ee-121010
Loaded plugins: security
Available Packages
Name        : oracledb-ee-121010
Arch        : x86_64
Version     : 0.8
Release     : 1.ol6
Size        : 2.4 G
Repo        : ol64_oracle
Summary     : Oracle Database 12.1.0.1 in a RPM
URL         : http://www.oracle.com
License     : Commercial
Description : Oracle Database 12.1.0.1 Enterprise Edition is Oracle Flagship Database    
            : Server. The release included in this RPM requires you have purchased the 
            : appropriate License from Oracle.

Step 5- Installing the Database Software

 

Once your software is referenced in the repository, you can easily install it as well as all the required packages and prerequisites with a one-line "yum install" command :

yum install oracledb-ee-121010
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracledb-ee-121010.x86_64 0:0.8-1.ol6 will be installed
--> Processing Dependency: oracle-rdbms-server-12cR1-preinstall for package: oracledb-ee-121010-0.8-1.ol6.x86_64
--> Running transaction check
---> Package oracle-rdbms-server-12cR1-preinstall.x86_64 0:1.0-8.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
=======================================================================================
 Package                                 Arch      Version        Repository      Size
=======================================================================================
Installing:
 oracledb-ee-121010                      x86_64    0.8-1.ol6      ol64_oracle    2.4 G
Installing for dependencies:
 oracle-rdbms-server-12cR1-preinstall    x86_64    1.0-8.el6      ol64_patch      15 k

Transaction Summary
=======================================================================================
Install       2 Package(s)

Total download size: 2.4 G
Installed size: 4.7 G
Is this ok [y/N]: y
Downloading Packages:
(1/2): oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64.rp |  15 kB     00:00     
(2/2): oracledb-ee-121010-0.8-1.ol6.x86_64.rpm                  | 2.4 GB     01:41     
---------------------------------------------------------------------------------------
Total                                                   17 MB/s | 2.4 GB     01:42     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64               1/2 
  Installing : oracledb-ee-121010-0.8-1.ol6.x86_64                                 2/2 
  Verifying  : oracledb-ee-121010-0.8-1.ol6.x86_64                                 1/2 
  Verifying  : oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64               2/2 

Installed:
  oracledb-ee-121010.x86_64 0:0.8-1.ol6                                                

Dependency Installed:
  oracle-rdbms-server-12cR1-preinstall.x86_64 0:1.0-8.el6

As you can see, installing a database software has never been as simple; to de-install the software, simply execute:

yum -y erase oracledb-ee-121010-0.8-1.ol6.x86_64
yum -y erase oracle-rdbms-server-12cR1-preinstall.x86_64
rm -rf /etc/oraInst.loc
rm -rf /u01/app

It Isn’t Really Over or Is it?

 

This method takes 1’30’ to 2’30’’ to Install a 12cR1 Database Software from the RPM on Oracle Linux 6, including the relink. Considering the file is about 2.5GB in size, you can easily guess you would better have a fast network between your servers and the YUM repository to optimize the installation time. That’s where proxies or YUM mirrors (see reposync[2] and Yum fastestmirror plugin[3]) might help you to move file as close as possible from the servers. The good news is that if you have a 1+ Gbps network, the download might take less than 1’ and your install time around 4’. Another benefit from using RPM is that it can easily be added to your standard images for virtual machines and physical servers with KickStart.

Obviously building RPM doesn’t address everything. You would also need to provision storage, create databases, back up, monitor, create users, grant privileges, manage upgrades, secure components or sites to mention a few. I’m afraid, those tasks are boring too! Though Oracle Linux and Oracle VM might help again; and this is another story…

Bibliography
[1] How to Create a Local Yum Repository for Oracle Linux
[2] reposync(1) – Linux man page
[3] yum-plugin-fastestmirror in Fedora Documentation
[4] Yellowdog Updater Modified Modified Web Site

Gregory Guillou

About Gregory Guillou

Gregory Guillou has written 766 post in this blog.

Senior Technical Architect at Easyteam

One thought on “Fast Oracle 12c Installation on Linux with RPMs (2/2)

  1. Pingback: #DB12c by Gregory Guillou : Fast Oracle 12c Install on Linux with RPMs (2/2) | Database Scene