红联Linux门户
Linux帮助

Getting Sun Java 6 On Debian 4.0 With APT Pinning

发布时间:2007-11-11 00:16:27来源:红联作者:rchivedz
All the noise about Leopard and Java6 last week made me thinking: Does my favorite operating systems include the JDK? And if so, which version?

The answer, of course, is that Windows does come with a JRE, but it's at version 1.1; and that Debian comes with a incomplete open source JRE that's roughly at version 1.4.

Debian 4.0, however, makes getting the higher versions of Java easy. Sun Java 5 is available in Debian 4.0's stable software repository, while Sun Java 6 is available in the Debian unstable software repository. Since neither are free software, they can only be found in the non-free section of the repositories.

Enabling the non-free section of the stable repository in very easy, as I documented here 136 days ago.

Enabling the unstable repository in Debian 4.0 is something that I don't want to do lightly, for I don't want to upgrade every package in my system to the bleeding edge, at least not yet. Jonathan mentioned "APT pinning" when I asked him about this at the time. And learning about APT pinning I did yesterday.

The three degrees of APT pinning
I have gone through three documents that I found on the Google about APT Pinning.

First there's the very clear Apt-Pinning for Beginners. It outlines exactly what to do to enable the testing and unstable repositories in Debian in such a way as to favor the stable repositories's contents.

But I have some unanswered questions, so I went to the Debian Wiki's AptPinning page. It provided a few more recipe's of doing APT pinning. I particularly like the "only if I say so" approach.

But I still have some unanswered questions, so I went to the authoritative source--the man page of apt_preferences(5). This man page is on my hard drive all along. And to read a printed out copy I issued the command

[weiqi@gao]$ man -Tps apt_preferences | lpr
This six-page document contains explanations of every detail of the things that I need to do.

The steps
Here's the steps I took to get Sun JDK 6 to my Debian GNU/Linux 4.0 system (the right way):

Add a line to /etc/apt/sources.list: # deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official amd64 DVD Binary-1 200704 07-12:15]/ etch contrib main deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official amd64 DVD Binary-1 20070407 -12:15]/ etch contrib main deb http://ftp.debian.org/debian/ etch main non-free deb-src http://ftp.debian.org/debian/ etch main non-free deb http://security.debian.org/ etch/updates main contrib non-free deb-src http://security.debian.org/ etch/updates main contrib non-free deb http://www.debian-multimedia.org etch main deb http://www.dipconsultants.com/debian etch main ### unstable ####### deb http://ftp.debian.org/debian/ unstable main non-free
Add a line to /etc/apt/apt.conf.d/70debconf: // Pre-configure all packages with debconf before they are installed. // If you don't like it, comment it out. DPkg:re-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";}; APT::Cache-Limit "100000000";
Created /etc/apt/preferences: Package: * Pin: release a=stable Pin-Priority: 700 Package: * Pin: release a=unstable Pin-Priority: 600
Run apt-get update
Install the eight sun-java6-* packages
sun-java6-bin
sun-java6-demo
sun-java6-doc
sun-java6-fonts
sun-java6-javadb
sun-java6-jdk
sun-java6-jre
sun-java6-source
with [root@gao]# feta install s Notice that the sun-java6-doc package requires that I download the JDK documentation from Sun's Java download site and put the zip file in /tmp.
文章评论

共有 0 条评论