Install Java 6 on Debian Lenny (5.0)

Despite its numerous problems and frequent needs for updates, Java is still used for a lot of software. That sadly means it must be installed to run Java applications. Due to the fact that Java is not open source, it classifies as a non-free install in linux and therefore cannot be available by default due to some legal jibberjabber (yeah, just made that up).

Here's how it's installed on Debian Lenny.

First off we need to modify our repository sources to search and install non-free software. To do this, let's open 'er up in our favorite editor VIM.

Seriously though, you're welcome to use another editor if you want to. I will only judge you a little. :)

vim /etc/apt/sources.list

From here we need to make a few modifications. The following sources.list is from a fresh default install of Debian. *.

deb http://ftp.us.debian.org/debian/ lenny main contrib non-free deb-src http://ftp.us.debian.org/debian/ lenny main deb http://security.debian.org/ lenny/updates main contrib non-free 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
 * 1) deb cdrom:[Debian GNU/Linux 5.0.6 _Lenny_ Official i386 NETINST Binary-1 20100905-11:24]/ lenny main
 * 2) deb cdrom:[Debian GNU/Linux 5.0.6 _Lenny_ Official i386 NETINST Binary-1 20100905-11:24]/ lenny main
 * 1) deb cdrom:[Debian GNU/Linux 5.0.6 _Lenny_ Official i386 NETINST Binary-1 20100905-11:24]/ lenny main

Basically all we just did was add "contrib non-free" to the end of two repositories. Not too bad, eh?

Next we need to update our package manager. To do this...

apt-get update

Finally, install the Java software you need. In my case, sun-java6-jre

apt-get install sun-java6-jre

Annnnnnd away we go!