Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Provision Oracle InstantClient for Ubuntu Vagrant.
#!/usr/bin/env bash
export LD_LIBRARY_PATH=/opt/oracle/instantclient
export ORACLE_HOME=/opt/oracle/instantclient
echo "Instantclient path: instantclient,/opt/oracle/instantclient"
sudo pecl install oci8
sudo echo "extension=oci8.so" >> /etc/php5/fpm/php.ini
sudo echo "extension=oci8.so" >> /etc/php5/cli/php.ini
sudo service php5-fpm restart
sudo service nginx restart
#!/usr/bin/env bash
echo ">>> Installing Oracle InstantClient"
sudo apt-get update
sudo apt-get upgrade --force-yes
# Install Dependencies
sudo apt-get install --force-yes php5-dev
sudo apt-get install --force-yes unzip rpm libaio1 build-essential libaio-dev re2c
SHARED_DIR='/vagrant/shared'
INSTANT_ZIP_VERSION='linux.x64-11.2.0.4.0'
INSTANT_WORKING_FOLDER='instantclient_11_2'
INSTANT_MAJOR_VERSION='11'
if [ -f $SHARED_DIR/instantclient-basic-$INSTANT_ZIP_VERSION.zip ]; then
echo "Found $SHARED_DIR/instantclient-basic-$INSTANT_ZIP_VERSION.zip file."
else
echo "!!! Missing $SHARED_DIR/instantclient-basic-$INSTANT_ZIP_VERSION.zip file."
exit 1;
fi
if [ -f $SHARED_DIR/instantclient-sdk-$INSTANT_ZIP_VERSION.zip ]; then
echo "Found $SHARED_DIR/instantclient-sdk-$INSTANT_ZIP_VERSION.zip file."
else
echo "!!! Missing $SHARED_DIR/instantclient-sdk-$INSTANT_ZIP_VERSION.zip file."
exit 1;
fi
cd /tmp
cp $SHARED_DIR/instantclient-* .
cd /opt
if [ -d /opt/oracle ]; then
sudo rm -Rf oracle
fi
sudo mkdir oracle
cd /opt/oracle
sudo unzip /tmp/instantclient-basic-$INSTANT_ZIP_VERSION.zip
sudo unzip /tmp/instantclient-sdk-$INSTANT_ZIP_VERSION.zip
sudo ln -s /opt/oracle/$INSTANT_WORKING_FOLDER /opt/oracle/instantclient
sudo cp -R /opt/oracle/$INSTANT_WORKING_FOLDER/sdk/* /opt/oracle/$INSTANT_WORKING_FOLDER
cd /opt/oracle/$INSTANT_WORKING_FOLDER
sudo cp sdk/include/* .
sudo ln -s libclntshcore.so.$INSTANT_MAJOR_VERSION.1 libclntshcore.so
sudo ln -s libclntsh.so.$INSTANT_MAJOR_VERSION.1 libclntsh.so
sudo ln -s libocci.so.$INSTANT_MAJOR_VERSION.1 libocci.so
sudo ln -s libnnz$INSTANT_MAJOR_VERSION.so libnnz.so
sudo echo '/opt/oracle/instantclient/' | sudo tee -a /etc/ld.so.conf.d/oracle_instant_client.conf
sudo ldconfig
sudo chown -R root:www-data /opt/oracle
@mstaack

This comment has been minimized.

Copy link

@mstaack mstaack commented Dec 15, 2015

thanks man!

@nycynik

This comment has been minimized.

Copy link

@nycynik nycynik commented Feb 27, 2016

This was helpful!, had to change the version numbers, but the rest was perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment