Last active
February 23, 2017 22:29
-
-
Save jarshwah/3863378 to your computer and use it in GitHub Desktop.
Installing cx_Oracle on Linux Redhat 6 using RPMs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assuming python and pip are already installed | |
# installing the instantclient is usually where problems happen | |
# download the following files from oracle | |
# | |
# 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.rpm | |
# install the rpms | |
rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm | |
rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm | |
rpm -ivh oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm | |
# the sqlplus package isn't specifically needed, but is usually useful for testing and command line sql connections | |
# configure oracle env (modify exact path based on version of rpm you download) | |
vim /etc/profile.d/oracle.sh | |
#!/bin/bash | |
LD_LIBRARY_PATH="/usr/lib/oracle/11.2/client64/lib:${LD_LIBRARY_PATH}" | |
export LD_LIBRARY_PATH | |
TNS_ADMIN="/etc/oracle" | |
export TNS_ADMIN | |
ORACLE_HOME="/usr/lib/oracle/11.2/client64/lib" | |
export ORACLE_HOME | |
# actually set the env vars above in your session | |
source /etc/profile.d/oracle.sh # or just logout/login | |
# copy/create your tnsnames.ora file | |
touch /etc/oracle/tnsnames.ora | |
# symlink headers to ORACLE_HOME to avoid "cannot locate Oracle include files" error | |
mkdir /usr/lib/oracle/11.2/client64/lib/sdk | |
ln -s /usr/include/oracle/11.2/client64 /usr/lib/oracle/11.2/client64/lib/sdk/include | |
# done. Install cx_Oracle | |
pip install cx_Oracle | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice!! Thanks!