What is the fastest way to install Python 2.6 on an Ubuntu 8.04 server?
I just got an Ubuntu server set up, and it seems to have come with Python 2.5. I've been developing my app in Python 2.6, but apt-cache search ^python
seems to not contain 2.6. What is the fastest way to update the repositories apt-get
looks through to include one that has Python 2.6?
(Answer mixed in reply/reply-comments: fastest way is to upgrade to Ubuntu 9.04 or later)
apt-get update; apt-get install python2.6
works for me [ jaunty ], but you might have older version of ubuntu. fiddle a bit with /etc/apt/sources.list and apt-get distr-upgrade as described here.
There is a Python 2.6 package for Ubuntu, http://packages.ubuntu.com/search?keywords=python2.6, but only for the jaunty
and karmic
releases. You could possibly grab the .deb
file and install it on previous versions, but things may break..
If apt-get
fails you, compiling from source is trivial:
# change this to latest on http://python.org/download/
PY_TWOSIX="http://python.org/ftp/python/2.6.2/Python-2.6.2.tgz"
# Required to compile anything - this is the only Ubuntu specific line
sudo apt-get install build-essential
# Download/extract the Python source file set in PY_TWOSIX
cd /tmp/
wget $PY_TWOSIX -O py.tgz
gunzip py.tgz
tar -xf py.tar
cd Python-*
# Configure, build and install it into /usr/local/python/2.6.2/
./configure --prefix=/usr/local/python/2.6.2
make
sudo make install
# Link python binary into /usr/local/bin/ as python2.6
sudo ln -s /usr/local/python/2.6.2/bin/python /usr/local/bin/python2.6
# you can also at add the directory to your $PATH rather than using sym-links
Of course you should try and install everything via your package manager (so you get automatic updates and such), but I tend to keep old versions of Python around, and putting them in /usr/local/python/
shouldn't interfere with apt-get
at all.