How to Install Firefox on Debian Linux

Firefox provides a privacy-focused browsing experience with built-in tracking protection, cross-platform sync, and extensive add-on support. Whether you need a secure browser for daily web browsing, web development with integrated developer tools, or a customizable interface that respects your privacy, Firefox delivers without relying on Google’s ecosystem. By the end of this guide, you will have the latest Firefox installed directly from Mozilla’s official APT repository with automatic updates configured.

This guide covers the Mozilla APT repository method. Alternatively, Firefox is available via Flatpak for sandboxed installation (see our Flatpak guide), or as Firefox ESR from Debian’s repositories for stability-focused users.

Preparing Debian for Firefox Installation

Update Your Debian System

Before installing Firefox, update your Debian system to ensure a successful installation. This step also helps avoid issues related to compatibility or missing dependencies.

To begin, run the following commands in your terminal:

sudo apt update
sudo apt upgrade

The sudo apt update command refreshes your system’s package database to inform you about the latest package versions. Then, sudo apt upgrade updates your existing packages to the newest versions.

Install Required Packages

Next, install the packages needed to add the Mozilla repository securely:

sudo apt install wget ca-certificates gnupg -y

In particular, these packages handle downloading files (wget), SSL certificate verification (ca-certificates), and GPG key management (gnupg) for repository authentication.

Import Mozilla APT Repository

Download the Mozilla GPG Key

Now that prerequisites are installed, create the keyrings directory if it doesn’t exist, then download Mozilla’s GPG signing key:

sudo install -d -m 0755 /etc/apt/keyrings
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null

Verify the GPG Key Fingerprint

Next, verify that the downloaded key matches Mozilla’s official fingerprint:

gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc 2>&1 | grep -A 1 "^pub"

Expected output:

pub   rsa2048 2021-05-04 [SC]
      35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3

The command may show a harmless warning about a missing GPG directory. This is normal and does not affect key verification.

Once the fingerprint matches 35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3, the key is authentic and you can proceed.

Add the Mozilla Repository

With the key verified, create a DEB822 format repository configuration file:

cat <<'EOF' | sudo tee /etc/apt/sources.list.d/mozilla.sources
Types: deb
URIs: https://packages.mozilla.org/apt
Suites: mozilla
Components: main
Signed-By: /etc/apt/keyrings/packages.mozilla.org.asc
EOF

Debian 13 (Trixie) defaults to DEB822 .sources format shown above. Debian 12 (Bookworm) and Debian 11 (Bullseye) fully support .sources and work with the same configuration. This format is compatible across all currently supported Debian releases.

Configure APT Priority

After adding the repository, set APT to prioritize packages from the Mozilla repository over Debian’s default Firefox ESR:

cat <<'EOF' | sudo tee /etc/apt/preferences.d/mozilla
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
EOF

As a result, this ensures that the latest Firefox from Mozilla takes precedence during installation and updates.

Install Firefox

Update APT and Install Firefox

Now that the repository and priority configuration are complete, refresh the package index, then install Firefox:

sudo apt update
sudo apt install firefox

Verify Installation

Once installation completes, confirm the package source and version:

apt-cache policy firefox

Expected output (version numbers will vary):

firefox:
  Installed: 145.0.2~build1
  Candidate: 145.0.2~build1
  Version table:
 *** 145.0.2~build1 1000
       1000 https://packages.mozilla.org/apt mozilla/main amd64 Packages
        100 /var/lib/dpkg/status

The 1000 priority and packages.mozilla.org source confirm Firefox is installed from the Mozilla repository. Additionally, check the installed version:

firefox --version

Example output:

Mozilla Firefox 145.0.2

Install Additional Language Packs

Moreover, Firefox supports multiple languages through Mozilla’s language pack packages. You can install your preferred language to use Firefox in your native language.

German Language Pack

For instance, to install the German version of Firefox:

sudo apt install firefox-l10n-de

French Language Pack

Similarly, for the French version:

sudo apt install firefox-l10n-fr

Japanese Language Pack

Likewise, to install Firefox in Japanese:

sudo apt install firefox-l10n-ja

Korean Language Pack

For the Korean version:

sudo apt install firefox-l10n-ko

In other words, -l10n- followed by a language code (e.g., -de, -fr, -ja, -ko) specifies the language pack. Each language pack includes a two or four-letter code.

Finding More Language Packs

Furthermore, to explore all available language packs, search the package repository:

apt search firefox-l10n

Example output showing available language packs:

Sorting...
Full Text Search...
firefox-l10n-de/mozilla 145.0.2~build1 all
  Mozilla Firefox - Firefox Language Pack for Deutsch (de) - German

firefox-l10n-es-es/mozilla 145.0.2~build1 all
  Mozilla Firefox - Firefox Language Pack for Español de España (es-es) - Spanish

firefox-l10n-fr/mozilla 145.0.2~build1 all
  Mozilla Firefox - Firefox Language Pack for Français (fr) - French

firefox-l10n-it/mozilla 145.0.2~build1 all
  Mozilla Firefox - Firefox Language Pack for Italiano (it) - Italian

firefox-l10n-ja/mozilla 145.0.2~build1 all
  Mozilla Firefox - Firefox Language Pack for 日本語 (ja) - Japanese

firefox-l10n-ko/mozilla 145.0.2~build1 all
  Mozilla Firefox - Firefox Language Pack for 한국어 (ko) - Korean

Therefore, install your preferred language by replacing the code in the installation command.

Launch Firefox

Launch from Terminal

At this point, Firefox is installed on your Debian system. You can start it using the terminal or the application menu.

To launch Firefox from the terminal:

firefox

Launch from Application Menu

Alternatively, you can launch Firefox from the application menu:

  • Click Activities in the top-left corner of your screen
  • Select Show Applications to view all installed applications
  • Click the Firefox icon to start the browser

Update Firefox

Subsequently, Firefox receives automatic updates through APT when you update your system. Run these commands to check for and install updates:

sudo apt update
sudo apt upgrade

The Mozilla repository provides updates as soon as new versions are released, keeping your browser secure with the latest patches. Furthermore, to update Firefox individually without upgrading other packages:

sudo apt update
sudo apt install --only-upgrade firefox

Remove Firefox

If needed, you can completely remove Firefox and the Mozilla repository from your system. Below are the steps to uninstall everything.

Uninstall Firefox Package

First, remove Firefox and clean up unused dependencies:

sudo apt remove firefox
sudo apt autoremove

Remove Mozilla Repository and GPG Key

Next, delete the repository configuration and signing key:

sudo rm -f /etc/apt/sources.list.d/mozilla.sources /etc/apt/keyrings/packages.mozilla.org.asc /etc/apt/preferences.d/mozilla

If you use other Mozilla products like Firefox Beta or Firefox Nightly that share this repository, skip the repository removal step.

Verify Removal

Finally, refresh APT and confirm the Mozilla repository is no longer active:

sudo apt update
apt-cache policy firefox

As expected, the output should show no candidate version or only the Debian ESR version if it’s available in your release:

firefox:
  Installed: (none)
  Candidate: (none)
  Version table:

Remove User Data (Optional)

Additionally, Firefox stores your profile data separately from the application. Consequently, to remove bookmarks, history, passwords, and cached data:

Warning: The following commands permanently delete your Firefox profile including bookmarks, saved passwords, browsing history, and extensions. Before proceeding, export your bookmarks (Bookmarks → Manage Bookmarks → Import and Backup → Export Bookmarks to HTML) and back up any important data you wish to keep.

rm -rf ~/.mozilla/firefox
rm -rf ~/.cache/mozilla/firefox

Troubleshooting

GPG Key Verification Failed

If you see an error like this during apt update, the GPG key may be missing or corrupted:

Err:2 https://packages.mozilla.org/apt mozilla InRelease
  Sub-process /usr/bin/sqv returned an error code (1), error message is: Error: Failed to parse keyring "/etc/apt/keyrings/packages.mozilla.org.asc"
  Caused by: Reading "/etc/apt/keyrings/packages.mozilla.org.asc": No such file or directory

First, verify the key file exists and has correct permissions:

ls -la /etc/apt/keyrings/packages.mozilla.org.asc

If successful, you should see output similar to:

If the file is missing, re-download the key:

wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null

Then, verify the download succeeded and refresh APT:

sudo apt update

Firefox ESR Conflicts with Mozilla Firefox

On the other hand, if apt-cache policy firefox shows Debian’s Firefox ESR as the candidate instead of Mozilla’s Firefox, verify the APT priority file exists:

cat /etc/apt/preferences.d/mozilla

If configured correctly, you should see:

However, if the file is missing or shows different content, recreate it:

cat <<'EOF' | sudo tee /etc/apt/preferences.d/mozilla
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
EOF

After recreating the file, verify that the priority is applied:

apt-cache policy firefox

Look for 1000 appearing next to the packages.mozilla.org entry:

firefox:
  Installed: 145.0.2~build1
  Candidate: 145.0.2~build1
  Version table:
 *** 145.0.2~build1 1000
       1000 https://packages.mozilla.org/apt mozilla/main amd64 Packages

Conclusion

To summarize, you now have Firefox installed from Mozilla’s official APT repository with automatic updates configured. As a result, the APT priority ensures Mozilla’s latest Firefox takes precedence over Debian’s ESR version. Your browser will receive updates through regular apt upgrade commands. For alternative browsers, see our guides on Brave for enhanced privacy features or Chromium for a Google-free Chrome experience.

Useful Links

Finally, for more information about Firefox and related guides:

How to Install Cinnamon on Debian

How to Install Joplin on Debian

Leave a Comment