Easy Way To Upgrade From Default Python 2.4 To Python 2.7

If you have Linux server with Python 2.4 by default and You want to upgrade it? Here you go.

This an easy way to upgrade from default Python 2.4 to Python 2.7.3. I'm not expert on Linux but this way is works for me and it will not collide with your default Python. To run your bot, you're using python2.7 instead of python.

Now here we go.
Login to server using ssh client like Putty or whatever is. Check python version, if you see 2.4.x then go step above to upgrade.

  1. mkdir tmp (you can change "tmp" to whatever you what. its just a folder name)
  2. cd tmp
  3. wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 
  4. tar jxf Python-2.7.3.tar.bz2 
  5. ./configure
  6. If you get the following error:
    configure: error: no acceptable C compiler found in $PATH
    do this step:
    - yum install gcc tcl tk sqlite-devel readline-devel gdbm-devel
    - yum install tkinter ncurses-devel libdbi-devel tk-devel zlib-devel
    - yum install openssl-devel bzip2-devel

    go to /tmp/Python-2.7.3 directory (cd /tmp/Python-2.7.3) then repeat step 5 again. Wait until finish then go to next step

  7. make
  8. make altinstall prefix=/tmp/python2.7.3
  9. cd /tmp
  10. ln -s /tmp/python2.7.3 /tmp/python2.7
Now time to setup bot file. Upload, extract and configure your bot then follow this step to run your bot!!
- screen [enter]
- alias python2.7=/tmp/python2.7/bin/python2.7 [enter]
- python2.7 bot/bot.py [enter]
- close your ssh client
- violaaaaa.....

PS: if get the following error with "yum" like this -bash: yum: command not found, try this;
sudo apt-get update
sudo apt-get install yum rpm