How do I install Python 2.6 on Debian 5.0 (lenny) using apt-get?

18,354

Solution 1

This is a good way to break your system; you'll wind up upgrading all sorts of stable things to unstable, and you'll have trouble from then on, because Debian isn't designed to run on a system that's halfway stable and halfway unstable.

A better way is a backport, but it's not straightforward to backport 2.6 to lenny apparently.

Solution 2

Use Apt-Pinning.

I'm not yet very used to this concept, but it seems to basically means that you configure your Debian system in a way such that you can install packages from stable, testing, untested (and potentially other repositories such as backports) directly using apt-get, without breaking (too much) the dependencies of the system, because by default it will use stable, and only when you want it it will search in the other repositories.

This is a very nice, ergonomic and safe way to update only some parts of a Debian system to the latest releases, without breaking the dependencies and the global stability of the system.

A nice tutorial about Apt-Pinning: http://jaqque.sbih.org/kplug/apt-pinning.html

I am using Lenny with Plesk on a dedicated virtual host, here's my config files, made on 2012-01-11:

apt.conf

APT::Cache-Limit "16777216";

sources.list

#Stable
deb http://ftp.de.debian.org/debian lenny main contrib non-free
deb http://ftp.de.debian.org/debian-volatile lenny/volatile main contrib non-free
deb http://ftp.de.debian.org/debian-security lenny/updates main contrib non-free

#Proposed updates
deb http://ftp.de.debian.org/debian lenny-proposed-updates main contrib non-free
deb http://ftp.de.debian.org/debian-volatile lenny-proposed-updates/volatile main contrib non-free

#Testing
deb http://ftp.de.debian.org/debian testing main contrib non-free

#Unstable
deb http://ftp.de.debian.org/debian unstable main contrib non-free

#Backports
deb http://ftp.de.debian.org/debian-backports lenny-backports main contrib non-free

#Plesk (? what does it do? install additional modules from the webinterface?)
#Uncomment the next line only if you have Plesk installed.
#deb http://autoinstall.plesk.com/debian/PSA10 lenny all

preferences

Package: *
Pin: release a=stable
Pin-Priority: 700

Package: *
Pin: release a=lenny-proposed-updates
Pin-Priority: 650

Package: *
Pin: release a=testing
Pin-Priority: 600

Package: *
Pin: release a=unstable
Pin-Priority: 550

Package: *
Pin: release a=lenny-backports
Pin-Priority: 500

These files are all to be placed under the directory /etc/apt/

Then, you can just use apt-get python, and it will directly install python 2.7 on your system with all the dependencies! And if you want to install newer versions (such as 3.x), you can try the advices given in the page I've linked to force looking into other repositories:

apt-get install <package>/unstable
#This will install the unstable version of the package, and try to meet any dependencies from Stable.

or

apt-get -t unstable install <package>
#This will install the Unstable version of the package, and try to meet any dependencies from Unstable.
Share:
18,354

Related videos on Youtube

Nick Bolton
Author by

Nick Bolton

Hello, I'm the CEO of Symless, the company behind Synergy, software that lets you share one mouse and keyboard between multiple computers.

Updated on September 17, 2022

Comments

  • Nick Bolton
    Nick Bolton almost 2 years

    After some digging and experimentation, I figured out how to install Python 2.6 on Debian 5.0 using apt-get. So I thought it best to post on SF as a question and answer. I know this can be manually built and installed, but many people prefer to use apt-get (including myself).

  • Zoredache
    Zoredache over 14 years
    Unstable will always be sid, not just currently. If you are going to include testing packages, you might also want to setup pinning (jaqque.sbih.org/kplug/apt-pinning.html), so you only get the packages from unstable that you really need.
  • mark
    mark over 13 years
    Since this answer perfectly describe how to break your system and if one doesn't thoroughly reads the other answer and commits, it's