Why would you want to install the Mozilla version of Firefox?
Copy and paste terminal commands
Notes
Commands to remove Mozilla's version
Use a script to automate the commands
Point-and-click all the way
Why would you want to install the Mozilla version of Firefox?
There's usually no reason anyone would have to install the Mozilla version of Firefox. The Ubuntu repositories version receives security updates and is integrated with the filesystem. If you use the Mozilla version, you'll have to integrate it with the filesystem so that it launches properly and uses the right multimedia plugins, and you'll also have to do manual security updates.
Some people like to use the Mozilla version because they think it gives better performance. Others want a newer version of Firefox than their version of Ubuntu will offer (for example, Firefox 3 on Ubuntu 7.10). Whatever your reasons, this page should help you get the latest Mozilla build of Firefox installed on your system properly.
Copy and paste terminal commands
The fastest and easiest way to get the Mozilla version of Firefox installed is copying and pasting the following commands into the terminal.
These commands assume you've downloaded the Firefox .tar.bz2 file to your home directory (/home/username/):
cp -R ~/.mozilla ~/.mozilla.backup
sudo tar -jxvf firefox-3*.tar.bz2 -C /opt
rm firefox-3*.tar.bz2
sudo mv /opt/firefox/plugins /opt/firefox/plugins.backup
sudo ln -s /usr/lib/firefox/plugins /opt/firefox/plugins
sudo dpkg-divert --divert /usr/bin/firefox.ubuntu --rename /usr/bin/firefox
sudo ln -s /opt/firefox/firefox /usr/bin/firefox
That's it.
If you want more explanation as to what these commands actually do, you can read more on the Ubuntu wiki.
Notes
If you're using Ubuntu 7.04 (Feisty Fawn), you may also have to add in these commands:
sudo dpkg-divert --divert /usr/bin/mozilla-firefox.ubuntu --rename /usr/bin/mozilla-firefox
sudo ln -s /opt/firefox/firefox /usr/bin/mozilla-firefox
In Ubuntu 7.10 and Ubuntu 8.04, there is no
/usr/bin/mozilla-firefox, so those commands have been omitted from the general instructions.
In addition to assuming you have the Firefox .tar.bz2 file in your /home/username directory, the instructions also assume you've never installed the Mozilla version of Firefox to the /opt directory before. If you had installed Mozilla's Firefox 2 previously, then run the removal commands (below) before running the installation commands (above).
Commands to remove Mozilla's version
Sometimes people want to revert back to Ubuntu's Firefox and get rid of the Mozilla version of Firefox. If you want to do that, paste these commands into the terminal:
sudo rm /usr/bin/firefox
sudo dpkg-divert --rename --remove /usr/bin/firefox
sudo rm -r /opt/firefox
It's very important that you
paste that last command. Do not retype it, as altering the command in any way (pressing
Enter prematurely by accident, for example) could delete more than Mozilla's Firefox.
I've generally found that Firefox profiles work (apart from no-longer-compatible extensions) from version to version of Firefox, but if you have a corrupt Firefox profile and if you used the cp -R ~/.mozilla ~/.mozilla.backup command to back up your Firefox settings before installing the Mozilla version, then you can restore your old settings with these commands:
mv ~/.mozilla ~/.mozilla.mozillafirefox
mv ~/.mozilla.backup ~/.mozilla
Use a script to automate the commands
If you would like a script to automate the installation of Mozilla's Firefox, you can download it here.
It takes a bit longer, but it's slightly different from just copying and pasting the instructions:
- The script automatically checks to see the latest version of Firefox that's available.
- The script will download Firefox for you and ask you what localized version you want.
- The script will try several download mirrors if the first doesn't work.
- The script allows you to easily install and remove the Mozilla build of Firefox.
- The script also allows you to easily install and remove the Mozilla builds of Thunderbird and Seamonkey.
Point-and-click all the way
If you have a deathly fear of the terminal, you can follow these point-and-click instructions, but it's considerably more involved than either of the other two options, as you'll see below:

Visit the Mozilla Firefox website and click the appropriate download button. You'll be asked what to do with the file. Choose to open it with the Archive Manager.

Wait for it to download.

Once the Archive Manager opens, click the Extract button.

Find a good location to extract the archive to. In this case, I picked the desktop. You can pick whatever directory you want in your home directory, as long as you can find it later.

Then go to that location. If you selected the desktop, you can reach that by going to Places > Desktop. A new file browser window should appear.

In the new window that appears, right-click the firefox folder and select Cut.

While keeping the new window open, press Alt-F2. This will bring up a Run Application dialogue box. In that dialogue box, paste the command gksudo nautilus and then click Run.

Since you'll be launching a new file browser window with system-wide administrative privileges, you'll be prompted for your password. Enter it.

When the new window appears, go to the /opt directory. You can do this by pressing the Up arrow and then double-clicking on opt. You can also press Control-L and then type /opt. Once you're in the /opt directory, right-click on the empty space and select Paste. You can now close the old file browser window (the one showing your desktop).

In the remaining window (the one focused on /opt/firefox), go to File and select New Window.

Leave that window in the background (it should be focused on the /root/Desktop folder). Go back to /opt and double-click into the firefox folder. Inside, there should be a folder called plugins. Rename (F2) that folder to plugins.old.

In the other window, go to /usr/lib/firefox and find the plugins folder there. Right-click it and select Make Link. This will create a new file called Link to plugins.

Right-click Link to plugins and select Cut.

In the /opt/firefox window, right-click on some empty space and select Paste.

Then rename Link to plugins to just plain old plugins.

In the other window, go to /usr/bin and find the file called firefox. Rename is to firefox.ubuntu.

In the /opt/firefox window, right-click on the firefox file and select Make Link.

Find the new Link to firefox file, right-click it and select Cut.

In the other window, right-click on some empty space, select Paste, and then rename Link to firefox to just plain firefox.

In the /opt/firefox window, go up one directory (click on the Up button) and right-click the firefox folder and select Properties.

The properties window will appear, and you should use the Owner drop-down menu to select root.

Change the Group permissions to root as well, and Apply Permissions to Enclosed Files. Then click Close.

Launch Firefox with the Firefox icon, as you normally would. Accept the licensing agreement.

You should now have the Mozilla version of Firefox running.