There are several methods of installing a non-default version of Firefox, that are covered by my tutorial Installing Other Versions, which has detailed explanations and method comparisons. So I will post here only the relevant information regarding Firefox 4. Please do not use multiple methods. Pick one and stick with it or revert the changes before trying a different one. I recommend the manual installation method, since depending on the PPA you choose, you will also update Firefox 3.6 and other Mozilla products.
Since it is still a Beta release and there are some radical changes in this version, is recommended that you install it side-by-side with the default version and use a different user profile, in order to avoid data loss.
Method #1 - Manual Download & Installation
First you need to download it form Mozilla [pick one only]:
The easiest way to install Firefox 4 downloaded from Mozilla is to use my extension FoxTester. It allows you to install any number of different Firefox versions, without interfering with your default installation and user profile. Everything is done through Firefox context menu, without typing commands or even closing Firefox. Although this extension is not intended for upgrading Firefox, it also allows to make any version installation permanent.
If you prefer to do it manually, then follow the instructions of method #1 from the Installing Other Versions tutorial. Basically, you will extract the downloaded file to your /home directory or the /opt and execute the firefox file inside it. There are also additional steps on that tutorial if you want to make it fully compatible with plugins.
Method #2 - Ubuntuzilla repository
This method will only be available to 32bit users, after the release of the final version of Firefox 4.
Method #3 - Installing from PPA repositories
Firefox 4 is currently available through ubuntu-mozilla-daily PPA repository (semi-official) and SilverWave PPA repository (non-official). You need to add one of those ppa repositories to your sources list, then update and install Firefox 4.
To install from ubuntu-mozilla-daily on Karmic, Lucid or Maverick, run the following commands:
sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa
sudo apt-get update
sudo apt-get install firefox-4.0
For additional info about PPA repositories see What are PPAs and how do I use them?.
To install from SilverWave PPA, see http://ubuntuforums.org/showthread.php?t=1352580
Notes:
- The ubuntu-mozilla-daily ppa also upgrade your default Firefox installation with the latest testing version of Firefox 3.x and other Mozilla applications. So although the SilverWave PP is not official, it might be less troublesome to use it instead.
- When you install Firefox 4 using one of those repositories, a clone of your Firefox user profile is created under ~/.mozilla/firefox-4.0. So everything you do on Firefox 4 won't be saved on your default profile. This could cause confusion and apparent loss of data (bookmarks, passwords...) if you switch back and forth between Firefox 3.6 and Firefox 4 or when the last one becomes default and start using the default profile folder (i.e ~/.mozilla/firefox).
Add-on Compatibility
During the beta phase and to some extent after the final release of Firefox 4, most extensions and themes won't be compatible with it and thus not activated. Usually when you are testing a minor update version, you can disable compatibility check, to force extensions to be installed and activated. But is not so simple in this case, due to radical changes in the UI and the extension API of Firefox 4. So even with the compatibility check disable, several extensions won't work at all or could break other extensions and even Firefox.
If you are using a different profile or make regular backups, then you could use the Addon Compatibility Reporter extension, to disable the compatibility.
If something goes wrong and you can't even access the add-ons manager to disable the extensions, then start Firefox in safe mode and disable all extensions. After starting Firefox in safe mode, you can enable only the compatible ones.
It is strongly advised to start the "Error Console" (CTRL+SHIFT+J) while using Firefox with extensions that are incompatible. Disable any extension that cause an error. You might have to enable only the error report to avoid lots of css messages from web sites.
Optimization
Although Firefox 4 is a lot faster than Firefox 3.6, is always a good idea to keep it fast by optimizing databases and tweaking some preferences.
Database Optimization: improves startup time and performance considerably, specially on features like the awesome bar suggestions or bookmark management.
Preferences Tweaks: improves network speed, page rendering, memory usage and fixes some common issues.
BarTab: this nice extension allows to prevent tabs from loading the page content until they are needed. So if you usually start Firefox with several tabs, this will save memory space and improve startup time and responsiveness.
Better Cache: this extension allows to better control how Firefox handle the content cache, allowing to avoid constantly reloading pages and elements, thus reducing page display time considerably. Make sure you read the manual, because you might prevent sites that need to constantly reloaded from displaying new content (works with compatibility disabled).
Customization
The very anticipated new UI hasn't been released for Linux yet. So, Firefox 4 still looks very similar to 3.6, except for a few changes, like for example the ability to place tabs on top [View >> Toolbars >> Tabs on Top]. Nevertheless, you can change a lot of things as usual, using the built-in options, themes, scripts, extensions or changing the userChrome.css.