在CentOs6.x 安装Cx_oracle5.x
Setting up anything Oracle related is a huge pain. After hunting the web for info with minimal success, I have decided to create a small tutorial to walk through setting up cx_Oracle to connect to Oracle installations.
Prerequisites
If you do not have a Oracle.com account, you will unfortunately need to create one to be able to download anything. Once you have your account head to the OS Selection page and select the appropriate OS, in my case this will be Linux / AMD64. On the subsequent page you must download the basiclite package as well as the devel package. I chose the RPM files as I am running CentOS 6.x. If you want non-English application support you probably want to install the basic version instead of the basiclite, it has multilingual support built in. You may optionally want to install the sqlplus package to help with debugging and connection issues.
Oracle Library Installation
I downloaded the RPM files so ill use the rpm command to install the packages as follows
| 1 2 3 4 5 6 7 | [root@devel ~] # cd oracle_files[root@devel oracle_files]# rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpmPreparing... ########################################### [100%]1:oracle-instantclient11.########################################### [ 33%]2:oracle-instantclient11.########################################### [ 67%]3:oracle-instantclient11.########################################### [100%][root@devel oracle_files]# | 
This will install the client under /usr/lib/oracle/11.2/client64/ by default under CentOS. Now this path is not listed under the shared library path by default (why doesn't this get setup by default?), so we must add it. Create the following file: /etc/ld.so.conf.d/oracle.conf with the following contents, adjusted accordingly to your installation:
| 1 | /usr/lib/oracle/11.2/client64/lib | 
With that in place we can now enable the shared library path system wide as follows:
| 1 | [root@devel ~]# ldconfig | 
To verify the library path installation you can try and run the sqlplus client. If it fails to start then you have a problem and should look into any mistakes that may have occurred during the installation process.
| 1 2 3 4 5 6 | [root@devel ~]# PATH=$PATH:/usr/lib/oracle/11.2/client64/bin # place in ~/.bashrc for a permanent setup[root@devel ~]# sqlplusSQL*Plus: Release 11.2.0.3.0 Production on Mon Jun 11 16:57:40 2012Copyright (c) 1982, 2011, Oracle. All rights reserved. | 
Python Library Installation
With the oracle libraries installed we can now begin installing the python connector cx_Oracle. I will be building a rpm file from the source rpm. If you are not using CentOS, or don't want to build a rpm for whatever reason, then go ahead and grab the source tarball instead.
Building and installing from source rpm:
| 1 2 3 4 5 6 7 8 | [root@devel ~]# rpm -ivh cx_Oracle-5.1.1-1.src.rpm1:cx_Oracle ########################################### [100%][root@devel ~]# cd ~/rpmbuild/SPECS[root@devel ~]# yum install rpm-build[root@devel ~]# ORACLE_HOME=/usr/lib/oracle/11.2/client64/ rpmbuild -ba cx_Oracle.spec[root@devel ~]# cd ../RPMS/x86_64[root@devel ~]# rpm -ivh cx_Oracle-5.1.1-1.x86_64.rpmPreparing... ########################################### [100%]1:cx_Oracle ########################################### [100%] | 
Or Building and installing from source tarball
| 1 2 3 4 | tar xvfz cx_Oracle.tar.gzcd cx_Oracle.tar.gzORACLE_HOME=/usr/lib/oracle/11.2/client64/ python setup.py buildORACLE_HOME=/usr/lib/oracle/11.2/client64/ python setup.py install | 
Verification
To easily test if the installation has succeded run the following 1 liner, if no errors occur then your installation went OK.
| 1 | [root@devel x86_64]# python -c 'import cx_Oracle' | 
在CentOs6.x 安装Cx_oracle5.x的更多相关文章
- vmware Centos6.6安装64位
		Centos6.6安装64位 必须开启BIOS中的虚拟化技术 首先开机进入BIOS,一般机器是按F2,我的T420是按F1,然后进入Security,Virtualization,选择Enable即可 ... 
- Gitlab完美安装【CentOS6.5安装gitlab-6.9.2】
		摘要: 拆腾了几天,终于在今天找到了快速安装Gitlab的方法.CentOS6.5安装gitlab-6.9.2 参考网址:https://gitlab.com/gitlab-org/omnibus-g ... 
- CentOS6.5安装Tomcat
		安装说明 安装环境:CentOS-6.4 安装方式:源码安装 软件:apache-tomcat-7.0.56.tar.gz 下载地址:http://tomcat.apache.org/download ... 
- Centos6 yum安装openldap+phpldapadmin+TLS+双主配置
		原文地址:http://54im.com/openldap/centos-6-yum-install-openldap-phpldapadmin-tls-%E5%8F%8C%E4%B8%BB%E9%8 ... 
- centos6.5安装oracle11g_2
		centos7安装oracle数据库不成功,换成centos6.5安装,可以安装成功,记录一下 安装系统时,主机名如果不是用localhost,安装成功后,要用主机名和ip做映射,修改/etc/hos ... 
- CentOS6.6安装vmware workstation报错
		本人系统用的是centos6.6,安装了vmware workstation,启动后一直如下图报错,相关内核已经安装了的,哪位前辈如果解决过这样的问题,麻烦指点指点,小弟在此先谢过了. 
- CentOS6.6安装virtualbox4.1.44
		本人用的是centos6.6,安装了virtualbox 4.1.44,启动后一直如上图报错,哪位前辈如果解决过这样的问题,麻烦指点指点,小弟在此先谢过了. 
- [转]CentOS-6.3安装配置cmake
		CentOS-6.3安装配置cmake zhoulf 2013-02-03 原创 安装说明 安装环境:CentOS-6.3安装方式:源码编译安装 软件:cmake-2.8.10.2.tar.gz下 ... 
- 实战CENTOS6.5安装docker并创建asp.net mvc 5 镜像,运行MVC 网站
		Docker,容器,让研发.测试.生产同一环境,可在linux平台上混合使用JAVA与net 程序 Centos6.5安装docker 参考http://my.oschina.net/kcw/blog ... 
随机推荐
- paramiko执行命令超时的问题
			问题:paramiko远程执行命令,需要等到命令返回信息,如果命令执行时间比较长,返回信息就需要等很久 方案:1.使用nohup + 待执行命令 + & ,使用后台执行的方式,应该可以快速返回 ... 
- 很多shell命令后面的单横杠和双横杠,原来这个意思
			原文: https://blog.csdn.net/deyili/article/details/5471023 ------------------------------------------- ... 
- 基于cucumber接口测试框架的扩展——测试框架总结之cucumber
			主要功能: 1.通过fiddler抓取请求,导出xml文件. 2.解析xml文件至excel,或者手工填写excel数据. 3.根据excel中的URL中地址生成的接口集合和feature内容模板生成 ... 
- 手把手教你安装Hbase,一次成功!
			安装环境: OS: Centos 6.5 JDK: jdk1.6.0_18 Hadoop: hadoop-0.20.2 Hbase: hbase-0.90.5 安装准备: 1. Jdk环境 ... 
- css3 - 基本选择器
			有人说类选择器最好不要超过三层,其实我也是这样认为的,不是吗? 选择器分为四大类 标签.全选(相对于子类继承了0.1).类.ID 权值分别是:1->0.1->10->100(权值可叠 ... 
- angular 资源路径问题
			1.templateUrl .component("noData",{ templateUrl:"components/noData.html" // 注意相对 ... 
- 《图论》——广度优先遍历算法(BFS)
			十大算法之广度优先遍历: 本文以实例形式讲述了基于Java的图的广度优先遍历算法实现方法,详细方法例如以下: 用邻接矩阵存储图方法: 1.确定图的顶点个数和边的个数 2.输入顶点信息存储在一维数组ve ... 
- ffmpeg rtmp 推流错误WriteN, RTMP send error 10053 10038
			利用ffmepg推264流到rtmp服务端出现错误WriteN, RTMP send error 10053,具体如下图所示. 图1推流到rtmp服务错误 原因是视频流缺少SPS,PPS信息,加上这两 ... 
- 云舒网络译:Rancher1.0正式版公布
			编者注: Rancher Labs是一家容器技术基础设施提供商,总部位于美国硅谷,Rancher是一个高效易用的企业容器云平台. 云舒网络 http://www.cloudsoar.com/为Ranc ... 
- 《Python核心编程》数字类型
			1.数字类型简单介绍 Python中数字类型包含:整型.长整型.布尔型.双精度浮点型.十进制浮点型.复数.这些数字类型都是不可变类型.也就是说,改变了数字的值会生成新的对象. 在Python中删除数字 ... 
