Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Install Firefox From APT Repository

Introduction

I just installed the minimal version of Kubuntu 24.04 which doesn't come with Firefox. When I try to install Firefox, it tries to install it through snaps by default. This tutorial will show you how to run a script so that you configure installing from Firefox's repository with traditional debian packages.

Steps

Copy, paste, and run the BASH script below to configure an APT source for Firefox and prefer that, so we don't install Firefox using snaps.

#!/bin/bash

# instructions to install firefox from:
# https://support.mozilla.org/en-US/kb/install-firefox-linux

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

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

gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); if($0 == "35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3") print "\nThe key fingerprint matches ("$0").\n"; else print "\nVerification failed: the fingerprint ("$0") does not match the expected one.\n"}'

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 prefer from the repo
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
' | sudo tee /etc/apt/preferences.d/mozilla

# Finally, install Firefox
sudo apt-get update \
  && sudo apt-get install firefox -y
Last updated: 1st May 2024
First published: 1st May 2024

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch