odyniec.net

Running Multiple Versions of Firefox in Ubuntu 9.10

Here’s a simple howto on running several different versions of Firefox in Ubuntu 9.10. This is the setup that I use to test my jQuery plugins and other JavaScript code — I hope some of you fellow developers out there will find it useful too. The basic advantage of this solution is that is does not clutter your basic system with unnecessary software packages, as all the additional files are stored in your home directory and nowhere else.

I’m going to create a directory where all the different Firefox versions will reside. I have a dedicated directory for any software that I can’t or don’t want to install the standard way (using apt), and it is located in my home directory – /home/michal/opt. It serves a similar purpose as the system-wide opt directory, which is intended for “optional” software.

$ mkdir /home/michal/opt/firefoxes

There it is. Now, I’m going to get all those versions of Firefox that I want to run. As of this writing, the version running in my system is 3.5.7. I decided to also install the latest version of the 3.0 series (3.0.17), the prehistoric 2.0.0.20 release, as well as the freshly released Firefox 3.6.

Actually, according to browser usage statistics (such as those run by Clicky and StatCounter), Firefox 2.0 has a market share below one percent, so it’s questionable whether web developers should still care about it. I just happen to like to see if new versions of my jQuery plugins still work in the older browsers, so I’m going to install it.

Binary packages for all Firefox releases can be downloaded from the Mozilla FTP server at ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/. Here are the respective URLs for the versions that I’ve chosen:

So now I’ll go to the firefoxes directory and download the three packages with wget (of course, you can also download them using your browser or any FTP client):

$ cd /home/michal/opt/firefoxes $ wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/2.0.0.20/linux-i686/en-US/firefox-2.0.0.20.tar.gz $ wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.0.17/linux-i686/en-US/firefox-3.0.17.tar.bz2 $ wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.6/linux-i686/en-US/firefox-3.6.tar.bz2

The files are gzipped or bzipped tar packages, so I need to uncompress them. Let’s start with the Firefox 2 package:

$ tar zxvf firefox-2.0.0.20.tar.gz

Each package extracts to a directory named firefox, so if I just uncompress the tarballs one after another, all the different versions are going to go into the same directory and the files will get mixed up and overwritten. To prevent that, I’ll rename each directory after it is extracted:

$ mv firefox firefox-2.0

Now the other two:

$ tar jxvf firefox-3.0.17.tar.bz2 $ mv firefox firefox-3.0 $ tar jxvf firefox-3.6.tar.bz2 $ mv firefox firefox-3.6

Ok, so now I have three directories in /home/michal/opt/firefoxes, each holding a different release of Firefox.

Each version needs a separate user profile — otherwise, it won’t be possible to run them simultaneously, and worse, it might break the default profile which is used by the system version. I’m going to create new profiles for the three versions by running Firefox with the -no-remote and -CreateProfile options:

$ firefox -no-remote -CreateProfile firefox-2.0 $ firefox -no-remote -CreateProfile firefox-3.0 $ firefox -no-remote -CreateProfile firefox-3.6

That’s it for the basic setup — I can now try running the Firefoxes. Let’s start with the ancient version 2.0:

$ cd firefox-2.0 $ ./firefox -no-remote -P firefox-2.0 ./firefox-bin: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

Whooops. Grandpa Firefox 2.0 says it won’t run, unless it has the libstdc++.so.5 library. However, Ubuntu 9.10 comes with a newer version of libstdc++, and the obsolete release is no longer available. But that’s no big deal, as I can just get it elsewhere — for example, at packages.debian.org:

http://ftp.us.debian.org/debian/pool/main/g/gcc-3.3/libstdc++5_3.3.6-18_i386.deb

So let’s grab it:

$ cd .. $ wget http://ftp.us.debian.org/debian/pool/main/g/gcc-3.3/libstdc++5_3.3.6-18_i386.deb

Since it’s a .deb package, I could simply install it with dpkg — but, I want to keep my system sterile clean and not clutter it with outdated packages that only some old Firefox release needs. Let’s have a look at the files that this package would install — I’ll use a combination of ar and tar (in case you’d be interested, this blog post at G-Loaded Journal explains the use of these commands):

$ ar p libstdc++5_3.3.6-18_i386.deb data.tar.gz | tar zt ./ ./usr/ ./usr/share/ ./usr/share/doc/ ./usr/share/doc/libstdc++5/ ./usr/share/doc/libstdc++5/README.Debian ./usr/share/doc/libstdc++5/TODO.Debian ./usr/share/doc/libstdc++5/copyright ./usr/share/doc/libstdc++5/changelog.Debian.gz ./usr/lib/ ./usr/lib/libstdc++.so.5.0.7 ./usr/lib/libstdc++.so.5

Apparently, there’s a couple documentation files that I can ignore. What I’m interested in are the two library files in ./usr/liblibstdc++.so.5.0.7 and libstdc++.so.5 (actually, that’s just one library file, as libstdc++.so.5 is a symbolic link to libstdc++.so.5.0.7), and I’m going to extract just those two files. Moreover, I don’t want tar to create the usr/lib directory structure (as it normally would), I just want the two files to be placed in the firefox-2.0 directory, and for all that to happen I’ll use this lengthy command:

$ ar p libstdc++5_3.3.6-18_i386.deb data.tar.gz | tar zx ./usr/lib/libstdc++.so.5.0.7 ./usr/lib/libstdc++.so.5 --transform 's!./usr/lib/!firefox-2.0/!'

What this command does is it extracts the two library files from the package, then translates their full paths, substituting ./usr/lib with firefox-2.0, so the files should end up where I want them. Let’s see:

$ ls firefox-2.0/libstdc++* firefox-2.0/libstdc++.so.5  firefox-2.0/libstdc++.so.5.0.7

Great. Now I can try launching Firefox 2 again, but I also have to tell it that it should look for the libstdc++.so.5 library file in its own directory. There’s an environmental variable that serves this purpose called LD_LIBRARY_PATH — all I need to do is set it to “.” (which corresponds to the current directory) and run Firefox with that setting:

$ cd firefox-2.0 $ LD_LIBRARY_PATH=. ./firefox -no-remote -P firefox-2.0

Success! We can now party like it’s 2008.

Firefox 2.0 About Window

The other two versions should run smoothly without complaining about libraries.

$ cd ../firefox-3.0 $ ./firefox -no-remote -P firefox-3.0

$ cd ../firefox-3.6 $ ./firefox -no-remote -P firefox-3.6

Enjoy your multiple Firefoxes!

2 Responses to “Running Multiple Versions of Firefox in Ubuntu 9.10”

  1. Rakesh yadav says:

    This helped me a lot , thank you very much – through this steps I have create multiple versions of firefox in ubuntu /SUSE/CentOS/Fedora- for testing purpose.

    Thanks a lot
    /Rakesh

  2. PabloV says:

    Really thank you !

Leave a Reply