Ubuntu 22.04 finally removed the .deb
package for Firefox web browser from it’s repository! Here’s how to install it back.
As you may know, Firefox in Ubuntu repository since 22.04 is a Snap package that runs in sandbox. It’s easy to remove it. But when you try installing the deb package via apt
, it just install the Snap version back!!
Like Chromium, the Firefox deb in Ubuntu 22.04 + repository is an empty package that links to the Mozilla’s official Snap.
And, if you want to install the latest Firefox using the classic .deb
package format, there are 2 easy ways:
- Mozilla Team PPA maintained by Ubuntu Team members.
- Mozilla’s new apt repository maintained by Firefox developer team!
(Optional) Remove the pre-installed Firefox Snap
It’s OK to keep the default Snap package. But it will cause duplicated Firefox icons after installing Firefox in .deb package format.
NOTE: Export bookmarks and backup other important data before removing it!
To remove it, press Ctrl+Alt+T on keyboard to open terminal. Then, run the command:
sudo snap remove firefox
Also, remove the empty Deb package by running command:
sudo apt remove firefox
Option 1: Install Firefox via “Mozilla Team” team PPA
The team described that it has assumed responsibility for Ubuntu’s official Firefox and Thunderbird packages.
And, the Firefox and Firefox ESR package maintainer for “Mozilla Team” team PPA, Rico Tzschichholz, is a well-known Ubuntu user who also maintains the official packages for LibreOffice, Plank dock, and unbound DNS server.
1. Add Mozilla Team PPA
In terminal (Ctrl+Alt+T), run the command below to add the PPA. Type user password (no asterisk feedback) when it asks and hit Enter to continue.
sudo add-apt-repository ppa:mozillateam/ppa
As the PPA description indicates, the PPA was previously created for Firefox ESR and Thunderbird. It now contains the latest Firefox too.
2. Set PPA priority:
The empty Firefox deb in Ubuntu’s official repository has version number 1:1snap1-0ubuntu2. It’s always higher than the PPA package version. Running package updates either via sudo apt upgrade
or ‘Software Updater’ will automatically install the official one which redirects to Snap.
To workaround the issue, you have to set a higher PPA priority. To do so, run the command below in terminal (Ctrl+Alt+T):
sudo gedit /etc/apt/preferences.d/mozillateamppa
For Ubuntu 24.04, replace gedit
in command with gnome-text-editor
, or use nano
that works in all the desktop environments.
The command creates and opens empty config file in Gedit text editor. When it opens, add the lines below and save it:
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
For nano text editor, press ctrl+s to save file, and ctrl+x to exit.
After saving the file, run sudo apt update
command in terminal to apply changes.
sudo apt update
3. Install Firefox via apt
Tip: the commands in this step also installs Firefox for the old Ubuntu 16.04. Though sudo apt update
need to be run first.
Finally, run the command below to install the latest Firefox package as deb:
sudo apt install firefox
Here -t 'o=LP-PPA-mozillateam'
specifies to install Firefox from that PPA. It’s required until you set higher PPA package priority (see next step).
The -t 'o=LP-PPA-mozillateam'
flag is no longer required after setup PPA priority.
For choice, you may install Firefox ESR instead. It’s another official Firefox package that moves slowly and targets for school or enterprise use.
sudo apt install firefox-esr
Option 2: Install Firefox via its official repository
Mozilla’s new apt repository contains 4 versions of Firefox packages: Firefox Stable, Firefox Beta, Firefox Development Edition, and Firefox Nightly. It’s a good choice for Ubuntu & Debian users.
1: Get Repository Key file
To add the new repository, you need to first download & install the key, so your system will trust the packages from it.
First, press Ctrl+Alt+T
on keyboard to open terminal. When it opens, run command to make sure ‘/etc/apt/keyrings’ exist for storing the keys.
sudo mkdir -p /etc/apt/keyrings
Then, download & install the key by running the single command below in terminal:
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
After that, you can verify the new key file by listing the content of that directory via command ls /etc/apt/keyrings
.
2: Add Mozilla’s apt repository
Also in a terminal window, run the single command below will create a config file and write the source repository.
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee /etc/apt/sources.list.d/mozilla.list > /dev/null
When done, you may verify by running cat /etc/apt/sources.list.d/mozilla.list
to print the source file content.
3. Set apt repository priority:
Also you need to set higher priority for Mozilla’s repository, so Ubuntu will install Firefox from it rather than the snap package.
To do so, run command to create & edit the config file:
sudo gedit /etc/apt/preferences.d/mozilla
Also, replace gedit
with gnome-text-editor
for Ubuntu 24.04, or use nano
command line editor that works in most desktop environments.
When file opens, add following lines and save it (For nano, press ctrl+s to save, and ctrl+x
to exit).
Package: firefox*
Pin: origin packages.mozilla.org
Pin-Priority: 1001
4. Install Firefox:
Finally, refresh your system package cache by running command in terminal:
sudo apt update
And, install Firefox from that repository via command:
sudo apt install firefox
You may also use firefox-beta
, firefox-devedition
, or firefox-nightly
in last command to install other versions.
How to Restore Firefox Snap:
To restore the pre-installed Snap package, or uninstall the .deb
package, first remove the repositories:
- To remove the Mozilla Team PPA, launch ‘Software & Updates‘ utility and navigate to Other Software tab, finally remove the corresponding source line.
- To remove the Mozilla apt repository, simply delete the source file, by running command in terminal:
sudo rm /etc/apt/sources.list.d/mozilla.list
After that, either launch Software Updater to upgrade Firefox or use apt commands below. Both of which will automatically install back the pre-installed Snap package.
sudo apt update
sudo apt install firefox
That’s all. Enjoy!