Search

Custom Search

Friday 25 September 2015

Node-oracledb Installation on Linux

1) Install Node.js
Download the Node.js Linux 64-bit binaries and extract the file, into /opt:

cd /opt
tar -zxf node-v0.12.7-linux-x64.tar.gz

Set PATH to include Node.js:
export PATH=/opt/node-v0.12.7-linux-x64/bin:$PATH

2) Install the free Oracle Instant Client 'Basic' and 'SDK' ZIPs


Download the free Basic and SDK ZIPs from Oracle Technology Network and install them into the same directory:

cd /opt/oracle
unzip instantclient-basic-linux.x64-12.1.0.2.0.zip
unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip
mv instantclient_12_1 instantclient
cd instantclient
ln -s libclntsh.so.12.1 libclntsh.so

You will need libaio installed. On some platforms the package is called libaio1.

To run applications, you will need to set the link path:

export LD_LIBRARY_PATH=/opt/oracle/instantclient:$LD_LIBRARY_PATH

Alternatively, if there is no other Oracle software on the machine that will be impacted, permanently add Instant Client to the run-time link path. Do this on Linux by creating a file /etc/ld.so.conf.d/oracle-instantclient.conf that contains the library location /opt/oracle/instantclient, and then run ldconfig as the root user.

3) Tell the installer where to find Instant Client:

export LD_LIBRARY_PATH=/opt/instantclient:$LD_LIBRARY_PATH
export OCI_LIB_DIR=/opt/instantclient
export OCI_INC_DIR=/opt/instantclient/sdk/include

Install node-oracledb from the NPM repository:

npm install oracledb

If you are installing with sudo, you may need to use sudo -E to preserve the environment variable values.