How-To: Install the Official Sun JDK in Ubuntu

Update: I wrote this to switch out the JRE in Ubuntu 10.04, and it’s still valid & works in Ubuntu 10.10 =D

The default java solution for Ubuntu 10.04 is the OpenJDK virtual machine and the IcedTea plugin for firefox – but I’ve been having serious issues with it locking up, taking up 100% CPU and other such craziness – so I’ve switched over to the (proprietary) official Sun JDK, and things are working much better. Here’s how I did it, and how you can too…

1.) Add the Lucid Partner repository to your Sources list

We’re going to be installing the Sun JDK through the repos, and it just so happens that we need the partner repo enabled, so you can either add the following line to your /etc/apt/sources.list, or you can check the box in System | Administration | Software Sources (assuming you’re using Gnome – pick whatever source managing front-end KDE uses if that’s your poison):

deb lucid partner


Sun JDK Add Repo

2.) Install the Sun JDK and Plugin

Before you install the good stuff, it’s an idea to check your current version so you can see the changeover’s worked. To do this, just run java -version from bash and you should see something like this:

java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8) (6b18-1.8-0ubuntu1)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

Once you know what you’ve currently got, again from the shell, enter the following to install the official Sun JDK (don’t worry about multiple JDKs being installed – we deal with that later):

sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

During this process you’ll have to agree to the license agreement – just hit Tab to switch focus in the text window onto the Yes button (assuming you do agree), and hit Enter to accept.

The JRE EULA - Slap the Tab key followed by Enter to ensure swift installation and that Oracle (they bought Sun, remember?) now own your first born child...

3.) Remove the old OpenJDK stuff

In Synaptic, you want to fully remove the following packages (if they’re installed – the top three in the below list might not be):


If you do this before installing the Sun JDK, all packages depending on Java will be removed as well – so in this rare instance, later is better, and any packages depending on Java can now stay on the system.

4.) Check it all works

From the command line enter: java -version and you should see the new details:

java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)

If you want the new plug-in to take effect in Firefox or such you need to restart the browser, then you should be all good to go! Maybe test it out at sodaplay for kicks too :)


How-To: Install or Build a Working Version of Handbrake for Ubuntu

Update: To install a working version of Handbrake in Ubuntu 10.10 or 11.04, you’ll need to install from the PPA, and you’re probably best off doing so like this…

First, you’ll need to add the Handbrake PPA (personal package archive) to your Ubuntu system. Open up a Terminal window and use this command:
For the official builds:

sudo add-apt-repository ppa:stebbins/handbrake-releases

Or for the nightly builds:

sudo add-apt-repository ppa:stebbins/handbrake-snapshots

After the repository has been added, update your system’s listing of its repositories with this command:

sudo apt-get update

Once the repository listings have been updated, you can then install the graphical version of Handbrake with this command:

sudo apt-get install handbrake-gtk

You can also install the command line version of Handbrake with this command:

sudo apt-get install handbrake-cli

Props to Jonathon Moeller for his write up on this 10.10 technique.

If You’re Still Want to Build Your Own Copy However…

The currently available pre-packaged version of Handbrake (the Video/DVD transcoder/ripper) at the time of writing is 0.9.4 (actual filename for the 64-bit version: HandBrake-0.9.4-Ubuntu_GUI_x86_64.deb) – and it’s about as much use as a chocolate teapot on Ubuntu 10.04… You simply can’t endcode/transcode with it because it’s broken, with the Add to Queue and Start buttons permanently greyed out because the functionality behind them is mashed.

So let’s build a fresh version that works!

Step 1.) Get the Necessary Libraries

A quick trip to the command line will get everything you need (where everything you already have in this list is simply ignored):

sudo apt-get install subversion yasm build-essential autoconf libtool zlib1g-dev libbz2-dev intltool libglib2.0-dev libdbus-glib-1-dev libgtk2.0-dev libgudev-1.0-dev libwebkit-dev libnotify-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

Step 2.) Get the Source Code

Create a folder for it, move to it, then grab the latest source code via subversion like this:

mkdir handbrake
cd handbrake
svn checkout svn:// hb-trunk

Step 3.) Build It!

Once we’re in the right place, this configure line with the given switch will configure and make Handbrake in one fell swoop:

cd hb-trunk
./configure --launch

Step 4.) Test It!

After a successful build, you’ll see the executable HandBrake-CLI in the build folder – but you’re probably after the GUI version, which is tucked away in build/gtk/src and called ghb – just go to the right folder, launch it and give it a try out – should be absolutely mint.

There are a stack of different options for the encoding process which can slow down the encode/transcode process and increase the quality – I went with these final settings to get high encoding quality without the encode process taking all week:

HandBrake - Working
HandBrake - Now Working! Woo-Hoo!


How-To: Transform Your Stock Ubuntu 10.04 Install into a Fully Operational Battle Station Operating System

I used to upgrade my Ubuntu distros after each release cycle, but it was never a very pleasant experience… There’d always be mismatched packages and configs, legacy cruft left lying around filling up my root partition, and all sorts of mismatch woes – so I ditched that for separate partitions for my root folder and home folders, and now wipe the root folder with the newest release as and when it’s out.

Because I’ve done this a couple of times over the last few years, I feel I’m getting pretty good at getting the machine up & running with everything I need at a pretty fast pace: maybe a day for all the core stuff, another to tweak the vast majority of everything so I have it as I want, and then just bits and pieces as they come up. This time, I thought I’d make a list of all the things I install (yes, I know you can automatically generate a list of installed packages) – because I also wanted to note why I install ’em, you know, what are they good for, so the next time I install a fresh system I can just grab it all even quicker.

Now, a stock/standard Ubuntu distro is a pretty good thing – but it doesn’t come with everything you need, so with that in mind, I’d like to present a list of things that I think you also need, and that once you have in place you’ll be able to do most anything you need with your system with just a few clicks. Before you do any of this, it’s a good idea to open up System | Administration | Software Sources and enable the restricted, universe and multiverse repositories as shown below:

Ubuntu Software Sources

With that done, here’s the list of things you’ll likely want to have installed in no particular-order, and only roughly sectioned off into classes (system, sound & media, social networking etc.):

Freely Available In The Ubuntu Repositories
Package Name Why Install It?
System / Developer / Essential
ubuntu-restricted-extras Meta-suite of proprietary software including the Flash plugin, DVD decoding libraries etc.
build-essentials Tools to compile your own/open-source projects
eclipse Multi-Language IDE – coding is good.
codeblocks Another multi-language IDE, I’ve not used it too much as yet, but I hear good things about it…
subversion Version control tool. Useful to checkout code trunks and compile open-source projects yourself
scons Python-based build system – req’d to compile SCons-based projects (More info:
guake Quake-style terminal access for gnome. Awesome stuff. Change the keybindings for copy and paste to Ctrl+C and Ctrl+V for usabilities sake.
nautilus-open-terminal Nautilus script that adds functionality to allow you to right-click on a folder and open a terminal at that point, saves you cd-ing all the way into long paths.
php5 It’s PHP. Version 5. Drags in apache2 with it.
deskbar Search applet for the panel – finds your programs in the menu, amongst a hundred other things. I really couldn’t live without this.
Utility / Office / Comms
thunderbird Thunderbird 3, my email client o’ choice. I’d written a guide for installing it in Ubuntu 9.10, but it’s in the repos in 10.04, so that’s now obsolete…
p7zip-full 7zip archiver. Better compression than zip and a completely open format.
pidgin Multi-chat-format-client (MSN, AOL, YahooMessenger etc.) I don’t like the packed-in empathy client too much…
pidgin-plugin-pack Additional plugins for pidgin.
xchat IRC (Internet Relay Chat) client
Audio / Video
audacity Very good audio editor
ripperx Decent audio CD ripper, use with LAME. Also, it’s the only ripper I’ve found that doesn’t randomly fall over if it doesn’t like a CD…

Warning: The current version (v2.7.2) has two bugs which are kinda scuppering it: it doesn’t add ID3 tags to tracks ripped beyond track 10, and it crashes at the end of each disc rip =/ It might be better to use something else for the time being, but I really don’t like SoundJuicer or anything, so I just run MusicBrainz Picard (package name: picard) on any folder of MP3s ripped from a disc to fix up the tags after ripping.

lame The best mp3 codec to rip audio with. Use high quality VBR and the results are superb.
soundconverter Easily convert audio files between formats.
pautils PulseAudio utils, stream choosers, volume controls etc.
gpodder Really good podcast client for gnome: subscribe to Linux Outlaws, This Week in Tech (TWiT) etc..
mplayer Useful to get data to transcode .avi files to to DVDs (see this article if you’re interested).
ccsm Compiz config settings manager – lets you tweak your compiz effects in countless ways…
compiz-fusion-plugins-extra Additional effects for compiz
fusionicon A system tray icon for accessing compiz related settings and switching/reloading window managers. Best to set it to autorun on boot through System | Preferences | Startup Applications.
python-sexy Library used by compiz to extend Gtk widget functionality.
gnome-colors Additional icon themes – more choice is never a bad thing.
screenlets Widget system for the gnome desktop. Grab some more screenlets from here if you like (the NVidia and FuriousMoon screenlets are useful/pretty respectively).
gimp The GNU Image Manipulation Program, which isn’t included on the CD for the first time this release..
gimp-plugin-registry Useful GIMP plugins, including “Save for Web…”, which is a daily-use tool for me…
cheese Mess around w/ your webcam
camera-monitor A panel applet which indicates when your webcam is switched on – so you’ll know if anybody else is messing around with your webcam!
blender 3D modelling package. I WILL learn how to use it this year, fo’ real!
povray An old-school but excellent ray-tracer (creates images by back-tracing light rays from geometry), always good for a mess around. Get povray-examples and povray-docs while you’re at it.
cbrpager A simple comic viewer for gnome
Administration / Files / Network
gadmin A suit of GUIs to administrate things on your system (proftpd, apache, squid etc.)
proftpd FTP server, requires a fair bit of configuration, but I’ve written pretty solid article on it here if you’re interested in hosting files on your own FTP server..
filezilla An excellent FTP client to connect to FTP servers.
sabnzbdplus A really good news group client – download stuff with far more peace of mind than using torrents. I’ve also written a guide for downloading stuff from newsgroups which you can find here if you’re that way inclined…
pypar2 Tool to repair broken/corrupted/incomplete rar files using PAR(ity) files. Use with sabnazbdplus as and when needed.
transmission An excellent bit-torrent client. Don’t forget to: Enable the block list & update it, change encryption settings from “preferred” to “required”, and disable DHT peer exchange (here’s why: unlinked – thread now gone)
dosbox A legacy PC emulator – run old DOS software if you need to. I use it to fire up ScreamTracker 3 occasionally.

There’s a few other things you might want which aren’t in the standard Ubuntu respositories, too. Such as:

Not Available In The Ubuntu Repositories
Application Name Why Install It? Get From
webmin Tool to administrate your system through a web interface either locally or over the web. Either restrict administration to be from the local network or make your passwords strong if you allow external access from teh Internets!
google-earth Gaze longingly at home, and the pyramids, and other neat stuff on this blue/green sphere.
google-picassa Nice image organiser/basic photo adjustment tool. Can categorise images by faces (poorly) too! [I had to install this from the commandline for some reason. Used: sudo gdebi ./picassa-3_0-blah-blah.deb to install] Newer versions not available for Linux =(
virtualbox Virtualisation software so you can run stuff like XP/Vista/Windows 7 from virtually from within Linux. Get this from Sun rather than the OSE (Open Source Edition) in the repositories if you want USB support.
handbrake Simple and yet powerful DVD ripper/video transcoder with a decent GUI. If you’re ripping a DVD just point it at the top level directory of the DVD and hit Open for it to pull in all the .vob files for you.

Update: Don’t bother installing version 0.9.4 on Ubuntu 10.04 – it’s broken. Build yourself a working version from the freshest source using this guide!
nautilus elementary Nice transparency effects for Nautilus
ubuntu tweak Tweak ubuntu like a mother-b

You might not need some of that stuff, but for me it turns a good basic install into the real deal that does everything I need. And I absolutely love it :D

How To: Get a Canon MP240 Printer Working in Ubuntu 10.04 32/64 Bit

The inkjet printer in our house is a Canon MP240 which is connected to the wife’s Windows-running laptop, while I’m on Ubuntu 10.04 64-bit, and although it takes a bit of effort to get them to play ball – they will talk and printing works just fine. To get it all up and running just follow these steps:

1.) Get the driver files

Head on over to: and enter Linux as your OS type and pick a language of choice, for the MP240 in English you’ll end up with a file called MP240_debian_drivers.tar. Extract it by right-clicking on it and selecting Extract Here from the pop-up menu, or running the command tar xvf ./MP240_debian_drivers.tar from the command line.

Once extracted, you’ll end up with a folder called the tar file name which has two files within it: MP240_debian_printer.tar and MP240_debian_printer_scangear.tar. Because this guide is about printing it’s the first file we’re after – so extract it using any of the two methods shown above, and again it’ll create a folder of the tar name, inside which you’ll find a tar.gz file (which you can safely ignore) and two deb files which are what we’re really after: cnijfilter-common_3.00-1_i386.deb and cnijfilter-mp240series_3.00-1_i386.deb.

2.) Repackage the deb OR get a libcupsys2 transitional package

Because Ubuntu has transferred from libcupsys2 to libcups, we have the option of using our mighty linux skills to repackage the debs to use libcups by reading this, but it’s a bit tech, and we don’t really have to. Instead, we can just install the transitional package from good ol’ Jaunty by heading over to this page: (link now broken – see local mirror of file below – or don’t use at all [see update 2!]).

The link to download the transitional deb is the one – just click on it to download, then double click on the file to install it. Nice – almost there!

Update: The link to the transitional package is no longer working, but as I still have a copy I’ve made it available here: libcupsys2_1.3.9-17ubuntu3.9_all.deb

Update 2: I see that some people have had success without using the libcupsys2 transitional package at all, just by ignoring the dependency. I haven’t tried it myself, but from what I read you can skip this step entirely by using the following commands for step 3:

sudo dpkg -i --ignore-depends=libcupsys2 --force-architecture cnijfilter-common_3.00-1_i386.deb
sudo dpkg -i --ignore-depends=libcupsys2 --force-architecture cnijfilter-mp240series_3.00-1_i386.deb

3.) Install / Force Install of the MP240 drivers

If you’re running 10.04 32-bit then you can just install the canon debs by running the following two lines at the command line:

sudo dpkg -i cnijfilter-common_3.00-1_i386.deb
sudo dpkg -i cnijfilter-mp240series_3.00-1_i386.deb

If, like me, you’re running 64-bit Linux, then you need to force dpkg to ignore the architecture differences like this:

sudo dpkg -i  --force-architecture cnijfilter-common_3.00-1_i386.deb
sudo dpkg -i  --force-architecture cnijfilter-mp240series_3.00-1_i386.deb

4.) Add your printer

With that done, we’re ready to set up the printer, so go to System | Administration | Printing from the gnome panel (or your printing config tool of choice if you’re using KDE or whatnot) and the printer driver will be available for you to use. Because I’m going across the network to get to the printer I’m clicking on [Add] then picking Windows Printer via SAMBA. You can just hit [Browse] without entering an IP or path or anything to browse detected workgroups on your network.

Selecting a CanonMP240 through SAMBA

Once you’ve selected the printer and clicked [OK] you can click [Forward] and then Canon as the driver manufacturer and you’ll find the MP240 driver in your list like this:

Canon MP240 Driver Selected

Select it, click [Forward] again and print off a test page – you should be all set! Cheers! =D