Skip to content

Instantly share code, notes, and snippets.

@claytantor
Last active August 29, 2015 14:14
Show Gist options
  • Save claytantor/92300fb5a31ffe60c0fb to your computer and use it in GitHub Desktop.
Save claytantor/92300fb5a31ffe60c0fb to your computer and use it in GitHub Desktop.
installing python 2.7.6.for django
cd ~/src
sudo yum groupinstall "Development tools"
sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
sudo yum install httpd-devel
wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
sudo make && sudo make altinstall
python
mkdir ez_setup
cd ez_setup/
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo /usr/local/bin/python2.7 ez_setup.py
sudo /usr/local/bin/easy_install-2.7 pip
sudo vi /etc/init.d/httpd
#edit the file and add the new library path to /usr/local/lib in the vars section
#export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
#update the mod_wsgi conf
sudo vi /etc/httpd/conf.d/wsgi.conf
#LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so
#check that it starts
sudo service httpd restart
#make a new virtualenv and istall requirements
cd ~/python/env
/usr/bin/virtualenv -p /usr/local/bin/python2.7 venv_273
source venv_273/bin/activate
cd ~/sites/myapp
pip install -r ./requirements.txt
#update the http conf to use the new virtual env
sudo vi /etc/httpd/conf/httpd.conf
#WSGIPythonHome /home/ec2-user/python/env/venv_273
#check that it starts
sudo service httpd restart
#check the appache error logs for python 2.7
#Apache/2.2.29 (Unix) DAV/2 mod_ssl/2.2.29 OpenSSL/1.0.1k-fips mod_wsgi/4.4.7 Python/2.7.6 configured -- resuming normal operations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment