User Agents

Web browsers and everyday web tech, explained

Install Firefox on Debian: Step-by-Step Guide

· 5 min read · Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

This guide shows you how to install the Firefox browser on Debian Linux using the official Mozilla repository, which ensures you get the latest version with automatic updates. You'll need a Debian system (any currently supported version) with an internet connection and sudo access to run administrative commands.

What You'll Need

  • A Debian system (Debian 11 Bullseye, Debian 12 Bookworm, or newer)
  • An internet connection
  • sudo privileges (you must be able to run commands as root)
  • A terminal window (Ctrl+Alt+T usually opens it)

Step-by-Step

  1. Update your package list. Open a terminal and run: sudo apt update. This refreshes the list of available packages from your configured repositories.
  2. Install required dependencies. Firefox from Mozilla's repo needs apt-transport-https and ca-certificates to securely download packages. Install them with: sudo apt install apt-transport-https ca-certificates
  3. Import Mozilla's signing key. Run: sudo install -d -m 0755 /etc/apt/keyrings then wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null. This key verifies that the packages you download are genuinely from Mozilla.
  4. Add the Mozilla APT repository. Create a new source list file: 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
  5. Set APT to prefer Mozilla's repository. Create a preferences file so Debian doesn't override Firefox with an older version: echo -e "Package: *\nPin: origin packages.mozilla.org\nPin-Priority: 1000" | sudo tee /etc/apt/preferences.d/mozilla
  6. Update your package list again. Run: sudo apt update. This time it will include the newly added Mozilla repository.
  7. Install Firefox. Run: sudo apt install firefox. This installs the latest stable version of Firefox from Mozilla.
  8. Launch Firefox. You can start it from the application menu (often under “Internet” or “Applications”) or by typing firefox in the terminal. The first launch may take a few seconds.

Common Mistakes

  • Using Debian's default Firefox (ESR). Debian's repositories contain a version called “Firefox ESR” which is older. If you want the newest features, use the Mozilla repo as shown above.
  • Forgetting the pin priority. Without the preferences file, APT might keep an older Firefox from Debian's repo, or you might get a mix of versions. The pin ensures Mozilla's version is always chosen.
  • Typing the key import command incorrectly. The wget command must be copied exactly. A missing pipe or wrong path will cause a “key not found” error later.
  • Using sudo with wget output. The tee command needs root privileges to write to /etc/apt/keyrings. If you forget the sudo before tee, the key won't be saved.

Tips

  • Check your version. After installation, open Firefox and go to Menu > Help > About Firefox. It will show the version and check for updates automatically.
  • Keep it updated. With the Mozilla repo, Firefox updates automatically when you run sudo apt update && sudo apt upgrade. No need to download anything manually.
  • Remove the old ESR version first (if present). If you already have Firefox ESR installed, it's safe to remove it before adding the Mozilla repo: sudo apt remove firefox-esr. This avoids confusion between two Firefox entries.
  • Use a different browser for testing. If you're a web developer, you can install Firefox Developer Edition or Firefox Nightly from the same repo by replacing firefox with firefox-devedition or firefox-nightly in the install step.

Troubleshooting

  • “The repository does not have a Release file” error. This usually means the repo URL was typed incorrectly. Double-check the sources.list file: cat /etc/apt/sources.list.d/mozilla.list. It should contain exactly: deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main
  • GPG error: “The following signatures couldn't be verified.” The signing key wasn't imported correctly. Re-run step 3. If wget is not installed, install it first with sudo apt install wget.
  • Firefox doesn't start after installation. Try launching it from the terminal: firefox. If you see an error like “cannot open display,” ensure you're running a graphical session. If it says “command not found,” the install may have failed—run sudo apt install firefox again and watch for errors.
  • APT wants to remove Firefox when upgrading. This can happen if the pin priority isn't set. Re-check the preferences file: cat /etc/apt/preferences.d/mozilla. It must contain the three lines from step 5.
  • Firefox is still the old ESR version. Run apt-cache policy firefox. If it shows a version from Debian's repo, your pin isn't working. Ensure the preferences file has no typos and that the origin matches exactly: packages.mozilla.org.

Frequently Asked Questions

Is Firefox pre-installed on Debian?

Debian usually comes with Firefox ESR (Extended Support Release) installed by default, but it's older. If you want the latest version, follow the steps above to replace it with the current Firefox from Mozilla.

Can I install Firefox using Snap or Flatpak instead?

Yes. You can install it via sudo snap install firefox or flatpak install flathub org.mozilla.firefox. However, the APT method described here is more integrated with Debian's package manager and avoids sandboxing issues some users encounter.

Will Firefox from the Mozilla repo receive updates automatically?

Yes. As long as you run sudo apt update regularly, the package manager will detect and install new Firefox versions just like any other system package.

How do I uninstall Firefox installed via this method?

Run sudo apt remove firefox. To also remove the repository and key, delete the files: sudo rm /etc/apt/sources.list.d/mozilla.list /etc/apt/preferences.d/mozilla /etc/apt/keyrings/packages.mozilla.org.asc.

Can I install Firefox on Debian without sudo?

No, installing system-wide packages requires root privileges. If you don't have sudo, you can download the tarball from Mozilla's website and run it from your home directory, but you won't get automatic updates.

Why does Debian use Firefox ESR instead of the latest version?

Debian prioritizes stability and security. ESR versions receive security fixes but not new features for a longer period, which suits servers and conservative users. The Mozilla repo gives you the latest version with a faster release cycle.