Firefox is a free and open-source web browser from Mozilla. It is one of the most popular and preferred web browsers globally because of its speed, customization, and security features. It is available for Linux, Windows, and macOS.
On Ubuntu 22.04 and later, Firefox comes preinstalled as a Snap package by default. While Snap offers advantages such as ease of installation, some users do not prefer it due to its slow startup time and disk space issues.
Snap is not the only installation method for Firefox on Ubuntu, however. There are multiple ways to install Firefox on Ubuntu. Let’s explore each of them.
1. Install the Firefox DEB Package on Ubuntu
If you don’t like the Snap version of Firefox, you can install the Firefox DEB package via APT. For this, you will need to add the Firefox PPA, give it priority over the Snap package, and then install Firefox using APT.
To add the Mozilla Firefox repository, run the following:
sudo add-apt-repository ppa:mozillateam/ppa
If you get the "add-apt-repository: command not found" error, simply install the software-properties-common package to fix the issue.
You may be prompted for admin credentials. After adding the repository, update the repository index with:
sudo apt update
Now create the file /etc/apt/preferences.d/mozilla using any text editor such as nano:
sudo nano /etc/apt/preferences.d/mozilla
Add the following lines to it:
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
Save and close the file when done.
Alternatively, run the following command (all at once) in your terminal to perform the above steps:
echo '
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/Mozilla
Now you can install the Firefox DEB package via APT:
sudo apt install firefox
If you want to automatically update Firefox whenever a newer version gets released, you will need to configure it by running:
echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox
Remove the Firefox DEB Package From Ubuntu
You can remove an application using APT if you no longer require it. To remove Firefox from Ubuntu, run:
sudo apt remove firefox
2. Install Firefox on Ubuntu via Snap
On Ubuntu 22.04 and later versions, Firefox comes preinstalled as a Snap package. However, if you've accidentally removed Firefox or are using an older Ubuntu version, you can still install Firefox as a Snap package.
To do this, you must first install snapd on your system if it is not already installed. Once installed, install Firefox on Ubuntu with:
sudo snap install firefox
To verify the installation, view the installed Firefox version with:
firefox -v
Uninstall the Firefox Snap Package
To uninstall Firefox from Ubuntu, run:
sudo snap remove firefox
3. Install Firefox on Ubuntu via Flatpak
Another way to install Firefox on Ubuntu is through Flatpak. However, you will first need to install Flatpak on your system. Install it by running:
sudo apt install flatpak
Then, add the Flathub repository with:
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Now, to install the Firefox Flatpak package, run:
flatpak install flathub org.mozilla.firefox
Once installed, you can launch Firefox using:
flatpak run org.mozilla.firefox
Uninstall the Firefox Flatpak Package
To uninstall the Firefox Flatpak package, use the following command:
sudo flatpak uninstall org.mozilla.firefox
4. Installing Firefox on Ubuntu From Source
Mozilla Firefox also provides a TAR archive on its official website. Follow the below steps to install Firefox from source on Ubuntu:
Download the Firefox TAR.BZ2 package from the Firefox downloads page or use the following command to download the Firefox latest version (as of this writing) from the terminal:
wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/116.0/linux-x86_64/en-GB/firefox-116.0.tar.bz2
Download: Mozilla Firefox
Then, use the cd command to move to the directory containing the downloaded file and unpack the contents of the archive using the tar command:
tar xjf firefox-*.tar.bz2
It will create a new directory named firefox in your current terminal directory. Use the mv command to move this directory to /opt:
sudo mv firefox /opt
Next, create a symbolic link to the Firefox executable with:
sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox
To launch Firefox from the applications menu, download a copy of its desktop file and save it to /usr/local/share/applications:
sudo wget https://raw.githubusercontent.com/mozilla/sumo-kb/main/install-firefox-linux/firefox.desktop -P /usr/local/share/applications
Now you can launch Firefox either through the applications menu or by running:
firefox
Uninstall Firefox From Ubuntu
To uninstall Firefox that you have installed via its TAR archive, remove the /opt/firefox directory using the rm command:
sudo rm -r /opt/firefox
5. Install Firefox on Ubuntu via Ubuntu Software Center
You can install Firefox through the Ubuntu Software Center if you prefer GUI over the command line.
Open Software Center from the dock on the left and in the search bar, type "Firefox." From the search results, click Firefox.
Click the Install button to initiate the installation. When prompted for authentication, type your password and click Authenticate. It will then start the installation process.
Once installed, you can launch Mozilla Firefox from the dock or the applications menu of your system.
Uninstall Firefox From Ubuntu via GUI
To uninstall Firefox, open the Ubuntu Software application. Go to the Installed tab and click Delete, located next to the Firefox entry. Click Remove and provide your password for authentication, and it will then remove Mozilla Firefox from your system.
Protect Privacy and Speed Up Your Browsing With Firefox
With Firefox, you can experience faster browsing while safeguarding your personal information. Given the various methods of installing Firefox, you can choose any based on your preferences.
After you have installed Mozilla Firefox, you can easily set it as the default browser either from the Firefox settings menu or via the Default Applications section in the Ubuntu Settings.
FAQ
Q: How Do I Know if Firefox Is Installed on Ubuntu?
To check whether Mozilla Firefox is successfully installed on your Ubuntu PC, simply type firefox in the terminal and hit Enter. A new Firefox browser window will pop up.
Another way is to use whereis to check the location of the Firefox binary:
whereis firefox
The output will include a path to the Mozilla Firefox binary. If it doesn't, consider reinstalling Mozilla Firefox.
Q: Why Can't I Open Mozilla Firefox in Ubuntu?
A broken installation can cause Firefox to behave unexpectedly. To fix this issue, first, try reinstalling Mozilla Firefox on your Ubuntu PC and check if the issue persists.
If you've installed Firefox from the Snap Store, restart the Snap daemon to see if it fixes the problem:
sudo systemctl restart snapd.service
Q: How Do I Install Older Versions of Firefox on Ubuntu?
To install older Mozilla Firefox versions on Ubuntu, head over to the Ubuntuzilla SourceForge web page and download the DEB file corresponding to the version you want to install.
Download: Mozilla Firefox Ubuntuzilla
Then, launch the terminal, navigate to the directory where you've downloaded the DEB package, and run:
sudo dpkg -i firefox-mozilla-build-*.deb
Make sure to include the actual file name in the command.