如何在Ubuntu 22.04或更高版本中安装Firefox作为传统的deb软件包(而不是snap)?

就我所见,对于正在进行的22.04 Jammy版本的开发来说,Firefox是一个Snap包。apt中的相关Deb包只是指向该Snap版本的快捷方式/链接。
我希望我的安装不要使用Snap包,因为我觉得它们太过“Ubuntu特定”。
在Jammy上有没有其他安装Firefox的方式?我最喜欢的选项是通过Apt存储库或PPA安装。与此同时,我将在我的测试虚拟机中尝试Flatpak版本。

10个回答

Organic Marble的回答适用于Firefox-ESR,而eddygeek的回答适用于测试版。
这个回答适用于Firefox的最新稳定版本。你可以使用由Mozilla团队维护的Firefox PPA
sudo add-apt-repository ppa:mozillateam/ppa

然后,在终端中一次性复制并粘贴以下代码(不要逐行复制粘贴),以将 apt 版本的 Firefox 设置为优先于 snap 版本。
echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001

Package: firefox
Pin: version 1:1snap1-0ubuntu2
Pin-Priority: -1
' | sudo tee /etc/apt/preferences.d/mozilla-firefox

接下来,你需要移除Snap版本的Firefox。
sudo snap remove firefox

使用apt安装Firefox。
sudo apt install firefox

为了确保未经监督的升级不会重新安装 Firefox 的 snap 版本,请输入以下命令。或者,您可以关闭未经监督的升级。
echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox

撤销这些更改的方法如下:
1. 删除 Firefox PPA。
sudo add-apt-repository -r ppa:mozillateam/ppa

移除apt pin。
sudo rm -rf /etc/apt/preferences.d/mozilla-firefox

删除apt版本并重新安装snap。
sudo apt remove firefox && sudo snap install firefox

来源:OMG Ubuntu

25Ubuntu认为snap版本比实际仓库中的版本更新,这真是太愚蠢了。封锁Ubuntu安装snap版本的回答是有道理的,但现在却需要添加固定版本以阻止它,这真的很麻烦,而过去却不需要这样做。非常感谢你给出的完美答案!+1 - Terrance
4谢谢!这很有帮助。作为一名开发者,我不能容忍在相同的URL上,curl localhost:3000/可以正常工作,而浏览器却因Snap的问题给我显示一些胡言乱语的错误信息。 - ulidtko
7如果你要这样做,请注意两件事情: a) snap 将你的 Firefox 配置文件放在 ~/snap/firefox/common/.mozilla/firefox/...(尽管旧的配置文件可能在 ~/.mozilla/firefox/... 中) b) 当你移除 snap 时,该目录 (~/snap/firefox/common/) 将被删除!因此,在进行此操作之前,最好备份/迁移你的 Firefox 配置文件。如果你遇到问题,可以参考以下链接获取帮助:https://askubuntu.com/questions/1245136/where-does-snap-store-user-data-for-apps-that-have-been-removed 和 https://snapcraft.io/docs/snapshots,它们可能会帮助你恢复你的配置文件。 - PeterJCLaw
这个答案会不会抹去您的个人资料和所有应用数据——书签、历史记录、设置、密码等等? - markling
@markling 是的,它会的。但是你可以通过登录Firefox来同步所有内容。 - Archisman Panigrahi
在进行此操作之前,是否有必要注册并部署Firefox Sync,否则您将丢失数据?难道你不应该这样说吗? - markling
@markling 有一条评论说如何在不登录的情况下恢复您的个人资料 - Archisman Panigrahi
@markling 我已经编辑了答案,添加了一个警告。我个人从未遇到过这个问题,因为每次进行新安装后,我都会删除Snap,并通过登录来恢复我的书签。 - Archisman Panigrahi
@markling 这不是很明显吗?毕竟Snap是自包含的。 - undefined


请注意,如果您尝试将旧的FireFox个人配置文件用于FireFox ESR,它将无法启动并报告可能的个人配置文件损坏问题。我没有尝试寻找解决办法,而是从其他答案中切换到了常规Firefox的PPA安装版本。 - ntc2
1你可以保留你的个人资料,但前提是ESR版本与当前发布版本相同或更新。而且这种情况每年只会发生一次。 - undefined

这是我在升级到Ubuntu 22.10后唯一有效的方法。
首先,删除Snap版本的Firefox:
sudo snap remove firefox

(如果您在Snap版本的Firefox中有设置,位于~/snap/firefox/下,您可能希望将其迁移到~/.mozilla/firefox/下。)
然后添加来自mozillateam的PPA
sudo add-apt-repository ppa:mozillateam/ppa

现在,Ubuntu仓库和Mozilla PPA都提供firefox软件包。在Ubuntu仓库中提供的版本是一个过渡性软件包,实际上在后台安装了Snap版本的Firefox,而在这种情况下,我们不需要这样做。通过运行以下命令来检查是否可以看到两个firefox软件包:
apt info -a firefox

为了防止通过Ubuntu提供的firefox软件包安装Snap版本的Firefox,我们需要以root身份修改此文件,使用gnome-text-editor或您喜欢的任何文本编辑器。
sudo gnome-text-editor /etc/apt/preferences.d/mozillafirefoxppa

添加这些行:
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501

Package: firefox*
Pin: release o=Ubuntu
Pin-Priority: -1

首先三行代码优先使用Mozilla PPA提供的firefox软件包。而最后三行代码禁止从Ubuntu的软件源安装firefox软件包。
运行sudo apt update以确保更改已生效。
现在,您应该能够安装PPA版本的Firefox。您可以使用--dry-run模拟安装Firefox,如下所示,以检查将安装哪个版本的Firefox:
sudo apt install --verbose-versions --dry-run firefox

如果您在firefox软件包的版本号中没有看到单词snap(例如:1:1snap1-0ubuntu2),那么您可以放心使用。运行以下命令来安装不带Snap的Firefox:
sudo apt install --verbose-versions firefox

我的参考:https://fostips.com/ubuntu-21-10-two-firefox-remove-snap/ - Flimm
在升级到下一个Ubuntu版本之前,请记得撤销此操作。 - Flimm
为什么在升级Ubuntu之前要撤销这个操作? - E. l4d3
@E.l4d3 我在不撤销的情况下升级了Ubuntu,结果导致APT出现了问题。具体来说,是固定版本引起的问题。我现在记不太清楚了,就只记得这些。 - Flimm

Firefox从Deb到Snap的转变在2021年9月宣布。请参阅https://discourse.ubuntu.com/t/feature-freeze-exception-seeding-the-official-firefox-snap-in-ubuntu-desktop/24210/199以获取完整讨论内容。
这是Canonical的桌面和Snap团队与Mozilla开发人员之间合作与协作的结果,也是22.04开发周期中将进行的从deb到snap过渡的第一步。
翻译:Firefox从Deb到Snap的转变是Mozilla驱动的决定。Ubuntu团队正在尽力使大多数用户的过渡尽可能顺利。
自21.10周期以来,许多志愿者一直在测试Firefox Snap,并发现/报告/修复错误,以消除其中的问题并记录特殊情况。(我自那时起就一直在使用它)
希望使用Firefox的用户有几个选择:
  1. 使用Snap。Snap来自Mozilla上游,旨在跨发行版和跨平台使用。你不应该认为它是“仅限于Ubuntu”的。Firefox Snap将包含在Ubuntu桌面的默认安装中。

  2. 从Mozilla上游下载二进制文件。这需要了解如何在没有软件包管理器的情况下进行安装和卸载。这与Snap中使用的二进制文件相同。

  3. 如果你仍然想使用Ubuntu存储库中的deb软件包,请加入Debian并帮助那些为Firefox工作的志愿打包者。将其作为deb软件包进行打包是一项复杂的任务(这也是为什么Mozilla对继续努力持消极态度),但只要有足够的志愿者参与,社区就能够做出伟大的事情。

  4. Ubuntu的Mozillateam PPA目前提供Firefox-beta和Firefox-ESR的deb软件包。这些通常是高质量的软件包,并且还依赖足够的志愿者参与来保持质量。

  5. Flatpak和其他附加软件包管理器。


13无论是Flatpak还是Snap,都存在同样的问题。它们都是将“非本地”系统打包的方法,带有大量的环境、依赖等。对于一些“独立”的应用程序来说,这可能没问题,但作为系统中一个如此重要的组成部分,默认的网络浏览器应该与系统紧密集成,这意味着它应该是一个.deb软件包。使用Debian的.deb软件包似乎是唯一可行的方式。 - raj
4@raj 嗯,不管你喜不喜欢,没有更多志愿者的参与,它将不再是一个.deb软件包了。 - user535733
3很快就会有人提供PPA的firefox.deb文件。 - Pavel Niedoba
9Mozilla团队PPA已经制作了该软件包(以及ESR和Thunderbird)。Ubuntu自己的Firefox软件包的维护者是该团队的成员。https://launchpad.net/~mozillateam/+archive/ubuntu/ppa。还有一个[逐步指南](https://fostips.com/ubuntu-21-10-two-firefox-remove-snap/)来添加PPA并设置优先级。 - Nim
9这个问题 https://bugzilla.mozilla.org/show_bug.cgi?id=1661935 (Snap 不支持 NativeMessaging) 目前使得 Snap 版本过于受限制(例如 browserpass 扩展、KDE Plasma 集成、GNOME 扩展集成等等)。这是一个真正的退步,而且我不确定提出的解决方案会很快准备好... - alci
2如果你故意从21.10中清除了Firefox的snap版本,并安装了非snap版本,那么会发生什么呢?它会无视你的清除操作并安装snap版本,还是根本不会安装Firefox? - Michael

如前所述
移除 Firefox 的快照版本
sudo snap remove firefox

添加mozillateam软件源
sudo add-apt-repository ppa:mozillateam/ppa

未经监控的更新
echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox

如果你不想从LP-PPA-mozillateam更新所有软件包,那么我会做以下操作:
echo '
Package: firefox
Pin: version 1:1snap1-0ubuntu2
Pin-Priority: 99

Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 99

Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/mozilla-firefox

这只更新了来自LP-PPA-mozillateam的Firefox软件包,而不是其他软件。还降低了Firefox快照版本的优先级。
现在您已经准备好安装Firefox。
sudo apt install firefox

我找到了以下解决方法,可以从firefox-next ppa获取基于deb的Firefox。
警告:这是测试版!
由于软件包名称也是firefox,我们需要将版本为1:1snap1-0ubuntu2的虚拟快捷方式包blacklist
sudo apt remove firefox
echo "
Package: firefox
Pin: version 1:1snap1-0ubuntu2
Pin-Priority: 99
" | sudo tee /etc/apt/preferences
sudo add-apt-repository ppa:mozillateam/firefox-next
sudo apt install firefox

这是一个变种的add-apt-repository步骤,仍然遵守新的软件包签名要求 - 它适用于ppa(主要发布)和firefox-next(测试版)存储库。
sudo gpg --keyserver hkp://keyserver.ubuntu.com:80 --no-default-keyring --keyring /usr/share/keyrings/firefox.gpg --recv-keys 9BDB3D89CE49EC21
echo 'deb [signed-by=/usr/share/keyrings/firefox.gpg]  https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu jammy main 
' | sudo tee /etc/apt/sources.list.d/firefox.list

这对我很有用,因为在KDE Neon 22.04的预发布版本中,add-apt-repository目前返回aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Neon/jammy

您可以在此处安装适用于Ubuntu 22.04 LTS(Jammy)的最新官方.deb构建:
https://launchpad.net/~phd/+archive/ubuntu/firefox/ 这是一个PPA存储库,包含最初发布给Ubuntu 20.04 LTS(Focal)的官方Ubuntu软件包,并在新版本发布后自动更新。

我的答案与他人的类似,但我在使用hunspell时遇到了问题。如果不卸载它,我将无法继续。正如markling和Archisman Panigrahi所说,你必须在开始之前以某种方式备份你的Firefox配置文件,或者使用Firefox Sync将其全部保存到云端,否则你将会失去你的书签、密码等。在完成备份后,我做了以下操作:

sudo snap disable firefox
sudo umount /var/snap/firefox/common/host-hunspell
sudo snap remove --purge firefox
sudo apt purge firefox
sudo apt autoremove
sudo add-apt-repository ppa:mozillateam/ppa
echo '
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501
   
Package: firefox*
Pin: release o=Ubuntu
Pin-Priority: -1
' | sudo tee /etc/apt/preferences.d/99mozillateamppa
echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox
sudo apt update
sudo apt install firefox

Mozillateam PPA的“firefox”软件包分发的是官方上的测试版(我在正式发布前一周收到了Firefox 116),尽管你可以将其视为一个正式版本候选(116在被打包到Mozillateam PPA之前已经处于测试版状态三周)。如果您对此不完全满意,那么您可以编辑最后一行,安装“firefox-esr”而不是“firefox”。
sudo apt install firefox-esr

从snap Firefox安装切换到ppa和apt安装是自动化的在这里,尝试比Archisman Panigrahi的有效且紧凑的脚本更具控制和文档化。也许有人会喜欢它:
#!/bin/bash
# This script verifies Firefox is installed in the right way. Firefox is used
# to set the GitHub SSH keys and GitHub personal access tokens automatically.
# And to control a Firefox browser, it needs to be installed using apt instead
# of snap. https://stackoverflow.com/questions/72405117
# https://www.omgubuntu.co.uk/2022/04/how-to-install-firefox-deb-apt-ubuntu-22-04
# https://askubuntu.com/questions/1399383/

# Run with:
# bash -c "src/prerequisites/firefox_version.sh"

command_output_contains(){
    local substring="$1"
    shift
    local command_output="$@"
    if grep -q "$substring" <<< "$command_output"; then
        echo "FOUND"
    else
        echo "NOTFOUND"
    fi
}

#######################################
# Checks if firefox is installed using snap or not.
# Locals:
#  respones_lines
#  found_firefox
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If command was evaluated successfully.
# Outputs:
#  FOUND if firefox is installed using snap.
#  NOTFOUND if firefox is not installed using snap.
#######################################
firefox_via_snap(){
    local respons_lines="$(snap list)"
    local found_firefox=$(command_output_contains "firefox" "${respons_lines}")
    echo $found_firefox
}

#######################################
# Checks if firefox is installed using ppa and apt or not.
# Locals:
#  respones_lines
#  found_firefox
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If command was evaluated successfully.
# Outputs:
#  FOUND if firefox is installed using ppa and apt.
#  NOTFOUND if firefox is not installed using ppa and apt.
#######################################
firefox_via_apt(){
    local respons_lines="$(apt list --installed)"
    local found_firefox=$(command_output_contains "firefox" "${respons_lines}")
    echo $found_firefox
}

#######################################
# Checks if firefox is added as ppa or not.
# Locals:
#  respones_lines
#  ppa_indicator
#  found_firefox_ppa
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If command was evaluated successfully.
# Outputs:
#  FOUND if firefox is added as ppa.
#  NOTFOUND if firefox is not added as ppa.
#######################################
firefox_ppa_is_added(){
    # Get list of ppa packages added for apt usage.
    local respons_lines="$(apt policy)"
    # Specify identifier for firefox ppa presence.
    local ppa_indicator="https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu"
    local found_firefox_ppa=$(command_output_contains "$ppa_indicator" "${respons_lines}")
    echo $found_firefox_ppa
}


#######################################
# Remove Firefox if it is installed using snap.
# Locals:
#  respones_lines
#  found_firefox
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If command was evaluated successfully.
# Outputs:
#  FOUND if firefox is installed using snap.
#  NOTFOUND if firefox is not installed using snap.
#######################################
remove_snap_install_firefox_if_existant(){
    if [ "$(firefox_via_snap)" == "FOUND" ]; then
        
        # Prompt user for permission.
        ask_user_swapping_firefox_install_is_ok
        
        # User permission is granted here, remove firefox snap installation.
        yes | sudo snap remove firefox 2>&1
        assert_firefox_is_not_installed_using_snap
        echo "Firefox is removed." > /dev/tty
    fi
    assert_firefox_is_not_installed_using_snap
}

#######################################
# Ask user for permission to swap out Firefox installation.
# Locals:
#  yn
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If command was evaluated successfully.
#  3 If the user terminates the program.
# Outputs:
#  Mesage indicating Firefox will be uninstalled.
#######################################
ask_user_swapping_firefox_install_is_ok(){
    echo "" > /dev/tty
    echo "Hi, firefox is installed using snap. To automatically add your " > /dev/tty
    echo "access tokens to GitHub, we need to control the firefox browser." > /dev/tty
    echo "To control the firefox browser, we need to switch the installation" > /dev/tty
    echo "method from snap to apt." > /dev/tty
    echo "" > /dev/tty
    echo "We will not preserve your bookmarks, history and extensions." > /dev/tty
    echo "" > /dev/tty
    while true; do
        read -p "May we proceed? (y/n)? " yn
        case $yn in
            [Yy]* ) echo "Removing Firefox, please wait 5 minutes, we will tell you when it is done."; break;;
            [Nn]* ) echo "Installation terminated by user."; exit 3;;
            * ) echo "Please answer yes or no." > /dev/tty;;
        esac
    done
}

#######################################
# Asserts Firefox is not installed using snap, throws an error otherwise.
# Locals:
#  None
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If Firefox is not installed using snap.
#  1 If Firefox is still isntalled using snap.
# Outputs:
#  Nothing
#######################################
# Run with:
assert_firefox_is_not_installed_using_snap(){
    if [ "$(firefox_via_snap)" == "FOUND" ]; then
        echo "Error, Firefox installation was still installed using snap." > /dev/tty
        exit 2
    fi
}
assert_firefox_is_installed_using_ppa(){
    if [ "$(firefox_via_apt)" != "FOUND" ]; then
        echo "Error, Firefox installation was not performed using ppa and apt." > /dev/tty
        exit 2
    fi
}

#######################################
# Asserts Firefox ppa is added to apt.
# Locals:
#  None
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If Firefox ppa is added to apt.
#  4 Otherwise.
# Outputs:
#  Error message indicating firefox ppa is not added correctly.
#######################################
# Run with:
assert_firefox_ppa_is_added_to_apt(){
    if [ "$(firefox_ppa_is_added)" == "NOTFOUND" ]; then
        echo "Error, Firefox ppa was not added to apt." > /dev/tty
        exit 4
    fi
}
assert_firefox_ppa_is_removed_from_apt(){
    if [ "$(firefox_ppa_is_added)" == "FOUND" ]; then
        echo "Error, Firefox ppa was not removed from apt." > /dev/tty
        exit 4
    fi
}

#######################################
# Adds firefox ppa to install using apt if it is not added yet.
# Locals:
#  None
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If Firefox is not installed using snap.
#  1 If Firefox is still isntalled using snap.
# Outputs:
#  Nothing
#######################################
add_firefox_ppa_if_not_in_yet(){
    if [ "$(firefox_ppa_is_added)" == "NOTFOUND" ]; then
        echo "Now adding Firefox ppa to apt." > /dev/tty
        echo "" > /dev/tty
        yes | sudo add-apt-repository ppa:mozillateam/ppa
    fi
    assert_firefox_ppa_is_added_to_apt
}
remove_firefox_ppa(){
    if [ "$(firefox_ppa_is_added)" == "FOUND" ]; then
        echo "Now removing Firefox ppa to apt." > /dev/tty
        echo "" > /dev/tty
        yes | sudo add-apt-repository --remove ppa:mozillateam/ppa
    fi
    assert_firefox_ppa_is_removed_from_apt
}


#######################################
# Asserts the Firefox installation package preference is set to ppa/apt. Does
# this by verifying the file content is as expected using hardcoded MD5Sum.
# Locals:
#  None
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If Firefox is not installed using snap.
#  1 If Firefox is still isntalled using snap.
# Outputs:
#  Nothing
#######################################
assert_firefox_installation_package_preference_file_content(){
    local preferences_path="$1"
    local md5_output=$(md5sum $preferences_path)
    local expected_md5_output="961023613b10ce4ae8150f78d698a53e  $preferences_path"
    if [ "$md5_output" != "$expected_md5_output" ]; then
        echo "Error, the md5 output of: $preferences_path is not as expected." > /dev/tty
        echo "md5_output=         $md5_output" > /dev/tty
        echo "expected_md5_output=$expected_md5_output" > /dev/tty
        exit 5
    fi
}

assert_firefox_auto_update_file_content(){
    local preferences_path="$1"
    local md5_output=$(md5sum $preferences_path)
    local expected_md5_output="ffd6e239ef98a236741f4ba5c84ab20e  $preferences_path"
    if [ "$md5_output" != "$expected_md5_output" ]; then
        echo "Error, the md5 output of: $preferences_path is not as expected." > /dev/tty
        echo "md5_output=         $md5_output" > /dev/tty
        echo "expected_md5_output=$expected_md5_output" > /dev/tty
        exit 5
    fi
}


#######################################
# Sets the Firefox installation package preference from snap to ppa/apt.
# Locals:
#  preferences_path
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If Firefox is not installed using snap.
#  1 If Firefox is still isntalled using snap.
# Outputs:
#  Nothing
#######################################
# Run with:
change_firefox_package_priority(){
    local preferences_path="/etc/apt/preferences.d/mozilla-firefox"

    # Set the installation package preference in firefox.
    echo 'Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001' | sudo tee "$preferences_path"

    # Verify the installation package preference is set correctly in firefox.
    assert_firefox_installation_package_preference_file_content "$preferences_path"
}

#######################################
# Ensures the firefox installation is updated automatically.
# Locals:
#  update_filepath
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If Firefox is not installed using snap.
#  1 If Firefox is still isntalled using snap.
# Outputs:
#  Nothing
#######################################
ensure_firefox_is_updated_automatically(){
    local update_filepath="/etc/apt/apt.conf.d/51unattended-upgrades-firefox"
    # Set the installation package preference in firefox.
    echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee "$update_filepath"

    # Verify the installation package preference is set correctly in firefox.
    assert_firefox_auto_update_file_content "$update_filepath"
}


#######################################
# Installs firefox using ppa and apt.
# Locals:
#  None
# Globals:
#  None
# Arguments:
#  None
# Returns:
#  0 If Firefox is installed using ppa and apt.
#  1 If Firefox is mpt installed using ppa and apt.
# Outputs:
#  Nothing
#######################################
install_firefox_using_ppa(){
    if [ "$(firefox_via_apt)" == "NOTFOUND" ]; then
        yes | sudo apt install firefox 2>&1
    fi
    assert_firefox_is_installed_using_ppa
    echo "Firefox is installed succesfully using ppa and apt." > /dev/tty
}


# Swap Firefox installation from snap to ppa/apt using functions above.
# 0. Detect how firefox is installed.
# 1. If firefox installed with snap:
# 1.a Ask user for permission to swap out Firefox installation.
# 1.b. Verify and mention the bookmarks, addons and history are not removed.
# 1.c Remove snap firefox if it exists.
# 1.d Verify snap firefox is removed.
remove_snap_install_firefox_if_existant

# 2.a Add firefox ppa to apt if not yet in.
# 2.b Verify firefox ppa is added (successfully).
add_firefox_ppa_if_not_in_yet
#remove_firefox_ppa

# 3.a Change Firefox package priority to ensure it is installed from PPA/deb/apt
# instead of snap.
# 3.b Verify Firefox installation priority was set correctly.
change_firefox_package_priority

# 4.a Ensure the Firefox installation is automatically updated.
# 4.b Verify the auto update command is completed succesfully.
ensure_firefox_is_updated_automatically

# 5.a Install Firefox using apt.
# 5.v Verify firefox is installed succesfully, and only once, using apt/PPA.
install_firefox_using_ppa


最近,FF团队推出了一个官方的Debian仓库,里面包含了Firefox Nightly的版本。
# make folder for PGP repo key
sudo install -d -m 0755 /etc/apt/keyrings
# download repo key and store to /etc/apt/keyrings
sudo wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O /etc/apt/keyrings/packages.mozilla.org.asc
# add the APT repository to 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

# Update package list
sudo apt-get update
# Install the Firefox Nightly .deb package
sudo apt-get install firefox-nightly

启动FF Nightly的命令是firefox-nightly。它的蓝色图标将与FF一起显示。 它将比snap版本更频繁地更新,这可能会让人感到烦恼。