Skip to content

Instantly share code, notes, and snippets.

@vanquishregret
Forked from jgumbley/install_python.sh
Created November 17, 2011 04:25
Show Gist options
  • Save vanquishregret/1372355 to your computer and use it in GitHub Desktop.
Save vanquishregret/1372355 to your computer and use it in GitHub Desktop.
setup python 2.7.2 on CENTOS 5.* server
# wget -O install_python.sh https://gist.github.com/raw/777001/install_python.sh
# chmod +x install_python.sh
# ./install_python.sh
#!/bin/sh
echo "******************************************"
echo "Configure Centos box with a recent version"
echo "of Python. "
echo " - jgumbley 12/jan/11"
echo "******************************************"
echo " - Get source for Python"
cd /usr/local/src
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar xvfz Python-2.7.2.tgz
echo " - Install compilers"
yum -y install gcc gdbm-devel readline-devel ncurses-devel zlib-devel bzip2-develsqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel make
echo " - Compile Python source"
cd Python-2.7.2
./configure --prefix=/opt/python2.7.2 --with-threads --enable-shared
make
make install
echo " - Add shared libraries in"
touch /etc/ld.so.conf.d/opt-python2.7.2.conf
echo "/opt/python2.7.2/lib/" >> /etc/ld.so.conf.d/opt-python2.7.2.conf
ldconfig
echo " - Create SymLink to updated version"
ln -sf /opt/python2.7.2/bin/python /usr/bin/python2.7
echo " - Install SetupTools."
cd /usr/local/src
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sh setuptools-0.6c11-py2.7.egg --prefix=/opt/python2.7.2
echo " - Install pip."
/opt/python2.7.2/bin/easy_install pip
ln -sf /opt/python2.7.2/bin/pip /usr/bin/pip
echo " - Install virtualenv."
pip install virtualenv
ln -sf /opt/python2.7.2/bin/virtualenv /usr/bin/virtualenv
echo " - Pipe alias into .zshrc "
echo "alias python=/opt/python2.7.2/bin/python" >> ~/.bashrc
source ~/.bashrc
# wget -O install_python.sh https://gist.github.com/raw/777001/install_python.sh
# chmod +x install_python.sh
# ./install_python.sh
#!/bin/sh
echo "******************************************"
echo "Configure Centos box with apache and "
echo "mod_wsgi for running flask apps "
echo " - jgumbley 15/jan/11"
echo "******************************************"
echo " # install required apache pre-reqs "
yum -y install httpd httpd-devel
echo " # download mod_wsgi source "
cd /usr/local/src/
wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
tar xvfz mod_wsgi-3.3.tar.gz
echo " # compile mod_wsgi source "
cd mod_wsgi-3.3
./configure --with-python=/opt/python2.7.2/bin/python
make
make install
echo " # pipe module into httpd config"
echo "LoadModule wsgi_module /usr/lib/httpd/modules/mod_wsgi.so" >> /etc/httpd/conf/httpd.conf
service httpd restart
Copy link

ghost commented Apr 6, 2014

/opt/python2.7.2/bin/python: No such file or directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment