Skip to content

Instantly share code, notes, and snippets.

@croisillon
Last active August 1, 2023 09:49
Show Gist options
  • Save croisillon/456b37824755cc111e403bbfa3e50094 to your computer and use it in GitHub Desktop.
Save croisillon/456b37824755cc111e403bbfa3e50094 to your computer and use it in GitHub Desktop.
Oracle instantclient installer
#!/usr/bin/env bash
ROOT=/opt/oracle
if [ ! -e $ROOT ]; then
mkdir -p $ROOT
fi
LIBS=instanclient_basic_lib.zip
if [ ! -e $LIBS ]; then
wget -O $LIBS https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.1.0.2.0.zip
fi
SDK=instanclient_basic_sdk.zip
if [ ! -e $SDK ]; then
wget -O $SDK https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-sdk-linux.x64-12.1.0.2.0.zip
fi
unzip -o $LIBS -d $ROOT
unzip -o $SDK -d $ROOT
CLIENT="$ROOT/instantclient"
if [ ! -e $CLIENT ]; then
mv "$ROOT/instantclient_12_1" $CLIENT
fi
LN_libclntsh="libclntsh.so"
LN_libocci="libocci.so"
if [ ! -h "$CLIENT/$LN_libclntsh" ]; then
ln -s "$CLIENT/libclntsh.so.12.1" "$CLIENT/$LN_libclntsh"
fi
if [ ! -h $CLIENT/$LN_libocci ]; then
ln -s "$CLIENT/libocci.so.12.1" "$CLIENT/$LN_libocci"
fi
export ORACLE_HOME="$CLIENT"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
export OCI_HOME="$CLIENT"
export OCI_LIB_DIR="$CLIENT"
export OCI_INCLUDE_DIR="$CLIENT/sdk/include"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment