Install Oracle Client On CentOS

This installation is same for all rpm based systems like (Centos/Fedora/RHEL/SLES/Opensuse/Mandriva..)

This tutorial is about 11.2 version client, but should work even for 12.1 version.

Packages are:

oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm

In the future, i will include a post with how to download these packages.

1. Oracle Client Installation

Go to Downloaded rpm packages directory and install them with root privileges.

[root@Client-server ~]# yum localinstall oracle* --nogpgcheck

---> Package oracle-instantclient11.2-basic.x86_64 0:11.2.0.4.0-1 set to be updated
 ---> Package oracle-instantclient11.2-devel.x86_64 0:11.2.0.4.0-1 set to be updated
 ---> Package oracle-instantclient11.2-sqlplus.x86_64 0:11.2.0.4.0-1 set to be updated
 --> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================================================================
 Package                                           Arch                    Version                         Repository                                                              Size
 ========================================================================================================================================================================================
 Installing:
 oracle-instantclient11.2-basic                    x86_64                  11.2.0.4.0-1                    /oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64                    179 M
 oracle-instantclient11.2-devel                    x86_64                  11.2.0.4.0-1                    /oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64                    1.9 M
 oracle-instantclient11.2-sqlplus                  x86_64                  11.2.0.4.0-1                    /oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64                  2.8 M
Transaction Summary
 ========================================================================================================================================================================================
 Install       3 Package(s)
 Upgrade       0 Package(s)
Total size: 184 M
 Is this ok [y/N]: y

2. Configure TNSNames.ora

tnsnames.ora file is used to store database connection information. This file must be created and configured in your current client installation.

To do this, first create your network/admin directory

[root@Client-server ~]# mkdir /usr/lib/oracle/11.2/client64/network/admin -p

Now inside you can make your tnsnames.ora  file.

3. Configure Environment Variables

Create file /etc/profile.d/client.sh with the following file content

 export ORACLE_HOME=/usr/lib/oracle/11.2/client64
 export PATH=$PATH:$ORACLE_HOME/bin
 export LD_LIBRARY_PATH=$ORACLE_HOME/lib
 export TNS_ADMIN=$ORACLE_HOME/network/admin

Now,

1) logout and logon again.

2) Then, run:

sh /etc/profile.d/client.sh

4. Test Installation

To test if Oracle Client and tnsnames.ora works properly execute the following command:

[root@Client-server ~]# sqlplus username@SID-FROM_TNSNAMNE.ORA

Done!