Skip to content

Instantly share code, notes, and snippets.

@iDevPy
Forked from floer32/centos_python_env_setup
Last active May 26, 2025 23:19
Show Gist options
  • Save iDevPy/7f66a2b9522bec7aa4e4 to your computer and use it in GitHub Desktop.
Save iDevPy/7f66a2b9522bec7aa4e4 to your computer and use it in GitHub Desktop.

Revisions

  1. EDUCANET INC revised this gist Dec 18, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -45,8 +45,8 @@ make && make altinstall
    cd ${USERHOME}
    chown -R ${USER} /usr/local/bin
    chown -R ${USER} /usr/local/lib
    easy_install-3.5 virtualenv
    easy_install-3.5 virtualenvwrapper
    easy_install-${PYSHORT} virtualenv
    easy_install-${PYSHORT} virtualenvwrapper
    echo "export WORKON_HOME=${USERHOME}/.virtualenvs" >> ${USERHOME}/.bashrc # Change this directory if you don't like it
    echo "export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.5" >> ${USERHOME}/.bashrc
    echo "export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv" >> ${USERHOME}/.bashrc
  2. EDUCANET INC revised this gist Dec 18, 2015. No changes.
  3. EDUCANET INC revised this gist Dec 18, 2015. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -45,12 +45,15 @@ make && make altinstall
    cd ${USERHOME}
    chown -R ${USER} /usr/local/bin
    chown -R ${USER} /usr/local/lib
    easy_install-${PYSHORT} virtualenv
    easy_install-${PYSHORT} virtualenvwrapper
    easy_install-3.5 virtualenv
    easy_install-3.5 virtualenvwrapper
    echo "export WORKON_HOME=${USERHOME}/.virtualenvs" >> ${USERHOME}/.bashrc # Change this directory if you don't like it
    echo "export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.5" >> ${USERHOME}/.bashrc
    echo "export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv" >> ${USERHOME}/.bashrc
    echo 'source /usr/local/bin/virtualenvwrapper.sh' >> ${USERHOME}/.bashrc # Important, don't change the order.
    source ${USERHOME}/.bashrc
    mkdir -p ${WORKON_HOME}
    chown -R ${USER} ${WORKON_HOME}
    chown -R ${USER} ${USERHOME}
    # Done!
    # Now you can do: `mkvirtualenv foo`
  4. EDUCANET INC revised this gist Dec 18, 2015. 1 changed file with 44 additions and 49 deletions.
    93 changes: 44 additions & 49 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -1,61 +1,56 @@
    #!/bin/bash

    # Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/

    # Install stuff #
    #################

    #####################################################################
    # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    # Version 2, December 2004
    # Copyright (C) 2015 Ivan Rivera

    # Everyone is permitted to copy and distribute verbatim or modified
    # copies of this license document, and changing it is allowed as long
    # as the name is changed.

    # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

    # 0. You just DO WHAT THE FUCK YOU WANT TO.
    ######################################################################
    ## IMPORTANT ##
    # Run this script with root (sudo su -), wont work if run as sudo.
    # Change the variables as needed.
    ######################################################################
    USER=youruser # User that will have ownership (chown) to /usr/local/bin and /usr/local/lib
    USERHOME=/home/${USER} # The path to the users home, in this case /home/youruser
    PYSHORT=3.5 # The Python short version, e.g. easy_install-${PYSHORT} = easy_install-3.5
    PYTHONVER=3.5.1 # The actual version of python that you want to download from python.org

    cd ${USERHOME}
    # Install development tools and some misc. necessary packages
    yum -y groupinstall "Development tools"
    yum -y install zlib-devel # gen'l reqs
    yum -y install bzip2-devel openssl-devel ncurses-devel # gen'l reqs
    yum -y install mysql-devel # req'd to use MySQL with python ('mysql-python' package)
    yum -y install libxml2-devel libxslt-devel # req'd by python package 'lxml'
    yum -y install unixODBC-devel # req'd by python package 'pyodbc'
    yum -y install sqlite sqlite-devel # you will be sad if you don't install this before compiling python, and later need it.
    yum -y install sqlite sqlite-devel xz-devel
    yum -y install readline-devel tk-devel gdbm-devel db4-devel
    yum -y install libpcap-devel xz-devel # you will be sad if you don't install this before compiling python, and later need it.
    # Alias shasum to == sha1sum (will prevent some people's scripts from breaking)
    echo 'alias shasum="sha1sum"' >> $HOME/.bashrc
    # Install Python 2.7.4 (do NOT remove 2.6, by the way)
    wget --no-check-certificate http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2
    tar xf Python-2.7.4.tar.bz2
    cd Python-2.7.4
    ./configure --prefix=/usr/local
    echo 'alias shasum="sha1sum"' >> ${USERHOME}/.bashrc
    # Install Python ${PYTHONVER} (do NOT remove 2.7, by the way)
    wget --no-check-certificate https://www.python.org/ftp/python/${PYTHONVER}/Python-${PYTHONVER}.tgz
    tar -zxvf Python-${PYTHONVER}.tgz
    cd ${USERHOME}/Python-${PYTHONVER}
    ./configure --prefix=/usr/local LDFLAGS="-Wl,-rpath /usr/local/lib" --with-ensurepip=install
    make && make altinstall
    # Install virtualenv and virtualenvwrapper
    # Once you make your first virtualenv, you'll have 'pip' in there.
    # I got bitten by trying to install a system-wide (i.e. Python 2.6) version of pip;
    # it was clobbering my access to pip from within virtualenvs, and it was frustrating.
    # So these commands will install virtualenv/virtualenvwrapper the old school way,
    # just so you can make yourself a virtualenv, with pip, and then do everything Python-related
    # that you need to do, from in there.
    wget --no-check-certificate https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz#md5=07e09df0adfca0b2d487e39a4bf2270a
    tar -xvzf virtualenv-1.9.1.tar.gz
    python virtualenv-1.9.1/setup.py install
    wget --no-check-certificate https://pypi.python.org/packages/source/v/virtualenvwrapper/virtualenvwrapper-4.0.tar.gz#md5=78df3b40735e959479d9de34e4b8ba15
    tar -xvzf virtualenvwrapper-*
    python virtualenvwrapper-4.0/setup.py install
    echo 'export WORKON_HOME=~/Envs' >> .bashrc # Change this directory if you don't like it
    source $HOME/.bashrc
    mkdir -p $WORKON_HOME
    echo '. /usr/bin/virtualenvwrapper.sh' >> .bashrc
    source $HOME/.bashrc

    cd ${USERHOME}
    chown -R ${USER} /usr/local/bin
    chown -R ${USER} /usr/local/lib
    easy_install-${PYSHORT} virtualenv
    easy_install-${PYSHORT} virtualenvwrapper
    echo "export WORKON_HOME=${USERHOME}/.virtualenvs" >> ${USERHOME}/.bashrc # Change this directory if you don't like it
    echo "export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.5" >> ${USERHOME}/.bashrc
    echo 'source /usr/local/bin/virtualenvwrapper.sh' >> ${USERHOME}/.bashrc # Important, don't change the order.
    source ${USERHOME}/.bashrc
    mkdir -p ${WORKON_HOME}
    # Done!
    # Now you can do: `mkvirtualenv foo --python=python2.7`

    # Extra stuff #
    ###############

    # These items are not required, but I recommend them

    # Add RPMForge repo
    sudo yum -y install http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
    yum updateinfo
    # Install trash-cli (safer than 'rm', see here: https://github.com/andreafrancia/trash-cli)
    sudo yum -y install python-unipath
    sudo yum install http://pkgs.repoforge.org/trash-cli/trash-cli-0.11.2-1.el6.rf.i686.rpm

    # Add EPEL repo (more details at cyberciti.biz/faq/fedora-sl-centos-redhat6-enable-epel-repo/)
    cd /tmp
    wget --no-check-certificate http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
    rpm -ivh epel-release-6-8.noarch.rpm
    # Now you can do: `mkvirtualenv foo`
  5. @hangtwenty hangtwenty revised this gist Sep 25, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -35,10 +35,10 @@ wget --no-check-certificate https://pypi.python.org/packages/source/v/virtualenv
    tar -xvzf virtualenvwrapper-*
    python virtualenvwrapper-4.0/setup.py install
    echo 'export WORKON_HOME=~/Envs' >> .bashrc # Change this directory if you don't like it
    . $HOME/.bashrc
    source $HOME/.bashrc
    mkdir -p $WORKON_HOME
    echo '. /usr/bin/virtualenvwrapper.sh' >> .bashrc
    . $HOME/.bashrc
    source $HOME/.bashrc

    # Done!
    # Now you can do: `mkvirtualenv foo --python=python2.7`
  6. @hangtwenty hangtwenty revised this gist Sep 25, 2013. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ yum -y install sqlite sqlite-devel # you will be sad if you don't install this
    # Alias shasum to == sha1sum (will prevent some people's scripts from breaking)
    echo 'alias shasum="sha1sum"' >> $HOME/.bashrc
    # Install Python 2.7.4 (do NOT remove 2.6, by the way)
    wget http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2
    wget --no-check-certificate http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2
    tar xf Python-2.7.4.tar.bz2
    cd Python-2.7.4
    ./configure --prefix=/usr/local
    @@ -28,10 +28,10 @@ make && make altinstall
    # So these commands will install virtualenv/virtualenvwrapper the old school way,
    # just so you can make yourself a virtualenv, with pip, and then do everything Python-related
    # that you need to do, from in there.
    wget https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz#md5=07e09df0adfca0b2d487e39a4bf2270a
    wget --no-check-certificate https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz#md5=07e09df0adfca0b2d487e39a4bf2270a
    tar -xvzf virtualenv-1.9.1.tar.gz
    python virtualenv-1.9.1/setup.py install
    wget https://pypi.python.org/packages/source/v/virtualenvwrapper/virtualenvwrapper-4.0.tar.gz#md5=78df3b40735e959479d9de34e4b8ba15
    wget --no-check-certificate https://pypi.python.org/packages/source/v/virtualenvwrapper/virtualenvwrapper-4.0.tar.gz#md5=78df3b40735e959479d9de34e4b8ba15
    tar -xvzf virtualenvwrapper-*
    python virtualenvwrapper-4.0/setup.py install
    echo 'export WORKON_HOME=~/Envs' >> .bashrc # Change this directory if you don't like it
    @@ -57,5 +57,5 @@ sudo yum install http://pkgs.repoforge.org/trash-cli/trash-cli-0.11.2-1.el6.rf.i

    # Add EPEL repo (more details at cyberciti.biz/faq/fedora-sl-centos-redhat6-enable-epel-repo/)
    cd /tmp
    wget http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
    wget --no-check-certificate http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
    rpm -ivh epel-release-6-8.noarch.rpm
  7. @hangtwenty hangtwenty revised this gist Sep 25, 2013. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,6 @@ tar xf Python-2.7.4.tar.bz2
    cd Python-2.7.4
    ./configure --prefix=/usr/local
    make && make altinstall
    set -o vi
    # Install virtualenv and virtualenvwrapper
    # Once you make your first virtualenv, you'll have 'pip' in there.
    # I got bitten by trying to install a system-wide (i.e. Python 2.6) version of pip;
  8. @hangtwenty hangtwenty revised this gist Sep 25, 2013. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -22,11 +22,6 @@ cd Python-2.7.4
    ./configure --prefix=/usr/local
    make && make altinstall
    set -o vi
    # Install distribute
    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
    # Install virtualenv and virtualenvwrapper
    # Once you make your first virtualenv, you'll have 'pip' in there.
    # I got bitten by trying to install a system-wide (i.e. Python 2.6) version of pip;
  9. @hangtwenty hangtwenty revised this gist Sep 25, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ echo 'alias shasum="sha1sum"' >> $HOME/.bashrc
    wget http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2
    tar xf Python-2.7.4.tar.bz2
    cd Python-2.7.4
    ./configure --prefix=/opt/python2.7
    ./configure --prefix=/usr/local
    make && make altinstall
    set -o vi
    # Install distribute
    @@ -30,7 +30,7 @@ python2.7 setup.py install
    # Install virtualenv and virtualenvwrapper
    # Once you make your first virtualenv, you'll have 'pip' in there.
    # I got bitten by trying to install a system-wide (i.e. Python 2.6) version of pip;
    # it was clobbering my access to pip from within virtualenvs, and it was a bad scene.
    # it was clobbering my access to pip from within virtualenvs, and it was frustrating.
    # So these commands will install virtualenv/virtualenvwrapper the old school way,
    # just so you can make yourself a virtualenv, with pip, and then do everything Python-related
    # that you need to do, from in there.
  10. @floer32 floer32 revised this gist May 17, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,7 @@ yum -y install bzip2-devel openssl-devel ncurses-devel # gen'l reqs
    yum -y install mysql-devel # req'd to use MySQL with python ('mysql-python' package)
    yum -y install libxml2-devel libxslt-devel # req'd by python package 'lxml'
    yum -y install unixODBC-devel # req'd by python package 'pyodbc'
    yum -y install sqlite sqlite-devel # you will be sad if you don't install this before compiling python, and later need it.
    # Alias shasum to == sha1sum (will prevent some people's scripts from breaking)
    echo 'alias shasum="sha1sum"' >> $HOME/.bashrc
    # Install Python 2.7.4 (do NOT remove 2.6, by the way)
  11. @floer32 floer32 revised this gist May 9, 2013. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -7,9 +7,11 @@

    # Install development tools and some misc. necessary packages
    yum -y groupinstall "Development tools"
    yum -y install zlib-devel
    yum -y install bzip2-devel openssl-devel ncurses-devel
    yum -y install MySQL-python
    yum -y install zlib-devel # gen'l reqs
    yum -y install bzip2-devel openssl-devel ncurses-devel # gen'l reqs
    yum -y install mysql-devel # req'd to use MySQL with python ('mysql-python' package)
    yum -y install libxml2-devel libxslt-devel # req'd by python package 'lxml'
    yum -y install unixODBC-devel # req'd by python package 'pyodbc'
    # Alias shasum to == sha1sum (will prevent some people's scripts from breaking)
    echo 'alias shasum="sha1sum"' >> $HOME/.bashrc
    # Install Python 2.7.4 (do NOT remove 2.6, by the way)
  12. @floer32 floer32 revised this gist May 9, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,7 @@
    yum -y groupinstall "Development tools"
    yum -y install zlib-devel
    yum -y install bzip2-devel openssl-devel ncurses-devel
    yum -y install MySQL-python
    # Alias shasum to == sha1sum (will prevent some people's scripts from breaking)
    echo 'alias shasum="sha1sum"' >> $HOME/.bashrc
    # Install Python 2.7.4 (do NOT remove 2.6, by the way)
  13. @floer32 floer32 revised this gist May 9, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -39,7 +39,7 @@ python virtualenvwrapper-4.0/setup.py install
    echo 'export WORKON_HOME=~/Envs' >> .bashrc # Change this directory if you don't like it
    . $HOME/.bashrc
    mkdir -p $WORKON_HOME
    echo '. /usr/bin/virtualenvwrapper.sh' >> .bashrc # installs to not-quite-standard location for some reason.
    echo '. /usr/bin/virtualenvwrapper.sh' >> .bashrc
    . $HOME/.bashrc

    # Done!
  14. @floer32 floer32 revised this gist May 9, 2013. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -23,10 +23,6 @@ wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.27.tar.g
    tar xf distribute-0.6.27.tar.gz
    cd distribute-0.6.27
    python2.7 setup.py install
    # Add EPEL repo (more details at cyberciti.biz/faq/fedora-sl-centos-redhat6-enable-epel-repo/)
    cd /tmp
    wget http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
    rpm -ivh epel-release-6-8.noarch.rpm
    # Install virtualenv and virtualenvwrapper
    # Once you make your first virtualenv, you'll have 'pip' in there.
    # I got bitten by trying to install a system-wide (i.e. Python 2.6) version of pip;
    @@ -60,3 +56,8 @@ yum updateinfo
    # Install trash-cli (safer than 'rm', see here: https://github.com/andreafrancia/trash-cli)
    sudo yum -y install python-unipath
    sudo yum install http://pkgs.repoforge.org/trash-cli/trash-cli-0.11.2-1.el6.rf.i686.rpm

    # Add EPEL repo (more details at cyberciti.biz/faq/fedora-sl-centos-redhat6-enable-epel-repo/)
    cd /tmp
    wget http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
    rpm -ivh epel-release-6-8.noarch.rpm
  15. @floer32 floer32 revised this gist May 9, 2013. 1 changed file with 12 additions and 5 deletions.
    17 changes: 12 additions & 5 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -27,12 +27,19 @@ python2.7 setup.py install
    cd /tmp
    wget http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
    rpm -ivh epel-release-6-8.noarch.rpm
    # Install pip; note that the package is named 'python-pip' whereas the executable will be named 'pip-python', for some reason
    yum -y install python-pip
    echo 'alias pip="/usr/bin/pip-python"' >> $HOME/.bashrc
    . $HOME/.bashrc
    # Install virtualenv and virtualenvwrapper
    sudo pip-python install virtualenv virtualenvwrapper
    # Once you make your first virtualenv, you'll have 'pip' in there.
    # I got bitten by trying to install a system-wide (i.e. Python 2.6) version of pip;
    # it was clobbering my access to pip from within virtualenvs, and it was a bad scene.
    # So these commands will install virtualenv/virtualenvwrapper the old school way,
    # just so you can make yourself a virtualenv, with pip, and then do everything Python-related
    # that you need to do, from in there.
    wget https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz#md5=07e09df0adfca0b2d487e39a4bf2270a
    tar -xvzf virtualenv-1.9.1.tar.gz
    python virtualenv-1.9.1/setup.py install
    wget https://pypi.python.org/packages/source/v/virtualenvwrapper/virtualenvwrapper-4.0.tar.gz#md5=78df3b40735e959479d9de34e4b8ba15
    tar -xvzf virtualenvwrapper-*
    python virtualenvwrapper-4.0/setup.py install
    echo 'export WORKON_HOME=~/Envs' >> .bashrc # Change this directory if you don't like it
    . $HOME/.bashrc
    mkdir -p $WORKON_HOME
  16. @floer32 floer32 revised this gist May 9, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ echo 'alias shasum="sha1sum"' >> $HOME/.bashrc
    wget http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2
    tar xf Python-2.7.4.tar.bz2
    cd Python-2.7.4
    ./configure --prefix=/usr/local
    ./configure --prefix=/opt/python2.7
    make && make altinstall
    set -o vi
    # Install distribute
  17. @floer32 floer32 revised this gist May 9, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,8 @@
    yum -y groupinstall "Development tools"
    yum -y install zlib-devel
    yum -y install bzip2-devel openssl-devel ncurses-devel
    # Alias shasum to == sha1sum (will prevent some people's scripts from breaking)
    echo 'alias shasum="sha1sum"' >> $HOME/.bashrc
    # Install Python 2.7.4 (do NOT remove 2.6, by the way)
    wget http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2
    tar xf Python-2.7.4.tar.bz2
  18. @floer32 floer32 revised this gist May 9, 2013. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -30,9 +30,8 @@ yum -y install python-pip
    echo 'alias pip="/usr/bin/pip-python"' >> $HOME/.bashrc
    . $HOME/.bashrc
    # Install virtualenv and virtualenvwrapper
    ENVS_DIR='~/Envs' # Change this if you don't like this location, of course
    sudo pip-python install virtualenv virtualenvwrapper
    echo 'export WORKON_HOME=$ENVS_DIR' >> .bashrc
    echo 'export WORKON_HOME=~/Envs' >> .bashrc # Change this directory if you don't like it
    . $HOME/.bashrc
    mkdir -p $WORKON_HOME
    echo '. /usr/bin/virtualenvwrapper.sh' >> .bashrc # installs to not-quite-standard location for some reason.
  19. @floer32 floer32 revised this gist May 9, 2013. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,6 @@ tar xf Python-2.7.4.tar.bz2
    cd Python-2.7.4
    ./configure --prefix=/usr/local
    make && make altinstall
    /usr/local/bin/python2.7
    set -o vi
    # Install distribute
    wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.27.tar.gz
  20. @floer32 floer32 revised this gist May 9, 2013. 1 changed file with 43 additions and 7 deletions.
    50 changes: 43 additions & 7 deletions centos_python_env_setup
    Original file line number Diff line number Diff line change
    @@ -2,18 +2,54 @@

    # Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/

    yum groupinstall "Development tools"
    yum install zlib-devel
    yum install bzip2-devel openssl-devel ncurses-devel
    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
    # Install stuff #
    #################

    # Install development tools and some misc. necessary packages
    yum -y groupinstall "Development tools"
    yum -y install zlib-devel
    yum -y install bzip2-devel openssl-devel ncurses-devel
    # Install Python 2.7.4 (do NOT remove 2.6, by the way)
    wget http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2
    tar xf Python-2.7.4.tar.bz2
    cd Python-2.7.4
    ./configure --prefix=/usr/local
    make && make altinstall
    /usr/local/bin/python2.7
    set -o vi
    # Install distribute
    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
    /usr/local/bin/easy_install-2.7 virtualenv
    # Add EPEL repo (more details at cyberciti.biz/faq/fedora-sl-centos-redhat6-enable-epel-repo/)
    cd /tmp
    wget http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
    rpm -ivh epel-release-6-8.noarch.rpm
    # Install pip; note that the package is named 'python-pip' whereas the executable will be named 'pip-python', for some reason
    yum -y install python-pip
    echo 'alias pip="/usr/bin/pip-python"' >> $HOME/.bashrc
    . $HOME/.bashrc
    # Install virtualenv and virtualenvwrapper
    ENVS_DIR='~/Envs' # Change this if you don't like this location, of course
    sudo pip-python install virtualenv virtualenvwrapper
    echo 'export WORKON_HOME=$ENVS_DIR' >> .bashrc
    . $HOME/.bashrc
    mkdir -p $WORKON_HOME
    echo '. /usr/bin/virtualenvwrapper.sh' >> .bashrc # installs to not-quite-standard location for some reason.
    . $HOME/.bashrc

    # Done!
    # Now you can do: `mkvirtualenv foo --python=python2.7`

    # Extra stuff #
    ###############

    # These items are not required, but I recommend them

    # Add RPMForge repo
    sudo yum -y install http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
    yum updateinfo
    # Install trash-cli (safer than 'rm', see here: https://github.com/andreafrancia/trash-cli)
    sudo yum -y install python-unipath
    sudo yum install http://pkgs.repoforge.org/trash-cli/trash-cli-0.11.2-1.el6.rf.i686.rpm
  21. @floer32 floer32 renamed this gist May 9, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  22. @stantonk stantonk created this gist Nov 15, 2012.
    19 changes: 19 additions & 0 deletions doit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/bin/bash

    # Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/

    yum groupinstall "Development tools"
    yum install zlib-devel
    yum install bzip2-devel openssl-devel ncurses-devel
    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
    /usr/local/bin/python2.7
    set -o vi
    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
    /usr/local/bin/easy_install-2.7 virtualenv