Skip to content

Instantly share code, notes, and snippets.

@shawnbutts
Last active June 13, 2016 18:41
Show Gist options
  • Save shawnbutts/622e71ca1d62782d5d26f56ec5721a50 to your computer and use it in GitHub Desktop.
Save shawnbutts/622e71ca1d62782d5d26f56ec5721a50 to your computer and use it in GitHub Desktop.
#!/bin/bash
# turn a fresh centos 6 (vagrant) box into a dev box by installing python 2.6, 2.7, 3.5, and go 1.6
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
if [ -f "/root/.dev_env_built" ]; then
exit 0
fi
yum -y update
yum -y install git screen
yum clean all
curl https://bootstrap.pypa.io/get-pip.py | python -
# install go
mkdir -p ~/tmp/goi
cd ~/tmp/goi
wget https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.6.2.linux-amd64.tar.gz
echo 'mkdir -p ~/go' > /etc/profile.d/go.sh
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile.d/go.sh
echo 'export GOPATH=~/go' >> /etc/profile.d/go.sh
source /etc/profile.d/go.sh
cd ~/tmp
rm -rf ~/tmp/goi
# install pythons
mkdir -p ~/tmp/pyi
cd ~/tmp/pyi
yum groupinstall -y 'development tools'
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel xz-libs
wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
tar zxvf Python-2.7.11.tgz
cd ~/tmp/pyi/Python-2.7.11
./configure --prefix=/usr/local
make
make altinstall
cd ~/tmp/pyi/
wget --no-check-certificate "https://pypi.python.org/packages/45/5e/79ca67a0d6f2f42bfdd9e467ef97398d6ad87ee2fa9c8cdf7caf3ddcab1e/setuptools-23.0.0.tar.gz"
tar -xvf setuptools-23.0.0.tar.gz
cd setuptools-23.0.0
python2.7 setup.py install
curl https://bootstrap.pypa.io/get-pip.py | python2.7 -
cd ~/tmp/pyi
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
tar zxvf Python-3.5.1.tgz
cd ~/tmp/pyi/Python-3.5.1
./configure --prefix=/usr/local
make
make altinstall
cd /tmp
rm -rf /tmp/pyi
export HISTFILE=/dev/null; history -cw; rm -rf ~/.bash_history
export HISTFILE=/dev/null; history -cw; rm -rf ~/.bash_history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment