Search code examples
javascriptnode.jsoraclecentos6node-oracledb

How to install node-oracledb module on AWS centos6 through command line?


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,

  1. C Compiler with support for C++ 11.
  2. Python.
  3. 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.


Solution

  • 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.