Skip to content

Instantly share code, notes, and snippets.

@Crowles
Last active August 16, 2017 20:02
Show Gist options
  • Save Crowles/70202f5698c55999374f5ba56ce72c27 to your computer and use it in GitHub Desktop.
Save Crowles/70202f5698c55999374f5ba56ce72c27 to your computer and use it in GitHub Desktop.
Vagrant VM - extra provisioning script - merging individual scripts.
#!/bin/bash
if ! type vim > /dev/null; then
echo "installing vim"
yum install -y vim
else
echo "Vim installed, continuing"
fi
if ! type dos2unix > /dev/null; then
echo "installing dos2unix"
yum install -y dos2unix
else
echo "dos2unix installed, continuing"
fi
echo "installing YUM development tools"
# install a load of tools
yum groupinstall -y development
echo "installing additional packages"
# install more tools
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
if [ ! -f /usr/local/bin/python3.4 ]; then
echo "Python 3.4 not installed! Installing now"
echo "downloading source archive"
# download Python 3.4.0 archive
wget https://www.python.org/ftp/python/3.4.0/Python-3.4.0.tar.xz
echo "source archive is compressed using XZ library"
echo "installing XZ libs"
yum install -y xz-libs
echo "decoding XZ archive"
# decode XZ archive
xz -d Python-3.4.0.tar.xz
echo "extracting archive"
# extract the archive
tar -xvf Python-3.4.0.tar
# Enter the extracted directory
cd Python-3.4.0
echo "configuring Python 3.4.0"
# set installation directory
./configure --prefix=/usr/local
echo "compiling source"
# Using make altinstall so system default python isn't overridden
make
make altinstall
# access python without explicitly specifying path
export PATH="/usr/local/bin:$PATH"
else
echo "Python 3.4 is installed, continuing"
fi
if [ ! -f /usr/local/bin/pip ]; then
echo "Pip not installed! Installing now"
echo "installing pip dependencies"
# install setuptools
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
tar -xvf setuptools-1.4.2.tar.gz
# Enter the extracted directory:
cd setuptools-1.4.2
# Install setuptools using the Python 3.4
python3.4 setup.py install
echo "installing pip"
# pip python 3.4
curl https://bootstrap.pypa.io/get-pip.py | python3.4 -
else
echo "Pip is installed, continuing"
fi
if [ ! -f /usr/local/bin/virtualenv ]; then
echo "installing virtualenv"
# used to create isolated python environments
pip install virtualenv
else
echo "Virtualenv installed, continuing"
fi
if [ ! -f /usr/local/bin/pygmentize ]; then
echo "Installing Pygments"
pip install pygments
else
echo "Pygments is installed, continuing"
fi
echo "Adding ccat alias"
echo "alias ccat='pygmentize -g'" >> /home/vagrant/.bash_profile
echo "Reloading ~/.bash_profile"
source /home/vagrant/.bash_profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment