To install the daily Firefox 4 pre-Beta release, you'll first need to add the daily PPA then install the firefox-4.0 package that's made available.
~$ sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa
~$ sudo apt-get update
~$ sudo apt-get install firefox-4.0
After installation completes, you'll have Firefox 4 installed side-by-side with Firefox 3.6. It's in the Applications menu as Minefield Web Browser.
|Firefox 4 pre-Beta 8|
Firefox 4 stores its profile data in a different folder. If you want your browsing history and bookmarks to be accessible from Firefox 4, you'll need to copy over your Firefox 3.6 profile from ~/.mozilla/firefox to ~/.mozilla/firefox-4.0. Be sure Minefield isn't currently running.
~$ mkdir ~/.mozilla/firefox-4.0
~$ cp ~/.mozilla/firefox/* ~/.mozilla/firefox-4.0
Your current browsing history and bookmarks will now be available in Firefox 4.
Keeping things sane
The daily PPA also contains pre-release versions of Firefox 3.6.x so unless you happen to also be interested in running Firefox 3.6.x test versions it's a good idea to disable the PPA in Software Sources before updating Ubuntu with Update Manager.
Firefox 4 Beta 7 release
Reverting PPA packages
Taking Firefox 4.0 Beta for a spin