These are the steps to install ruby-oci8 Gem on Ubuntu.
Step 1: Download the basic & sdk instantclient zip files from https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
instantclient-basic-linux.x64-21.8.0.0.0dbru.zip
instantclient-sdk-linux.x64-21.8.0.0.0dbru.zip
Step 2: Install following packages
sudo apt-get install build-essential
sudo apt-get install libaio-dev
Step 3: Create a folder oracle inside /opt/
mkdir /opt/oracle
Step 4: Go to inside /opt/oracle/
cd /opt/oracle
Step 5: Place the basic instantclient folder inside /opt/oracle
sudo cp ~/Downloads/instantclient-basic-linux.x64-21.8.0.0.0dbru.zip /opt/oracle/
Step 6: Place the sdk instantclient folder inside /opt/oracle
sudo cp ~/Downloads/instantclient-sdk-linux.x64-21.8.0.0.0dbru.zip /opt/oracle/
Step 7: Unzip the basic instantclient folder
sudo unzip instantclient-basic-linux.x64-21.8.0.0.0dbru.zip
Step 8: Unzip the sdk instantclient folder
sudo unzip instantclient-sdk-linux.x64-21.8.0.0.0dbru.zip
Step 9: Check the folders inside /opt/oracle/. It should now have a folder named as instantclient_21_8
Step 10: Update the runtime link path
sudo sh -c “echo /opt/oracle/instantclient_21_8 > \
> /etc/ld.so.conf.d/oracle-instantclient.conf”
Step 11: Check the runtime link path, It should now return /opt/oracle/instantclient_21_8
cat /etc/ld.so.conf.d/oracle-instantclient.conf
Step 12: Set the path in env
export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_8:$LD_LIBRARY_PATH
Step 13: Check the path if set properly in env. It should now have proper value set as LD_LIBRARY_PATH=/opt/oracle/instantclient_21_2:/opt/instantclient
env | grep LD_LIBRARY_PATH
Step 14: Now try by installing the gem ruby-oci8
gem install ruby-oci8s
It should work now.
Alternate Install
These steps take you through the instant client installation process as well, just to provide some context. Download the instant and SDK zip files here:
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
Unzip both files in the following directory as root.
/opt/oracle
Enter the instantclient_12_2 directory following the unzip and create a symlink for the libclntsh.so file:
ln -s libclntsh.so.12.1 libclntsh.so
Now, depending on your OS, you’ll need to update your LD_LIBRARY_PATH location. In Ubuntu, do the following:
sudo nano /etc/ld.so.conf.d/moreLibs.conf
And enter the following in the file and save
/opt/oracle/instantclient_12_2
Now run the following command:
sudo ldconfig
And rerun your gem install:
gem install ruby-oci8