Skip to content

Instantly share code, notes, and snippets.

@rcmachado
Created December 21, 2010 20:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rcmachado/750531 to your computer and use it in GitHub Desktop.
Save rcmachado/750531 to your computer and use it in GitHub Desktop.
A Little script that installs python 2.7.1 + setuptools + pip + virtualenv on CentOS
#!/bin/bash
PYTHON_URL=http://python.org/ftp/python/2.7.1/Python-2.7.1.tar.bz2
SETUPTOOLS_URL=http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea
INSTALL_PREFIX=/home/rcmachado/python
# Abort scripts if some of the comands returns != 0
set -o errexit
# Abort if a variable that isn't defined is used
set -o nounset
TMP_DIR=`mktemp -d`
rollback() {
echo Cleaning up
rm -rf $TMP_DIR
}
trap rollback INT TERM EXIT
echo Using $TMP_DIR
cd $TMP_DIR
echo Installing Python
wget -nv $PYTHON_URL -O $TMP_DIR/python.tar.bz2
tar xjf $TMP_DIR/python.tar.bz2
cd Python-*
echo Configuring using $INSTALL_PREFIX prefix
./configure --prefix=$INSTALL_PREFIX
make
make install
PATH=$INSTALL_PREFIX/bin:$PATH
echo Installing setuptools
wget -nv $SETUPTOOLS_URL
bash setuptools-*.egg
echo Installing PIP
easy_install pip
echo Installing virtualenv
pip install virtualenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment