User Tools

Site Tools


Advertisements: AliExpress Hide Your IP Microsoft Products
linux:debian:oracle_client

How to install Oracle Client on Debian

If you want to connect to Oracle database you must install the oracle instant client library on your operating system. Go to oracle.com and hover download menu. You will see oracle instant client under database section and click it. Then, you should select the right operating system and architecture. I downloaded the latest versions of files which was 12.1 when I wrote this tutorial. I downloaded the following files

For 64bit

  • oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
  • oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
  • oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm

For 32bit

  • oracle-instantclient12.1-basic-12.1.0.2.0-1.i386.rpm
  • oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.i386.rpm
  • oracle-instantclient12.1-devel-12.1.0.2.0-1.i386.rpm

After downloading these rpm packages, we need to install them on debian with “alien”. If you do not have alien installed, run this as super user:

aptitude install alien

After installing alien, you need to install the rpm packages with alien. Run the following command as super user on shell within the directory you installed the rpms. Note: I am assuming these are the only rpm packages in that directory

alien -i *.rpm

After installation completed, you need to set the environment variables for oracle client, ORACLE_HOME and LD_LIBRARY_PATH. You should add them to one of your profile files under your home directory

nano ~/.bashrc

Add following lines to the file and save it

For 64bit

export ORACLE_HOME="/usr/lib/oracle/12.1/client64"
export LD_LIBRARY_PATH="/usr/lib/oracle/12.1/client64/lib:$LD_LIBRARY_PATH"

For 32bit

export ORACLE_HOME="/usr/lib/oracle/12.1/client"
export LD_LIBRARY_PATH="/usr/lib/oracle/12.1/client/lib:$LD_LIBRARY_PATH"

And then run

source ~/.bashrc

Since cx_Oracle python module needs libaio package, I install it too

aptitude install libaio1

You are ready to use the oracle instant client library.

If you need to install cx_Oracle python module, firstly, ORACLE_HOME and LD_LIBRARY_PATH environment variables must be set like I set above, and secondly you must have python-dev and python-pip packages installed

aptitude install python-dev python-pip

Then you can install cx_Oracle with pip

pip install cx_Oracle

Discussion

Enter your comment. Wiki syntax is allowed:
 
linux/debian/oracle_client.txt · Last modified: 2016/11/26 09:03 by ozan