Thursday 16 July 2009

How-To: Install Latest Firefox in Ubuntu - Complete Guide

This guide explains several methods on installing the latest Firefox in Ubuntu, including installing it from a PPA repository.

I. Install Firefox from the Firefox PPA repository
1. The CLI (command-line interface) way
This is probably the easiest method. Don't forget to read the Creating a new profile section below after installing Firefox.

A PPA (Personal Package Archives) is a repository for Ubuntu which contains usually newer versions of applications which come in the default Ubuntu repositories. For example there are PPAs for Amarok, for Banshee, for Firefox, for VLC etc.

In order to install the latest Firefox available from a PPA, just follow the steps below:

Add the following two lines to your /etc/apt/sources.list file:

deb http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main

You can do this using your favourite text editor with root privileges (e.g. sudo nano /etc/apt/sources.list or gksudo gedit /etc/apt/sources.list). Don't forget to save the file after you're done. To save it in Nano, use Ctrl+O followed by Enter, then Ctrl+X to exit Nano.

The same can be accomplished by running the following commands:

sudo bash -c "echo 'deb http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main' >> /etc/apt/sources.list"

sudo bash -c "echo 'deb-src http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main' >> /etc/apt/sources.list"

After you're done editing /etc/apt/sources.list, just update the package lists:

sudo apt-get update

Or use Update from Synaptic. To install Firefox, use:

sudo apt-get install firefox-3.5

This will install the latest Firefox available (currently release 3.5).

An alternate way of doing this is graphically, explained below:

Go to System -> Administration -> Synaptic Package Manager and enter your user password. In Synaptic, go to Settings -> Repositories and click on the Third Party Software tab. Click the Add button and enter the two lines I shown above, one at a time. Then click the Reload button to update the package lists.


Next, enter firefox in the Quick search field and select the firefox-3.5 package (or whatever version you want to install) from the list that appears. Mark it for installation, together with all the other dependencies it needs. Then, click the Apply button.


II. Install Firefox directly from their .tar.bz2 archive
1. The CLI way
First, download the Firefox tarball from the official website (replace firefox-3.5.tar.bz2 with the version you want to download):

Next, make sure the current directory is the one where you saved the tarball and uncompress it:

tar -xjf firefox-3.5.tar.bz2

The same, replace the version number with the one you have.

Next, move the firefox directory to a location of your choice, or you can leave it on the desktop or inside your home directory. I use ~/apps/ here, where ~ is my home directory. The following step is to make a shortcut to Firefox:

ln -s "~/firefox/firefox -P --no-remote" Firefox

2. The graphical way
After downloading the Firefox tarball, open Nautilus and uncompress it:


After extracting it, a new directory called firefox will appear. Now, you need to create a shortcut on the desktop (or wherever you want it) to the new Firefox binary. Right-click on the desktop, hit Create Launcher and fill in the fields as in the screenshot below, replacing your username.


Notice that although the --no-remote parameter is optional, you should use the -P parameter in order to open the profile manager window, so you can choose to create a new profile for the newly installed Firefox. Later on, you can edit this launcher and remove the -P argument. Keep in mind that if you don't use the --no-remote parameter, you will have to close first any existing Firefox 3.0.11 instances.

Creating a new profile
This step is very important, since it will allow you to create a new, different profile for your new Firefox installation. Of course, you can use your old profile too if you need to keep bookmarks, add-ons and other stuff. To create a new profile, run firefox with the -P parameter:

~/firefox/firefox -P

This will open the profile manager. I will create a profile called firefox35 for this example.


Notice that you can run two different instances of Firefox at the same time (e.g. the default Firefox 3.0.11 and Firefox 3.5). Just run it as:

~/firefox/firefox --no-remote -P

The --no-remote switch tells Firefox not to connect to any existing instances, so you won't get the 'Firefox is already running' message.

Finally, if you decided to create a new profile but still need bookmarks and other stuff from the old profile, copy the following files in Nautilus into the new profile directory:

places.sqlite (bookmarks)
key3.db (stored passwords information)
signon.sqlite (stored passwords information - copy this and key3.db file if you want to have the stored passwords in your new profile)

Notice that your default Firefox profile is stored inside a directory with a name which goes like RANDOM_CHARS.default.

Additional resources
I can warmly recommend this thread on UbuntuForums.org, and also installing Firefox at psychocats.net. This entry in the Ubuntu Wiki can prove useful too, and don't forget my other entry about installing Firefox 3.5 in Ubuntu 9.04.

4 comments:

hemanth.hm said...

How about one line command to do the job

wget -O - http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.5/linux-i686/en-US/firefox-3.5.tar.bz2 | tar xj -C ~

More : http://www.h3manth.com/2009/07/installing-firefox-35.html

Anonymous said...

What is the key? I don't mean to complain but everytime I follow instructions like this on someones site they never give the key for the repository. And synaptic ends up complaining it can't reload the repository. It all sounds so simple when you give the instructions but it just leaves me frustrated because I can't install the package.

Anonymous said...

Hey you forgot the key,

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247510BE

at "I. Install Firefox from the Firefox PPA repository"

Check: https://launchpad.net/~ubuntu-mozilla-daily/+archive/ppa
And: https://launchpad.net/+help/soyuz/ppa-sources-list.html

Anonymous said...

Hi, How do you add the key to synaptic?