Welcome to FPS Gamer

Gaming, Server Administration, Linux

If you play in one of my game servers, do not forget to check your stats here

If you are also interested in games, linux or want to follow my blog, register now not to miss anything!

Member Login

Lost your password?

Registration is closed

Sorry, you are not allowed to register by yourself on this site!

You must either be invited by one of our team member or request an invitation by email at info {at} yoursite {dot} com.

Note: If you are the admin and want to display the register form here, log in to your dashboard, and go to Settings > General and click "Anyone can register".

Installing Python 2.6 on Debian Lenny

PythonDebian has always been my number one linux choice due to its stability on a server. Most of other linux distributions release new versions too frequently, in my opinion, while there are bugs still unfixed with the existing version. Having said that, many people think that packages on Debian stable repositories are out dated. That’s because Debian team makes an extensive testing before adding a new package to their repository as security is their first priority.

Well, I’m not in rush to test new software packages on my production server as security is also very important for me. However, I recently needed to install Python 2.6 and python-mysqldb on my Debian Lenny box. After some googling I’ve found the best and trouble free method as follows:

Howto install Python 2.6 and python-mysqldb on Debian

The secure way of installing an unstable package is to set up and use apt-pinning. Here are the steps to follow:

open sources.list with your favorite text editor.

#nano /etc/apt/sources.list

Edit your sources.list so it looks like this:

#
# deb cdrom:[Debian GNU/Linux 5.0.1 _Lenny_ - Official i386 NETINST Binary-1 20090413-22:27]/ lenny main
# deb cdrom:[Debian GNU/Linux 5.0.1 _Lenny_ - Official i386 NETINST Binary-1 20090413-22:27]/ lenny main

deb http://ftp.nl.debian.org/debian/ lenny main
deb-src http://ftp.nl.debian.org/debian/ lenny main

#testing repository
deb http://ftp.nl.debian.org/debian/ testing main
deb-src http://ftp.nl.debian.org/debian/ testing main

#unstable repository
deb http://ftp.nl.debian.org/debian/ unstable main
deb-src http://ftp.nl.debian.org/debian/ unstable main

deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main

deb http://volatile.debian.org/debian-volatile lenny/volatile main
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main

You can change the mirrors with your choice if you like. Then create a new file called “preferences” in /etc/apt folder

# nano /etc/apt/preferences

Copy and paste this to your new preferences file.

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

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

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

This file sets your priority order. First stable, then testing and finally unstable. The last step before installing new packages is to update your repositories.

# apt-get update

If no python is installed yet install Python2.5 first.
# apt-get install python python-central

Now you can install Python2.6 testing:
# aptitude install -t testing python-central
# aptitude install python2.6/testing

Making Python2.6 System Default

Open and edit /usr/share/python/debian_defaults
# nano /usr/share/python/debian_defaults

Make the following changes:

[DEFAULT]
# the default python version
default-version = python2.6

# all supported python versions
supported-versions = python2.5, python2.6

# formerly supported python versions
old-versions = python2.4

# unsupported versions, including older versions
unsupported-versions = python2.4

Finally change your symlink so it points to Python2.6:
# rm /usr/bin/python
# ln -s /usr/bin/python2.6 /usr/bin/python

That’s it! We’ll install python-mysqldb now.

Installing python-mysqldb

If you have python-mysqldb package installed already you need to uninstall it first.
# apt-get purge python-mysqldb
Now you can install the testing version of python-mysqldb to work with python2.6
# apt-get -t testing install python-mysqldb

ALL DONE! If you have a better and more secure way feel free to post your solution here!

Source:http://code.reddit.com/wiki/DependenciesOnDebian5

2 Responses to “Installing Python 2.6 on Debian Lenny”

  1. dominus.ceo Says:

    thank’s a lot for your procedure ..

  2. ta2-1 Says:

    thank’s!
    but be careful with dependencies,
    after getting python2.6 i needed libxslt and first setting up attempt had led me to system crush ((

Leave a Reply

*