Configuring a YUM Repository from a Linux install disc

In this post, we will explore how to set up a YUM repository using the RPMs available on the Linux install media.

There are already a great number of good blogs on setting up YUM repositories so this is nothing especially new. But every time I install Oracle I find I have to track down one or two that cover what I need, so this is my brain dump on how to do it.

About YUM.

On Linux, before you can install the Oracle database, you always have to install a series of additional RPM packages that Oracle requires.

Even with Oracle Enterprise Linux, which includes a Database install configuration option, the additional RPMs are not loaded.

Loading additional RPMs is straightforward in of itself, the Linux rpm command is used to load the additional package. But many packages require additional packages of their own, leading to a frustrating dependency-hell situation.

The Linux YUM (Yellowdog Updater, Modified) exists to simplify this situation, by automating the identification and resolution of dependent packages.

That’s great, but YUM requires a repository to locate the RPM packages.

Some releases of Linux require a paid subscription to access the default YUM repository. Others are configured to use freely available ones. Knowing if the repository is trust-worthy is one problem, another is having network access to any repository. In some organizations, network access is forbidden or limited, and that issue alone can takes days to resolve, or an act of Congress in the case of EMC.

All of this is doubly frustrating as usually all of the RPMs needed by Oracle are already located on the Linux install media.

So in this example, we are going to configure a CentOS 6.4 system to use an optional YUM repository on the local install media.

With the install media mounted, we should be able to see the /media directory.

[root@localhost ]# ls /media/CentOS_6.4_Final/
CentOS_BuildTag  isolinux                  RPM-GPG-KEY-CentOS-Debug-6
EFI              Packages                  RPM-GPG-KEY-CentOS-Security-6
EULA             RELEASE-NOTES-en-US.html  RPM-GPG-KEY-CentOS-Testing-6
GPL              repodata                  TRANS.TBL
images           RPM-GPG-KEY-CentOS-6

 

Make a note of the GPG-KEY file. We will need this in a moment. In this case the key file is RPM-GPG-KEY-CentOS-6

To create a YUM repository, we need to add a repo file to the directory /etc/yum.repos.d

We will call this optional repository, or repo, dvd, as it is located on the install DVD media. You can choose any name you feel is appropriate.

The file we create will be called dvd.repo, and will contain the following entires:

[root@localhost ]# cat /etc/yum.repos.d/dvd.repo
[dvd]
name=Install DVD
baseurl="file:///media/CentOS_6.4_Final"
gpgkey="file:///media/CentOS_6.4_Final/RPM-GPG-KEY-CentOS-6"
gpgcheck=1
enabled=0

 

The first line of the repo file states that the entries are for the dvd repo.

The baseurl tells YUM where the RPM files are located. In this example YUM will look in /media/CentOS_6.4_Final/Packages.

The double quotes here are not strictly necessary, as CentOS does not use spaces in the media file path, but some releases of Linux do use spaces, and so the double quotes allows YUM to handle that.

The gpgkey points to the GPG key file identified earlier.

The enabled=0 directive tells YUM that this repo is not enabled by default. That means our repo will not be considred unless we expressly tell YUM to use it, which prevents our DVD dependent repo from causing problems later on when the install media is ejected.

Okay, now let’s see if our new dvd repo works. One tool I find myself using on a regular basis is the dos2unix tool which converts the CR/LF symbols of DOS to the singular LF used by UNIX and Linux.

We will use YUM, and specify that we want YUM to use the dvd repo by including the directive –enablerepo=dvd.

[root@localhost yum.repos.d]# yum install --enablerepo=dvd dos2unix
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centos.host-engine.com
 * extras: mirrors.syringanetworks.net
 * updates: centos.sonn.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package dos2unix.x86_64 0:3.1-37.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch             Version               Repository      Size
================================================================================
Installing:
 dos2unix           x86_64           3.1-37.el6            base            16 k

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

Total download size: 16 k
Installed size: 18 k
Is this ok [y/N]: 

 

YUM has completed the dependency check, and determined that it only has to install the dos2unix package. If this looks okay, you can enter Y to continue. YUM then completes the package install.

Downloading Packages:
dos2unix-3.1-37.el6.x86_64.rpm                           |  16 kB     00:00     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) 
 Package: centos-release-6-4.el6.centos.10.x86_64 (@anaconda-CentOS-201303020151.x86_64/6.4)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : dos2unix-3.1-37.el6.x86_64                                   1/1 
  Verifying  : dos2unix-3.1-37.el6.x86_64                                   1/1 

Installed:
  dos2unix.x86_64 0:3.1-37.el6                                                  

Complete!
[root@localhost yum.repos.d]# 

 

If the process completes successfully, you have a YUM repository you can use to assist in the install of the RPMs needed by Oracle.

The Oracle documentation includes a list of the additional RPMs needed for each release of the database software on all of the supported versions of Linux.

Check the following link, under the section Package Requirements.

Oracle Database Preinstallation Tasks

Here we find that the Oracle Database Package Requirements for Linux x86-64 for the operating system Oracle Linux 6, Red Hat Enterprise Linux 6, and Asianux Server 4 for which CentOS 6.4 is compatible, the package requirements are as follows:

  • binutils-2.20.51.0.2-5.11.el6 (x86_64)
  • compat-libcap1-1.10-1 (x86_64)
  • compat-libstdc++-33-3.2.3-69.el6 (x86_64)
  • compat-libstdc++-33-3.2.3-69.el6 (i686)
  • gcc-4.4.4-13.el6 (x86_64)
  • gcc-c++-4.4.4-13.el6 (x86_64)
  • glibc-2.12-1.7.el6 (i686)
  • glibc-2.12-1.7.el6 (x86_64)
  • glibc-devel-2.12-1.7.el6 (x86_64)
  • glibc-devel-2.12-1.7.el6 (i686)
  • ksh
  • libgcc-4.4.4-13.el6 (i686)
  • libgcc-4.4.4-13.el6 (x86_64)
  • libstdc++-4.4.4-13.el6 (x86_64)
  • libstdc++-4.4.4-13.el6 (i686)
  • libstdc++-devel-4.4.4-13.el6 (x86_64)
  • libstdc++-devel-4.4.4-13.el6 (i686)
  • libaio-0.3.107-10.el6 (x86_64)
  • libaio-0.3.107-10.el6 (i686)
  • libaio-devel-0.3.107-10.el6 (x86_64)
  • libaio-devel-0.3.107-10.el6 (i686)
  • make-3.81-19.el6
  • sysstat-9.0.4-11.el6 (x86_64)

The documentation states that the packages (or later versions) must be installed, and with each revision of the operating system, exact version numbers will change.

Also in many cases Oracle is directing us to install both the i686 (32-bit) package and the x86_64 (64-bit) package.

We can therefore streamline the install process using YUM as follows:

yum install --enablerepo=dvd \
binutils-2.* \
compat-libcap1-1.* \
compat-libstdc++-33-3.* \
compat-libstdc++-33-3.*.i686 \
gcc-4.* \
gcc-c++-4.* \
glibc-2.*.i686 \
glibc-2.* \
glibc-devel-2.* \
glibc-devel-2.*.i686 \
ksh \
libgcc-4.*.i686 \
libgcc-4.* \
libstdc++-4.* \
libstdc++-4.*.i686 \
libstdc++-devel-4.* \
libstdc++-devel-4.*.i686 \
libaio-0.* \
libaio-0.*.i686 \
libaio-devel-0.* \
libaio-devel-0.*.i686 \
make-3.* \
sysstat-9.*

 

Executing the YUM command should produce a result similar to this:

[root@localhost ~]# yum install --enablerepo=dvd binutils-2.* compat-libcap1-1.* compat-libstdc++-33-3.* compat-libstdc++-33-3.*.i686 gcc-4.* gcc-c++-4.* glibc-2.*.i686 glibc-2.* glibc-devel-2.* glibc-devel-2.*.i686 ksh libgcc-4.*.i686 libgcc-4.* libstdc++-4.* libstdc++-4.*.i686 libstdc++-devel-4.* libstdc++-devel-4.*.i686 libaio-0.* libaio-0.*.i686 libaio-devel-0.* libaio-devel-0.*.i686 make-3.* sysstat-9.*

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Package binutils-2.20.51.0.2-5.36.el6.x86_64 already installed and latest version
Package gcc-4.4.7-3.el6.x86_64 already installed and latest version
Package glibc-2.12-1.107.el6.x86_64 already installed and latest version
Package glibc-devel-2.12-1.107.el6.x86_64 already installed and latest version
Package libgcc-4.4.7-3.el6.x86_64 already installed and latest version
Package libstdc++-4.4.7-3.el6.x86_64 already installed and latest version
Package libaio-0.3.107-10.el6.x86_64 already installed and latest version
Package 1:make-3.81-20.el6.x86_64 already installed and latest version
Package sysstat-9.0.4-20.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package compat-libcap1.x86_64 0:1.10-1 will be installed
---> Package compat-libstdc++-33.i686 0:3.2.3-69.el6 will be installed
---> Package compat-libstdc++-33.x86_64 0:3.2.3-69.el6 will be installed
---> Package gcc-c++.x86_64 0:4.4.7-3.el6 will be installed
---> Package glibc.i686 0:2.12-1.107.el6 will be installed
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.12-1.107.el6.i686
--> Processing Dependency: libfreebl3.so for package: glibc-2.12-1.107.el6.i686
---> Package glibc-devel.i686 0:2.12-1.107.el6 will be installed
---> Package ksh.x86_64 0:20100621-19.el6 will be installed
---> Package libaio.i686 0:0.3.107-10.el6 will be installed
---> Package libaio-devel.i686 0:0.3.107-10.el6 will be installed
---> Package libaio-devel.x86_64 0:0.3.107-10.el6 will be installed
---> Package libgcc.i686 0:4.4.7-3.el6 will be installed
---> Package libstdc++.i686 0:4.4.7-3.el6 will be installed
---> Package libstdc++-devel.i686 0:4.4.7-3.el6 will be installed
---> Package libstdc++-devel.x86_64 0:4.4.7-3.el6 will be installed
--> Running transaction check
---> Package nss-softokn-freebl.i686 0:3.12.9-11.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch         Version                 Repository
                                                                           Size
================================================================================
Installing:
 compat-libcap1            x86_64       1.10-1                  dvd        17 k
 compat-libstdc++-33       i686         3.2.3-69.el6            dvd       189 k
 compat-libstdc++-33       x86_64       3.2.3-69.el6            dvd       183 k
 gcc-c++                   x86_64       4.4.7-3.el6             dvd       4.7 M
 glibc                     i686         2.12-1.107.el6          dvd       4.3 M
 glibc-devel               i686         2.12-1.107.el6          dvd       974 k
 ksh                       x86_64       20100621-19.el6         dvd       686 k
 libaio                    i686         0.3.107-10.el6          dvd        21 k
 libaio-devel              i686         0.3.107-10.el6          dvd        13 k
 libaio-devel              x86_64       0.3.107-10.el6          dvd        13 k
 libgcc                    i686         4.4.7-3.el6             dvd       112 k
 libstdc++                 i686         4.4.7-3.el6             dvd       300 k
 libstdc++-devel           i686         4.4.7-3.el6             dvd       1.6 M
 libstdc++-devel           x86_64       4.4.7-3.el6             dvd       1.6 M
Installing for dependencies:
 nss-softokn-freebl        i686         3.12.9-11.el6           dvd       116 k

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

Total download size: 15 M
Installed size: 47 M
Is this ok [y/N]: y


Downloading Packages:
--------------------------------------------------------------------------------
Total                                           6.9 MB/s |  15 MB     00:02     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///media/CentOS_6.4_Final/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid: "CentOS-6 Key (CentOS 6 Official Signing Key) "
 From  : /media/CentOS_6.4_Final/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libgcc-4.4.7-3.el6.i686                                     1/15 
  Installing : libstdc++-devel-4.4.7-3.el6.x86_64                          2/15 
  Installing : nss-softokn-freebl-3.12.9-11.el6.i686                       3/15 
  Installing : glibc-2.12-1.107.el6.i686                                   4/15 
  Installing : compat-libcap1-1.10-1.x86_64                                5/15 
  Installing : glibc-devel-2.12-1.107.el6.i686                             6/15 
  Installing : compat-libstdc++-33-3.2.3-69.el6.x86_64                     7/15 
  Installing : ksh-20100621-19.el6.x86_64                                  8/15 
  Installing : libstdc++-4.4.7-3.el6.i686                                  9/15 
  Installing : libaio-0.3.107-10.el6.i686                                 10/15 
  Installing : libaio-devel-0.3.107-10.el6.x86_64                         11/15 
  Installing : libaio-devel-0.3.107-10.el6.i686                           12/15 
  Installing : gcc-c++-4.4.7-3.el6.x86_64                                 13/15 
  Installing : libstdc++-devel-4.4.7-3.el6.i686                           14/15 
  Installing : compat-libstdc++-33-3.2.3-69.el6.i686                      15/15 
  Verifying  : compat-libcap1-1.10-1.x86_64                                1/15 
  Verifying  : glibc-devel-2.12-1.107.el6.i686                             2/15 
  Verifying  : gcc-c++-4.4.7-3.el6.x86_64                                  3/15 
  Verifying  : libaio-devel-0.3.107-10.el6.x86_64                          4/15 
  Verifying  : libstdc++-4.4.7-3.el6.i686                                  5/15 
  Verifying  : libgcc-4.4.7-3.el6.i686                                     6/15 
  Verifying  : glibc-2.12-1.107.el6.i686                                   7/15 
  Verifying  : compat-libstdc++-33-3.2.3-69.el6.x86_64                     8/15 
  Verifying  : compat-libstdc++-33-3.2.3-69.el6.i686                       9/15 
  Verifying  : libaio-0.3.107-10.el6.i686                                 10/15 
  Verifying  : libstdc++-devel-4.4.7-3.el6.x86_64                         11/15 
  Verifying  : ksh-20100621-19.el6.x86_64                                 12/15 
  Verifying  : nss-softokn-freebl-3.12.9-11.el6.i686                      13/15 
  Verifying  : libstdc++-devel-4.4.7-3.el6.i686                           14/15 
  Verifying  : libaio-devel-0.3.107-10.el6.i686                           15/15 

Installed:
  compat-libcap1.x86_64 0:1.10-1                                                
  compat-libstdc++-33.i686 0:3.2.3-69.el6                                       
  compat-libstdc++-33.x86_64 0:3.2.3-69.el6                                     
  gcc-c++.x86_64 0:4.4.7-3.el6                                                  
  glibc.i686 0:2.12-1.107.el6                                                   
  glibc-devel.i686 0:2.12-1.107.el6                                             
  ksh.x86_64 0:20100621-19.el6                                                  
  libaio.i686 0:0.3.107-10.el6                                                  
  libaio-devel.i686 0:0.3.107-10.el6                                            
  libaio-devel.x86_64 0:0.3.107-10.el6                                          
  libgcc.i686 0:4.4.7-3.el6                                                     
  libstdc++.i686 0:4.4.7-3.el6                                                  
  libstdc++-devel.i686 0:4.4.7-3.el6                                            
  libstdc++-devel.x86_64 0:4.4.7-3.el6                                          

Dependency Installed:
  nss-softokn-freebl.i686 0:3.12.9-11.el6                                       

Complete!

 

YUM makes resolving the dependency hell of RPM packages much more managable, and greatly simplifies the installation of Oracle on the Linux platform.

A local repo based on the install media means you don’t have to worry about subscriptions, trust-worthy free repos, or network access rules.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s