Skip to content

Instantly share code, notes, and snippets.

@GaryRogers
Created August 16, 2014 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GaryRogers/88241c6bfe188b8c116c to your computer and use it in GitHub Desktop.
Save GaryRogers/88241c6bfe188b8c116c to your computer and use it in GitHub Desktop.
Vagrant/CentOS Node Install with Oracle Libraries
#!/usr/bin/env bash
if [ $(yum repolist | grep -c ^epel) -eq 0 ]; then
printf "[bootstrap] Adding EPEL Repo\n";
yum --quiet -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
fi
# ===================================================================
# Install python if it doesn't exist.
# ===================================================================
FILE=/usr/bin/python
if [ ! -f $FILE ]; then
printf "[bootstrap] Installing Python\n";
yum --quiet -y install python
fi
# ===================================================================
# Install node if it doesn't exist.
# ===================================================================
FILE=/usr/bin/node
if [ ! -f $FILE ]; then
printf "[bootstrap] Installing Node\n";
yum --quiet -y install nodejs npm
fi
# ===================================================================
# Install Oracle Client
# (http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html)
# ===================================================================
if [ $(rpm -qa | grep -c 'oracle-instantclient') -eq 0 ]; then
echo '[bootstrap] Installing Oracle Client'
yum --quiet -y install libaio
rpm -Uhv /vagrant/oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
rpm -Uhv /vagrant/oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
cat > /etc/profile.d/oracle.sh <<EOM
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export OCI_HOME=/usr/lib/oracle/11.2/client64
export OCI_LIB_DIR=\$OCI_HOME/lib
export OCI_INCLUDE_DIR=/usr/include/oracle/11.2/client64
export OCI_VERSION=11
export NLS_LANG=AMERICAN_AMERICA.UTF8
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin
EOM
echo '/usr/lib/oracle/11.2/client64/lib' > /etc/ld.so.conf.d/oracle_instant_client.conf
mkdir -p /usr/lib/oracle/11.2/client64/network/admin -p
source /etc/profile.d/oracle.sh
cd $OCI_LIB_DIR
ln -s libnnz.11.so libnnz.so
npm install -g oracle
fi
#yum install autoconf automake
# ===================================================================
# Set up annoying shell and vim configs for root.
# ===================================================================
value=$(grep -c "set -o vi" ~root/.bashrc)
if [ $value -eq 0 ]; then
echo 'set -o vi' >> ~root/.bashrc
fi
if [ ! -f ~root/.vimrc ]; then
touch ~root/.vimrc
fi
value=$(grep -c "set tabstop=2" ~root/.vimrc)
if [ $value -eq 0 ]; then
echo 'set tabstop=2' >> ~root/.vimrc
fi
# ===================================================================
# Setting up annoying shell and vim configs for vagrant.
# ===================================================================
value=$(grep -c "set -o vi" ~vagrant/.bashrc)
if [ $value -eq 0 ]; then
echo 'set -o vi' >> ~vagrant/.bashrc
fi
if [ ! -f ~vagrant/.vimrc ]; then
touch ~vagrant/.vimrc
chown vagrant.vagrant ~vagrant/.vimrc
fi
value=$(grep -c "set tabstop=2" ~vagrant/.vimrc)
if [ $value -eq 0 ]; then
echo 'set tabstop=2' >> ~vagrant/.vimrc
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment