I am working on a project where I want my Node.js based backend to communicate with Oracle DB, Locally while development on windows system it wasn't difficult to install the pre requisite for node-oracledb module as mentioned here https://community.oracle.com/docs/DOC-931127 but now when I want to install the same pre requisite for centos6, I am facing issues.
List of pre requisite,
- C Compiler with support for C++ 11.
- Python.
- Oracle Instant Client "basic" and "SDK" packages.
installing first two wasn't a challenge but finding rpm package for 3 is a tuff task.
Note: Everything has to be done using the Command line.
The Oracle Instant Client libraries are currently not available via RPM. As a workaround, many folks download the libraries the normal way and then put them somewhere they can access them over the network. Then they use a command line tool like curl to pull them in when needed.
Instant Client RPMs are available for 32-bit and 64-bit Linux. (The Instant Client home page is here.) Since Centos isn't an officially supported Linux, YMMV with the RPMs.
If the RPMs aren't usable for whatever reason, then download the Instant Client ZIP files, unzip them, and create the symbolic link ln -s libclntsh.so.12.1 libclntsh.so
.
The Instant Client libraries will need to be in LD_LIBRARY_PATH
, or you can use ldconfig similar to:
sudo sh -c "echo /opt/oracle/instantclient_12_2 > /etc/ld.so.conf.d/oracle-instantclient.conf"
sudo ldconfig
You will also need the OS libaio package installed. Using yum
on the RPMs will pull this dependency in automatically, or you can install it separately.
After all the search and effort I am finally able to install oracledb on my Centos system through the command line.
Please follow below steps on Command line as root user (Assuming Python is already installed):
1) Download required rpm Oracle instant client packages.
wget ftp://ftp.icm.edu.pl/vol/rzm6/linux-slc/centos/7.1.1503/cernonly/x86_64/Packages/oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
wget ftp://ftp.icm.edu.pl/vol/rzm6/linux-slc/centos/7.0.1406/cernonly/x86_64/Packages/oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
wget ftp://ftp.icm.edu.pl/vol/rzm6/linux-slc/centos/7.0.1406/cernonly/x86_64/Packages/oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
Above commands will download rpm packages for oracle instant client.
2) Install Downloaded rpm packages.
[~]: sudo rpm -ivh oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
Preparing... ########################################### [100%]
1:oracle-instantclient12.########################################### [100%]
[~]: sudo rpm -ivh oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
Preparing... ########################################### [100%]
1:oracle-instantclient12.########################################### [100%]
[~]: sudo rpm -ivh oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
Preparing... ########################################### [100%]
1:oracle-instantclient12.########################################### [100%]
3) Download the repo files for DevTools2, a Red Hat package that contains a supported C++11 compiler.
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
4) Install the compiler and support tools.
yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
Above step will download Oracle instant client, C++ compiler and DevTools2 compiler. Now it's time to install oracledb.
Before you can compile C++11 code with the DevTools2 compiler, you need to enable it in a new shell:
scl enable devtoolset-2 bash
Now, install oracledb
npm install oracledb
This will install oracledb.