问题描述
我正在一个项目中,我希望基于Node.js的后端与Oracle DB通信,在Windows系统上进行本地开发时,如此处所述安装node-oracledb模块的必备组件并不困难 https://community.oracle.com/docs/DOC-931127 ,但是现在我想要要为centos6安装相同的先决条件,我遇到了问题.
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.
先决条件列表,
- 支持C ++ 11的C编译器.
- Python.
- Oracle Instant Client基本"和"SDK"软件包.
安装前两个不是什么挑战,但是找到3的rpm包是一项艰巨的任务.
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.
推荐答案
经过所有的搜索和工作,我终于可以通过命令行在Centos系统上安装oracledb.
After all the search and effort I am finally able to install oracledb on my Centos system through the command line.
请以root用户身份在命令行上执行以下步骤(假设已经安装了Python):
Please follow below steps on Command line as root user (Assuming Python is already installed):
1)下载所需的rpm Oracle Instant Client软件包.
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
以上命令将为oracle Instant Client下载rpm软件包.
Above commands will download rpm packages for oracle instant client.
2)安装下载的rpm软件包.
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)下载DevTools2的repo文件,DevTools2是一个Red Hat软件包,其中包含受支持的C ++ 11编译器.
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)安装编译器和支持工具.
4) Install the compiler and support tools.
yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
以上步骤将下载Oracle Instant Client,C ++编译器和DevTools2编译器.现在该安装oracledb了.
Above step will download Oracle instant client, C++ compiler and DevTools2 compiler. Now it's time to install oracledb.
在使用DevTools2编译器编译C ++ 11代码之前,需要在新的shell中启用它:
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
现在,安装oracledb
Now, install oracledb
npm install oracledb
这将安装oracledb.
This will install oracledb.
这篇关于如何通过命令行在AWS centos6上安装node-oracledb模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!