Backing up your existing profile
Before we begin we should always back up our stuff, even if you’re using Firefox Sync
Mozilla publishes Firefox directly into Flathub, however we need to turn this on in Ubuntu. Follow these instructions, I am summarizing them below:
sudo apt install flatpak sudo apt install gnome-software-plugin-flatpak flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
This will install Firefox and the corresponding ffmpeg libraries so videos, etc work:
flatpak install flathub org.mozilla.firefox org.freedesktop.Platform.ffmpeg-full/x86_64/20.08
Then the Firefox icon will appear in your menu/overlay, or you can do
firefox run org.mozilla.firefox to launch it from the command line.
Migrating your profile
Reusing your old profile
You can also reuse your profile without manually copying it over though this probably isn’t a good permanent solution.
Quit firefox, then do
flatpak override --user --filesystem=~/.mozilla org.mozilla.firefox to have the flatpaked Firefox reuse your old profile.
Checking your work
Clicking on the burger menu -> Help -> About Firefox will show “Mozilla Firefox Flatpak” and “mozilla-flatpak” in the dialog window: