Setting Up Cx_Oracle on Linux/Ubuntu

👋 Thanks for reading! Things have changed since this was written, take it with a grain of salt ;)

Further reading: Cx_Oracle Docs

Download Instant Client

On host computer (Mac in this case) download the instant client basic and skd rpn’s. Oracle changed the name on sdk’s to devel.


Put the files in a known directory. In my case I put the files in ~/Documents/Projects/Oracle

Move Instant Client files to Server

Login to the server. Run a scp command to copy the full Oracle directory with both rpn’s from the Mac host to the server.

On the Mac you may need to allow ssh connections. “System Preferences” > “Sharing” > “Remote Login” > “On”

sudo mkdir /home/Oracle
sudo scp -r 'username'@'machost':~/Documents/Projects/Oracle /home/

Install Instant Client

Use alian to convert both rpn’s to deb and install.

cd /home/Oracle
sudo apt-get install alien
sudo alien -i oracle-instantclient18.3-basic-
sudo alien -i oracle-instantclient18.3-devel-
# uninstall alien if no longer needed
sudo apt-get purge --auto-remove alien
sudo rm -rf /home/Oracle

Install the packages needed on Ubuntu

sudo apt-get install libaio-dev

Change Oracle Settings

Add oracle to the system path.

sudo sh -c "echo /usr/lib/oracle/18.3/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf"
sudo ldconfig

If you plan to use tnsnames.ora you can create the directory here. This is the default location for oracle.

sudo mkdir -p /usr/lib/oracle/18.3/client64/lib/network/admin

# copy tnsnames.ora from Mac host
sudo scp 'username'@'machost':/opt/oracle/instantclient_12_2/network/admin/tnsnames.ora /usr/lib/oracle/18.3/client64/lib/network/admin

Good luck :)