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

て烟熏妆下的殇ゞ 提交于 2019-12-13 22:14:52

问题


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.


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/45166124/how-to-install-node-oracledb-module-on-aws-centos6-through-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!