Install Firefox on Linux

Revision Information
  • Revision id: 229652
  • Created:
  • Creator: unixfan
  • Comment: Rewrote article for clarity, fixed grammatical errors, and added information where it was appropriate
  • Reviewed: No
  • Ready for localization: No
Revision Source
Revision Content

To use Firefox, you must install it first. This article will show you how to do so.

If you don't use Linux, read the article corresponding to your operating system:

Installation Methods

There are several installation methods available:

  • Your Linux distribution's package manager
  • Flatpak
  • Snap
  • Mozilla's official package

Your Distribution's Package Manager

Many Linux distributions include Firefox by default, and most have a package management system: a set of tools that help you install, upgrade, downgrade, and uninstall software. Using your distribution's package manager has three advantages:

  • It installs all the libraries that Firefox depends on automatically
  • Creates a desktop and menu shortcut for Firefox automatically
  • Make uninstalling Firefox easy by only having to run one command


Using your distribution's package manager has two disadvanages:

  • It may not provide the latest Firefox version
  • It may provide a version without Firefox branding
  • It may have unwanted distribution specific patches for Firefox


To install Firefox with your package manager, run the install command for it. For example, we run:

sudo apt install firefox

on Debian and Ubuntu.

Flatpak

Flatpak is a package management system that's independent of any specific Linux distribution. To setup Flatpak, visit FlatPak's setup guide and select your operating system. Then, follow the installation steps.

Once you have Flatpak installed, visit the Firefox Flathub page and click the Install button. Once downloaded, follow the command line instructions at the bottom of the page.

To update the Flatpak package of Firefox, run:

flatpak update

This updates all Flatpak packages, including Firefox, to the latest available version.

Download a specific locale version

When you install Firefox with Flatpak, it checks the OS locale to determine which language to use.

If you want to use a different locale from your operating system locale, you must download it. For example, to get the French language locale (fr), run:

flatpak update --subpath=/fr org.mozilla.firefox.Locale

Snap

Snap is a package management system that's independent of specific Linux distributions and shares many features with Flatpak. To use Snap on your Linux distribution, follow the snapd installation instructions for your distribution. Once you have installed snapd, run this command to install Firefox:

sudo snap install firefox

Mozilla's official package

  • Before you install Firefox, ensure that you have installed the required libraries. Missing libraries will cause Firefox to be inoperable.
  • The installation file provided by Mozilla in .tar.bz2 format has pre-compiled binary files as opposed to source code. This means you can unpack the tar file and run the binaries.
  • If you have any other version of Firefox installed, change the name of the extracted firefox binary to another name

Follow these steps to install Mozilla's official Firefox package:

  1. Download Firefox from the download page and save it to your Downloads directory
  2. Open a terminal and go to your Downloads directory:
    cd ~/Downloads
  3. Extract the contents of the downloaded file:
    tar xjf firefox-*.tar.bz2
  4. Move the extracted directory to /opt:
    sudo mv firefox /opt/
  5. Open your user's profile file:
    nano ~/.profile
  6. Enter the following line in ~/.profile:
    PATH=$PATH:/opt/firefox
  7. Reload your profile:
    source ~/.profile
  8. Open firefox by typing firefox in the terminal
  9. Delete the installation file:
    rm firefox-*.tar.bz2

If you want a menu entry for Firefox on your application launcher

  1. Create a .desktop file in your applications folder
    sudo touch /usr/local/share/applications/firefox.desktop
  2. Open the .desktop file:
    sudo nano /usr/share/applications/firefox.desktop
  3. Paste the following into the file:

[Desktop Entry]
Version=1.0
Name=Firefox
GenericName=Web Browser
Exec=firefox %u
Icon=firefox
Terminal=false
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Categories=Network;WebBrowser;

Troubleshoting

This section addreesses common errors and how to resolve them.

libstdc++5 error

As noted above, you need to install the required libraries for Firefox to work.

Running Firefox in the terminal gives "firefox: command not found" message or it doesn't start when clicking the menu entry in your application launcher

You must check whether /opt/firefox is in your path. You can do this by running:

env | grep PATH

Firefox runs as an XWayland client on my Wayland compositor

To make Firefox run as a Wayland client, run nano ~/.profile in your terminal and paste the this line in it:

export MOZ_ENABLE_WAYLAND=1

Then, refresh your profile by running:

source ~/.profile

Now, Firefox will start as a Wayland client.