By cj on May 01, 2016
A newer compiler is needed on Oracle Linux 6 when you want to use add-ons like node-oracledb with Node 4 or later. This is because add-ons for those versions need to be built with a C++11 compatibile compiler. The default compiler on OL 6 doesn't have this support. OL 7 does have such a compiler, so these instructions are not needed for that version.
For OL 6 the easist way to get a new compiler is from the Software Collection Library (SCL). You enable the software
collection yum channel, run a
yum install command, and
then the compiler is immediately available to use. Detailed
installation SCL instructions are in the manual.
The steps below show how to install node-oracledb on Oracle Linux 6 for Node.js 4 or later.
Enabling the Software Collection Library
If you are using
yum.oracle.com (formerly known as
public-yum.oracle.com) then edit
/etc/yum.repos.d/public-yum-ol6.repo and enable the
[ol6_software_collections] name=Software Collection Library release 1.2 packages for Oracle Linux 6 (x86_64) baseurl=http://yum.oracle.com/repo/OracleLinux/OL6/SoftwareCollections12/x86_64/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle gpgcheck=1 enabled=1
If necessary, you can get the latest channel list from
http://yum.oracle.com/public-yum-ol6.repo and merge any
updates from it into your existing
Alternatively, if your machine has a ULN support subscription, you can subscribe to the Oracle Software Collections 1.2 for Oracle Linux 6 channel in the Manage Subscription page on linux.oracle.com.
Installing the Updated Compiler
Once the channel is enabled, install the updated compiler with:
yum install scl-utils devtoolset-3
This will install a number of packages that comprise the complete, updated tool set.
Installing node-oracledb on Node 4 (or later) is the same as in install instuctions, but using the new compiler. The Oracle Linux manual chapter Using the Software Collection Version of a Command shows various ways to enable the dev toolset.
In summary, to install node-oracledb on Node 4 or later using Oracle Linux 6, first install an Oracle client such as Instant Client. If you have anything except the Instant Client RPM packages, tell the installer where the libraries and header files are located, for example:
export OCI_LIB_DIR=$HOME/instantclient export OCI_INC_DIR=$HOME/instantclient/sdk/include
If you are behind a firewall, set your proxy:
In my development environments I often find some cleanup helps:
which npm && rm -rf $(npm root)/oracledb $(npm root)/nan $HOME/.node-gyp $HOME/.npm \ && npm cache clean
Now node-oracledb can be installed using the newer compiler:
scl enable devtoolset-3 -- npm install oracledb
Now you can use Node:
$ node version.js node.js version: v4.4.3 node-oracledb version: 10900 node-oracledb text format: 1.9.0 oracle client library version: 1201000200 oracle client library text format: 184.108.40.206.0 oracle database version: 1201000200 oracle database text format: 220.127.116.11.0 $ cat /etc/oracle-release oracle linux server release 6.7