-
-
Save donilan/9987079 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
# Install stuff # | |
################# | |
# Install development tools and some misc. necessary packages | |
yum -y groupinstall "Development tools" | |
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel mysql-devel libxml2-devel libxslt-devel unixODBC-devel sqlite sqlite-devel -y | |
# Alias shasum to == sha1sum (will prevent some people's scripts from breaking) | |
echo 'alias shasum="sha1sum"' >> $HOME/.bashrc | |
# Install Python 2.7.4 (do NOT remove 2.6, by the way) | |
if [ ! -e ./Python-2.7.4 ] | |
then | |
wget --no-check-certificate http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2 | |
tar xf Python-2.7.4.tar.bz2 | |
fi | |
if [ ! -e /usr/local/bin/python2.7 ] | |
then | |
( cd Python-2.7.4 && ./configure --prefix=/usr/local && make && make altinstall ) | |
fi | |
# Install easy install | |
echo "[easy_install]" >> ~/.pydistutils.cfg | |
echo "index_url = http://pypi.douban.com/simple" >> ~/.pydistutils.cfg | |
mkdir ~/.pip | |
echo "[global]" >> ~/.pip/pip.conf | |
echo "index-url = http://pypi.douban.com/simple" >> ~/.pip/pip.conf | |
wget http://peak.telecommunity.com/dist/ez_setup.py | |
sed -i 's/pypi.python.org/pypi.douban.com/' ez_setup.py | |
python ez_setup.py && easy_install pip | |
# Install virtualenv and virtualenvwrapper | |
# Once you make your first virtualenv, you'll have 'pip' in there. | |
# I got bitten by trying to install a system-wide (i.e. Python 2.6) version of pip; | |
# it was clobbering my access to pip from within virtualenvs, and it was frustrating. | |
# So these commands will install virtualenv/virtualenvwrapper the old school way, | |
# just so you can make yourself a virtualenv, with pip, and then do everything Python-related | |
# that you need to do, from in there. | |
if [ ! -e virtualenv-1.9.1.tar.gz ] | |
then | |
wget --no-check-certificate http://pypi.douban.com/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz#md5=07e09df0adfca0b2d487e39a4bf2270a | |
tar -xvzf virtualenv-1.9.1.tar.gz | |
fi | |
( cd virtualenv-1.9.1 && python setup.py install ) | |
if [ ! -e virtualenvwrapper-4.0 ] | |
then | |
wget --no-check-certificate http://pypi.douban.com/packages/source/v/virtualenvwrapper/virtualenvwrapper-4.0.tar.gz#md5=78df3b40735e959479d9de34e4b8ba15 | |
tar -xvzf virtualenvwrapper-* | |
fi | |
( cd virtualenvwrapper-4.0 && python setup.py install ) | |
echo 'export WORKON_HOME=~/Envs' >> $HOME/.bashrc # Change this directory if you don't like it | |
source $HOME/.bashrc | |
mkdir -p $WORKON_HOME | |
echo 'source /usr/local/bin/virtualenvwrapper.sh' >> $HOME/.bashrc | |
source $HOME/.bashrc | |
echo Done! | |
echo Now you can do: mkvirtualenv foo --python=python2.7 | |
# Extra stuff # | |
############### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment