This guide is one section of a larger guide to installing a cent 6.x server in virtual box for development purposes with different applications. The top level guide with links to all of the sections is here: https://gist.github.com/ryanguill/5149058 Some instructions in this guide may assume a configuration from other parts of the guide.
#Install Python 2.7.x
Following instructions from: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/
log in as root
# su -
Install Development Tools (this should have been installed already if you followed the steps from above, but we need to make sure)
# yum groupinstall "Development tools"
Install some other requirements (also most likely installed, but need to be sure)
# yum install zlib-devel
# yum install bzip2-devel
# yum install openssl-devel
# yum install ncurses-devel
Find the latest version of the 2.7 python branch: http://www.python.org/download/
You are looking for the Python 2.7.3 bzipped source tarball, http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 at the time of writing this
Make sure you are in your home directory
# cd ~
# pwd
should return /root
Note: still trying to figure out if /usr/local is the best place to put this, but it works well for now
Note: the altinstall vs install is VERY IMPORTANT - if you use install YOU WILL BREAK THE OS IN LIKELY UNRECOVERABLE WAYS
Note: these steps may take a few minutes, especially configure and the install, be patient
# wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
# tar xf Python-2.7.3.tar.bz2
# cd Python-2.7.3
# ./configure --prefix=/usr/local
# make && make altinstall
Start the python 2.7 REPL to verify installation
# python2.7
you should get a REPL that looks something like this:
[root@cent6-tmpl Python-2.7.3] # python2.7
Python 2.7.3 (default, Feb 11 2013, 10:02:30)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
use exit() to get out of the REPL
The system version of python (that is required for the os to function) should be available as /usr/bin/python and /usr/bin/python2.6
Set up distribute
Note: you must use python2.7 for the fourth line!
# wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.27.tar.gz
# tar xf distribute-0.6.27.tar.gz
# cd distribute-0.6.27
# python2.7 setup.py install
validate that it installed properly
# cd /usr/local/bin
# ls -la
you should see an easy_install and an easy_install-2.7
Install virtualenv
Go back to your home directory
# cd ~
# easy_install-2.7 virtualenv
test it out:
# virtualenv test
# cd test
# source bin/activate
you should get a prompt that looks like (test)[root@cent6-tmpl test]#
# deactivate
Clean up after yourself
# cd ~
# rm Python-2.7.3.tar.bz2
# rm -rf Python-2.7.3
# rm -rf test
Done installing python 2.7