-
Notifications
You must be signed in to change notification settings - Fork 0
Installing Oracle InstantClient on Ubuntu
To access Timeclock data, which is essential for our shift widget, we need to install the Oracle InstantClient and some of it's tools and libraries. You will need a free oracle.com account to access the downloads. You need to download the following packages and copy them to the server:
oracle-instantclient11.2-basic-*.x86_64.rpm
oracle-instantclient11.2-sqlplus-*.x86_64.rpm
oracle-instantclient11.2-devel-*.x86_64.rpm
Where * is the latest version number that's available. We remain restricted to the 11.2 branch as that is the highest that cx_Oracle currently supports. Now, you might have noticed that these are RPM packages which are typically used in RedHat/Fedora and their many derivatives and we're using Ubuntu which uses deb files for packages. Fear not, there is a solution! First, we need to install an application called Alien:
sudo apt-get install alien
Time to use our newly installed tool to convert those jerkfaced RPMs into friendly DEBs! Note, that you can actually use the following commands as is, as bash (or your preferred shell!) will match the asterisks with the files you downloaded:
sudo alien -i oracle-instantclient11.2-basic-*.rpm
sudo alien -i oracle-instantclient11.2-sqlplus-*.rpm
sudo alien -i oracle-instantclient11.2-devel-*.rpm
The -i flag automatically converts the files to debs, and installs them without a need for an additional command.
In order to actually use the tools we just installed, we need to set the ORACLE_HOME environmental variable for all users, integrate the oracle libraries with the rest of the system and install a single dependency. Let's start with ORACLE_HOME. We're going to use vim to create a shell script with the contents lists below. First, create the file:
sudo vim /etc/profile.d/oracle.sh
Now, paste in the following contents and save the file (if you're unfamiliar with vim, google it or use another text editor you might be more comfortable with):
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export PATH=$PATH:$ORACLE_HOME/bin
Onto library integration. Let's create a config file for our Oracle libraries:
sudo vim /etc/ld.so.conf.d/oracle.conf
And inside, paste the following:
/usr/lib/oracle/11.2/client64/lib
Save the file, the run the following command to load the config file:
sudo ldconfig
Finally, install the dependency libaio:
sudo apt-get install libaio1
You'll know everything is working when you can type 'sqlplus' from the command line and be greeted with a banner and username prompt, you may need to logout and log back in (or reload your bash profile for you advanced users) to finalize everything.