Last active
October 4, 2019 18:26
-
-
Save crynobone/ca56ca2b5bea39eb397d to your computer and use it in GitHub Desktop.
Provision Oracle InstantClient for Ubuntu Vagrant.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
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
thanks man!