Installing DBD::Oracle on RHEL6 with Oracle Instant Client 11.2 rpm

To install the Perl DBD::Oracle module on RHEL6, with the oracle instant client rpms installed, you need to type the following sequence of commands. Keep in mind that 11.2 can be exchanged for your version of Oracle, and that client64 can be exchanged for just client if you are using 32bit linux. From a shell prompt as root (or using sudo):


cpan
install DBD::Oracle

This will likely fail but leave you with a cpan prompt.  When it does, type:


look DBD::Oracle

export ORACLE_HOME=/usr/lib/oracle/11.2/client64/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME

The above will drop you at a shell prompt at the directory where the DBD::Oracle source code has been extracted, and configures the environment for the compile/install. Now you can do the compile and install process with:


perl Makefile.PL -V 11.2
make

If all is good, then you can go ahead and do the install:


sudo make install

The LD_LIBRARY_PATH environment variable must be set as given above for any user who will be using DBD::Oracle, so be sure to set the path permanently through a simple script added to the /etc/profile.d directory.