Skip to content

@hobson /install_python_on_shared_host.sh
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
# Install python and some binary-dependencies from source in the user directory
# useful for Django webapps on shared hosts like Dreamhost
# BerkelyDB v 4.8 is supported by python 2.7 but not 5.3
# In addition, the bsddb module was deprecated in Python 2.6 and will be removed in 3.0
# So all this BDB stuff isn't useful, but does no harm
# linuxfromscratch.com has patch that can make python 2.7 work with BerkelyDB, if you need it
BDBVER=5.3.21
BDBVE=5.3
export LDFLAGS="-L$HOME/local/lib -L$HOME/local/BerkeleyDB.$BDBVE/lib"
export CPPFLAGS="-I$HOME/local/include -I$HOME/local/BerkeleyDB.$BDBVE/include"
export CXXFLAGS=$CPPFLAGS
export CFLAGS=$CPPFLAGS
export LD_LIBRARY_PATH=$HOME/local/lib:$HOME/local/BerkeleyDB.$BDBVE/lib
export LD_RUN_PATH=$LD_LIBRARY_PATH
mkdir -p ~/bin ~/tmp ~/local
# _tkinter = TCL and TK
# TCL = Tool Command Language -- a dynamic programming langage
# TK = GUI Toolkit for TCL
# Berkeley DB build needs _tkinter so install TCL first
# may need to scrape a source-forge page to get the latest version
VER=8.6.0
cd ~/tmp
wget http://prdownloads.sourceforge.net/tcl/tcl$VER-src.tar.gz
tar zxvf tcl$VER-src.tar.gz
cd tcl$VER/unix
./configure --prefix=$HOME/local
make
make install
cd ~/tmp
wget http://prdownloads.sourceforge.net/tcl/tk$VER-src.tar.gz
tar zxvf tk$VER-src.tar.gz
cd tk$VER/unix
./configure --prefix=$HOME/local
make
make install
VER=$BDBVER
VE=$BDBVE
cd ~/tmp
wget http://download.oracle.com/berkeley-db/db-$VER.tar.gz
tar zxvf db-$VER.tar.gz
cd db-$VER/build_unix
../dist/configure --prefix=$HOME/local/BerkeleyDB.$VE --enable-tcl --with-tcl=$HOME/local/lib
make
make install
VER=1.0.6
VE=1.0
cd ~/tmp
wget http://www.bzip.org/$VER/bzip2-$VER.tar.gz
tar zxvf bzip2-$VER.tar.gz
cd bzip2-$VER
make -f Makefile-libbz2_so
make
make install PREFIX=$HOME/local
cp ./libbz2.so.$VER $HOME/local/lib
ln -s $HOME/local/lib/libbz2.so.$VER $HOME/local/lib/libbz2.so.$VE
VER=2.7.3
VE=2.7
cd ~/tmp
wget http://python.org/ftp/python/$VE/Python-$VE.tgz
tar zxvf Python-$VE.tgz
cd Python-$VE
./configure --prefix=$HOME/local/Python-$VE
make
make install
rm -rf ~/tmp/*
cd ~
echo "export PATH=\"$HOME/local/bin:\$PATH\"" >> .bashrc
echo "export PATH=\"$HOME/local/Python-$VE/bin:\$PATH\"" >> .bashrc
source .bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.