How to Install and Update Firefox on Ubuntu

This quick guide will show you how to install and update the Firefox web browser on Ubuntu.

Ubuntu install Firefox

Firefox is one of the best web browsers you can install on your Ubuntu system. It is well known for its focus on privacy and performance.

In addition to being a privacy-focused web browser, it is one of the few browsers that isn’t built on top of Chromium. This gives it a unique opportunity to offer improvements and functionality not offered by the core of other browsers. It also helps them keep the code base as privacy-focused as possible.

While Firefox is typically pre-installed on Ubuntu operating systems, it might not always be the case. You may have uninstalled the browser for some reason or want access to a newer version of Ubuntu than what is offered on your system.

There are several different ways to install Firefox on Ubuntu. We will cover a few different methods and explain the advantages of each.

Using Snap to Install and Manage Firefox on Ubuntu

A way a lot of packages are handled on newer versions of Ubuntu is through a Snap. A Snap is a different way of packing software like the Firefox web browser. These special packages contain the software you want to run alongside all the dependencies.

Snap is a great way to install and run Firefox on Ubuntu for a couple of key reasons.

  • The first is that it ensures you can run the latest version of the web browser, even on old releases of Ubuntu. All the required dependencies are included within the Snap, meaning they are not dependent on the versions of libraries available on your system.
  • Second, you don’t have to stress about updating Firefox. The Snap runtime, by default, periodically updates Snap to the latest available release.

Another key advantage of Snap is that it is very simple for an end user to use. However, not everyone is a fan of how these packages work, so there are alternative ways to install Firefox that we will cover later.

Installing Firefox using Snap

1. As mentioned earlier, Snap makes installing the latest version of Firefox onto Ubuntu a really simple process. You can check when the Firefox Snap was last updated by visiting its Snapcraft page.

To install this web browser on your operating system, use the following command.

sudo snap install firefox

Updating the Firefox Snap on Ubuntu

1. Snaps like Firefox are typically automatically updated by the Snap runtime. By default, they will automatically check for and apply updates as they become available.

However, it is possible to force update the Firefox snap by using the following command in the terminal.

sudo snap refresh firefox

Uninstalling the Firefox Snap Package

1. If you no longer want the Firefox web browser on your Ubuntu system, uninstalling it is also simple. Additionally, since Snap packages are self-contained, you don’t have to worry about leftover, unused dependencies on your system.

You can uninstall the Firefox snap using the command below within the terminal.

sudo snap remove firefox

Using the Official Mozilla Package Repository to install and manage Firefox on Ubuntu

If you prefer not to use Snap to install and manage applications on your Ubuntu system, don’t worry—getting the latest version of Firefox is still relatively easy. Mozilla, the creator of Firefox, maintains its own package repository, which makes installing the latest version of Firefox on Ubuntu a relatively straightforward process.

Compared to using Snap, there are a few steps that you will have to complete before you can install the latest release. We mainly need to add the Mozilla package repository; luckily, this process isn’t very complicated.

Installing Firefox from the Mozilla Package Repository

1. Before we can set up the Mozilla package repository and install the latest Firefox version on Ubuntu, we must do a few things.

The first step is to update the current package list since we need to ensure you have wget installed on your machine. You can update this cache by running the following command.

sudo apt update

2. Once the package list cache has been updated, your next step is to install the “wget” package. We will use this package to grab the Mozilla repository GPG key.

Typically, this is already pre-installed on Ubuntu, but we can ensure it is available by running the following command.

sudo apt install wget

3. We can now use the wget command to download and save the GPG key to our Ubuntu system.

This GPG key is used to verify the validity of the packages downloaded to your system.

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

4. Once the GPG key has been saved to your system, you can add the official Mozilla package repository to Ubuntu by running the command below.

echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null

5. Our next step is to adjust the package priority so that Ubuntu will select the new version of Firefox to install rather than the one from its repository.

You can pin this repository by running the following command within the terminal.

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

6. Since we made changes to the available package repositories, we must update the package list cache using the following command.

sudo apt update

7. As we have now added the new Mozilla repository, we can now install the latest version of the Firefox web browser to Ubuntu by running the following command.

sudo apt install firefox

Updating to the Latest version of Firefox from the Mozilla Repository on Ubuntu

1. The Firefox web browser will be updated on Ubuntu whenever you upgrade your packages.

Before upgrading packages, you must update the package list cache using the following command.

sudo apt update

2. You can upgrade Firefox to the latest release by running the command below on your Ubuntu machine. This command will only specifically upgrade Firefox.

sudo apt install --only-upgrade firefox

Alternatively, you can upgrade all of your packages by using the command below.

sudo apt upgrade

Uninstalling the Firefox Web Browser and the Mozilla Repository

1. If you have decided to stop using the Firefox web browser on your Ubuntu system, removing it is relatively simple.

You can remove this web browser from your system by running the following command.

sudo apt remove firefox

2. If you don’t plan on using Firefox again, you will probably also want to remove the Mozilla repository.

Let us start by using the rm command to remove the “mozilla” preferences file.

sudo rm /etc/apt/preferences.d/mozilla

3. Our next step is to remove the Mozilla repository from your system, all we need to do is remove the “mozilla.list” file we created earlier on in this guide.

sudo rm /etc/apt/sources.list.d/mozilla.list

4. As we are removing the repository, we must also delete the Mozilla GPG key. There is no need for this key to be on our system if we don’t plan on installing and updating Firefox.

sudo rm /etc/apt/keyrings/packages.mozilla.org.asc

5. Finally, update your package list cache using the terminal command below. This will ensure that apt won’t attempt to download packages from the Mozilla repository.

sudo apt update

How to Install, Update, or Uninstall Firefox from the Default Package Repository

Firefox is included within the official Ubuntu repository, making it really easy to install if you want to avoid using Snap and don’t want to rely on the Mozilla package repository.

The downside of using this is that you are stuck with whatever version of Firefox is included with your version of Ubuntu. The older the release of Ubuntu you are using, the older version of Firefox you are likely to end up with.

Installing Firefox on Ubuntu

1. Before you install any package on Ubuntu, including Firefox, you should perform an update of your package list cache.

You can update this cache by using the following command in the terminal.

sudo apt update

2. Once the update is complete, all you need to do to install Firefox is to run the command below.

sudo apt install firefox

Updating Firefox to the Latest Release

1. Since we installed Firefox using the apt package manage, it will be automatically updated whenever you run an upgrade.

If you only want to upgrade Firefox, follow the next few steps.

Your first step is to update the package list cache so that Ubuntu will be aware of new versions it can download.

sudo apt update

2. Once the package list cache is updated, you can update Firefox to the latest version available in the Ubuntu repository by running the following command.

Including the “--only-upgrade” flag ensures this command will upgrade Firefox.

sudo apt install --only-upgrade firefox

Removing Firefox from Ubuntu

1. If you have decided to move to a different web browser, uninstall Firefox using the command below.

sudo apt remove firefox

Conclusion

Hopefully, by this point in the tutorial, you will know how to install the latest version of Firefox on your Ubuntu system.

This web browser is one of the best you can run on your Linux system. It is one of the few that does not rely on the Chromium code base while remaining highly compatible, performant, and private.

Please feel free to comment below if you have had any issues installing this browser on Ubuntu.

If you found this guide to be helpful, we highly recommend checking out our many other Ubuntu tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *