Install Flatpak itself
sudo apt install flatpak
On GNOME-based distros, the Software app can browse and install Flatpaks directly if you also install:
sudo apt install gnome-software-plugin-flatpak
On KDE, the equivalent is plasma-discover-backend-flatpak. If you don't care about graphical installs, you can skip the plugin — the flatpak CLI is enough.
Add the Flathub repository
Flathub is the main community-run registry of Flatpak apps, including the official Mozilla builds of Firefox. It isn't added by default on Debian/Ubuntu, so:
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
A restart of your user session is a good idea here. Without it, Flatpak-installed applications often don't show up in your desktop's app launcher until the next login, which is a confusing non-problem.
Install Firefox
flatpak install flathub org.mozilla.firefox
Launch from your desktop's application menu, or from a terminal:
flatpak run org.mozilla.firefox
Why bother, when apt install firefox exists?
Three reasons the Flatpak is often a better choice than the distro package:
- It's the upstream Mozilla build. No distro patches, no rebased extension set, no deferred-to-stable version lag. New releases land on Flathub within hours of Mozilla cutting them.
- Sandboxing. Flatpak apps run inside a bubblewrap sandbox. Firefox can only see your
Downloads,Documents, and the directories you've explicitly granted viaflatpak override. A compromised browser can't trivially exfiltrate your SSH keys. - Works the same on every distro. If you bounce between Debian, Fedora, and Arch (or you support users on all three), one set of install instructions covers everyone.
The main tradeoff: Flatpak apps carry their own runtime (the Mozilla toolkit, a matching freedesktop-platform runtime, etc.). First install downloads ~500 MB of shared runtime that subsequent Flatpaks reuse. It's not a problem on any modern disk.
On Ubuntu specifically
Ubuntu 22.04 and later replaced the apt Firefox package with a Snap. If you dislike Snap — many people do, and it's a perfectly reasonable position — Flatpak is the straightforward replacement. Mozilla also publishes a direct .tar.bz2 on firefox.com, and Launchpad hosts the Mozilla Team PPA with real .deb packages for those who'd rather stay inside apt.
Granting extra permissions
The sandbox sometimes gets in the way. For example, Firefox-in-Flatpak can't by default write to arbitrary filesystem locations. Use flatpak override to loosen or tighten its permissions:
# Grant access to an external drive
flatpak override --user --filesystem=/mnt/mydrive org.mozilla.firefox
# Revoke access to the home directory entirely
flatpak override --user --nofilesystem=home org.mozilla.firefox
Running flatpak info --show-permissions org.mozilla.firefox lists everything currently granted.