Install Firefox – Command line

Many Linux distributions come with Firefox pre-installed through their package manager and set as the default browser. However, if you need to install Firefox on Linux using a different method, the following guide will show you various alternative ways to download and install Firefox on Linux.

Source: https://support.mozilla.org/en-US/kb/install-firefox-linux

Install Firefox .deb package for Debian-based distributions (Recommended)

To install the .deb package through the APT repository, do the following:
Create a directory to store APT repository keys if it doesn’t exist:

sudo install -d -m 0755 /etc/apt/keyrings

Import the Mozilla APT repository signing key:

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

Next, add the Mozilla APT repository to your sources list:

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

Configure APT to prioritize packages from the Mozilla repository:

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

Update your package list and install the Firefox .deb package:

sudo apt-get update && sudo apt-get install firefox

That is it, you should now have Firefox installed on your system.

By Anthony