Skip to content

Instantly share code, notes, and snippets.

@CasperCL
Last active November 15, 2018 14:07
Show Gist options
  • Save CasperCL/6f2c730b4605df87d93b1aa878eec03b to your computer and use it in GitHub Desktop.
Save CasperCL/6f2c730b4605df87d93b1aa878eec03b to your computer and use it in GitHub Desktop.
Install Python X.X + mod_wsgi on Linux from source
# !/bin/bash
# Source http://blog.dscpl.com.au/2015/06/installing-custom-python-version-into.html
PYTHON_VERSION="3.6"
sudo apt-get install apache2-dev -y
cd /tmp
git clone https://github.com/python/cpython.git
cd cpython
git checkout "$PYTHON_VERSION"
sudo -H ./configure --enable-shared --enable-optimizations
sudo -H make
sudo -H make install
# Reload ld cache so it can be found by other sources that need to link to it
ldconfig
sudo -H make distclean
sudo -H ./configure --enable-optimizations
sudo -H make
sudo -H make altbininstall
sudo apt-get remove libapache2-mod-wsgi-py3
cd /tmp
git clone https://github.com/GrahamDumpleton/mod_wsgi.git
cd mod_wsgi
./configure --with-python='/usr/local/bin/python"$PYTHON_VERSION"'
make
sudo make install
sudo a2enmod wsgi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment