How to install, uninstall and update Firefox on Ubuntu

Mozilla Firefox is the preferred web browser for many Linux users. It is free and open source software, which as we all know, goes hand in hand with any Linux system. One important aspect of system security is to keep your Firefox web browser up to date, since malicious websites can potentially take advantage of older browsers.

Every Ubuntu user that uses a graphical interface will usually interact with Mozilla Firefox in some capacity, since it’s the default internet browser on Ubuntu. Even if you just want to uninstall it and use a different browser, you will probably at least be dealing with it for a short time. In this guide, we’ll show you how you can install, update, and uninstall Firefox on Ubuntu Linux.

In this tutorial you will learn:

  • How to install, update, and uninstall Firefox with Ubuntu’s default package repository
  • How to install, update, and uninstall Firefox with Mozilla PPA repository
  • How to install, update, and uninstall Firefox with direct download
How to install, uninstall and update Firefox on Ubuntu
How to install, uninstall and update Firefox on Ubuntu
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu Linux
Software Mozilla Firefox
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install Firefox



WARNING
Since Ubuntu version 22.04 (the latest LTS release), Firefox is now installed by default as a Snap package. It can still be installed via Ubuntu repo or official download.

As we mentioned earlier, Firefox is the default internet browser on Ubuntu. Therefore, it stands to reason that it’s already on your system and there’s no need for installation instructions, right? Yeah, probably. But you or someone else may decide to uninstall it and come back to it later, or maybe it’s giving you problems and you want to reinstall the software altogether. We’ll show you a few methods for how to install, update, and uninstall Firefox from your system in this section.

There are four ways we can install Firefox. All of them accomplish the same thing, but you should pick the one that best suits you:

  1. Installing via Snap method – this uses the Snap package manager (installed by default on Ubuntu).
  2. Installing from the Standard Ubuntu repository – this involves using an apt command to install a stable version of Firefox. Use this method if you’re in a hurry or unsure of which method to use.
  3. Installing from the Mozilla PPA repository. This is another command line method but it allows you to install more updated (and less stable, possibly) versions of Firefox directly from Mozilla’s repository. Use this method if you enjoy the bleeding edge.
  4. Installing from Firefox’s official website, Mozilla.org. We’ll show how to do this from the command line with wget, but you can also use this method if you want to avoid the command line and you already have a browser that can be used to navigate to Firefox’s website.

We’re going to show you the step by step for each of these methods, and regardless of which one you choose, you’ll be able to follow along with our instructions to update and uninstall Firefox as well.

First thing’s first. You should open a terminal and run a quick couple Linux commands to update your system’s apt index and see if a current version of Firefox is already installed on your system:

$ sudo apt update
$ firefox --version

Check if Firefox is installed and what version it is

Check if Firefox is installed and what version it is

With that out of the way, it’s time to pick a method and follow one of the sections below to get Firefox installed or updated.

Install, update, and uninstall Firefox via Snap

Install Firefox:

$ sudo snap install firefox

Update Firefox:

$ sudo snap refresh firefox

Uninstall Firefox:

$ sudo snap remove firefox

Install, update, and uninstall Firefox from Ubuntu repository

The following section will explain how to install, update, and uninstall Mozilla Firefox from the command line, using Ubuntu’s default package repository.

Install Firefox

If the Firefox browser isn’t already on your Ubuntu system for some reason, entering the following command in a terminal will download and install it:

$ sudo apt install firefox

Update Firefox

The same command will also update Firefox if it’s already installed:

$ sudo apt install firefox

However, if you want to update the browser, we’d recommend that you just upgrade your Ubuntu operating system entirely. This will update all of your installed packages rather than just the single Firefox package.

$ sudo apt upgrade

Uninstall Firefox

To uninstall Firefox from your system, we’ll use another apt command. This command will remove Firefox from your system:

$ sudo apt remove firefox

Install, update, and uninstall Firefox from Mozilla PPA repository

The following section will explain how to install, update, and uninstall Mozilla Firefox from the command line, using the Mozilla developer PPA repository. Remember that this method will install the latest version of Firefox, even if it’s in beta and considered a little less than stable.

Install Firefox



  1. First, we need to add the Mozilla signing key to our system:
    $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6DCF7707EBC211F
    
  2. Next, add Mozilla’s PPA repository and update the list of available packages in apt:
    $ sudo apt-add-repository "deb http://ppa.launchpad.net/ubuntu-mozilla-security/ppa/ubuntu focal main"
    $ sudo apt update
    
  3. Finally, if all went well up till now, install the latest version of Firefox with this command:
    $ sudo apt install firefox
    

Uninstall Firefox

You can still uninstall Firefox in the traditional way, with apt at the command line:

$ sudo apt remove firefox

Install, update, and uninstall Firefox with direct download

The following section will explain how to install, update, and uninstall Mozilla Firefox from the command line, using the official Mozilla website. If you already have an alternative browser installed on your system and you’re not the type who likes to fiddle with the command line, remember that you can just navigate to Mozilla.org and download the installation file.

Install Firefox

  1. Use wget to download the latest version of Firefox directly from Mozilla’s website into your user’s home directory:
    $ wget -O ~/FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64"
    
  2. Next, extract the Firefox package to your system’s /opt/ directory:
    $ sudo tar xjf ~/FirefoxSetup.tar.bz2 -C /opt/
    
  3. It’s a good idea to make a backup of the original Firefox binary executable in case we need to switch back to the default Ubuntu Firefox version:
    $ sudo mv /usr/lib/firefox/firefox /usr/lib/firefox/firefox_backup
    
  4. Lastly, create an /usr/lib/firefox/firefox executable by creating a new symbolic link from the /opt/firefox directory:
    $ sudo ln -s /opt/firefox/firefox /usr/lib/firefox/firefox
    

Firefox should now be installed and usable.

Update Firefox

To update your Firefox to the latest version, you just need to download the latest installation package and extract the package content:

$ wget -O ~/FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64"
$ sudo tar xjf ~/FirefoxSetup.tar.bz2 -C /opt/

Uninstall Firefox

To uninstall Firefox, just remove the /opt/firefox directory that we created, and revert your system back to using the default version of Firefox that was installed from the Ubuntu repository:

$ sudo rm -fr /opt/firefox
$ sudo mv /usr/lib/firefox/firefox_backup /usr/lib/firefox/firefox

Closing Thoughts




In this article, we learned several methods for installing, updating, and uninstalling Mozilla Firefox on Ubuntu Linux. Whether you want to use Ubuntu’s default package repository, Mozilla’s developer PPA, or Firefox’s official website, managing Firefox on your Ubuntu system is easy to do when following along with our step by step instructions.