如何在 Ubuntu 22.04 上安 Firefox.Deb(不是How to Install Firefox as a .Deb on Ubuntu 22.04 (Not a Snap)

Posted 禅与计算机程序设计艺术

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在 Ubuntu 22.04 上安 Firefox.Deb(不是How to Install Firefox as a .Deb on Ubuntu 22.04 (Not a Snap)相关的知识,希望对你有一定的参考价值。

在本指南中,我详细介绍了如何在Ubuntu 22.04 LTS或 22.10 上将 Mozilla Firefox 安装为 .deb 包,而不是 Snap 应用程序。

默认情况下,最新版本的 Ubuntu 作为 Snap 应用程序与 Firefox 一起提供。此 Snap 是唯一“开箱即用”的 Firefox 版本。如果您apt install firefox在 Ubuntu 22.04 上运行,它将不会像以前那样安装 .deb 版本。相反,Ubuntu 包括一个(重新)安装 Firefox Snap 的过渡包。

如果您不想使用 Firefox Snap 包,这不是理想的选择——您可能有不这样做的原因。

Snap 应用程序有其优点(不,真的),但也有一些长期存在的缺点:

  • Snap 应用程序在后台自动更新
  • Snap 应用程序启动时间比普通软件慢
  • 一些第三方集成(目前)已损坏

所有这些都是可以克服的;有命令行选项可以调整、暂停或延迟 Snap 应用更新;Mark Shuttleworth 说,应用程序启动时间慢,正在研究中;以及有关损坏的桌面集成(例如,GNOME 扩展、第三方密码管理器等)的问题正在修复。

通过 Apt(不是 Snap)安装 Firefox

好消息是您可以使用几个命令在 Ubuntu 22.04(或 22.10)上安装 Firefox deb。您先添加Mozilla Team PPA,从 PPA 安装 Firefox deb,然后“固定”包以确保以后不会重新安装 Firefox Snap。

然而,在你继续之前,你应该备份/导出任何重要的浏览器设置、书签和来自 Firefox 的其他数据,以免出现任何问题。

第 1 步:通过在新的终端窗口中运行以下命令来删除 Firefox Snap :

sudo snap remove firefox

第 2 步:通过在同一终端窗口中运行以下命令,将 (Ubuntu) Mozilla 团队 PPA 添加到您的软件源列表中:

 sudo add-apt-repository ppa:mozillateam/ppa

第 3 步:接下来,更改 Firefox 包的优先级以确保首选 PPA/deb/apt 版本的 Firefox。这可以使用FosTips 中的一小段代码来完成(复制并粘贴整个代码,而不是逐行粘贴):

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

第 4 步:由于您(希望)希望自动安装未来的 Firefox 升级,Balint Reczey 在他的博客上分享了一个简洁的命令来确保它发生:

echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:$distro_codename";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox

第 5 步:最后,运行以下命令通过 apt 安装 Firefox:

sudo apt install firefox

一旦 Firefox 安装完成弹出打开应用程序启动器并单击 Firefox 图标以启动 de-Snapped 版本,您可以固定到 Ubuntu dock。

旁注…

如果你想要一个 Firefox 版本的主要原因.deb是你可以安装 GNOME 扩展,我会指出有一个更简单的解决方法使用sudo apt install gnome-shell-extension-manager.

想要安装 GNOME 扩展?试试新的扩展管理器应用程序吧!

该工具使浏览器集成的需求完全没有实际意义,这就是为什么它在我们安装 Ubuntu 22.04 后要做的事情列表中。它允许您在应用程序而非浏览器中搜索、浏览、更新、安装和管理您的扩展程序。

另外,请记住,意味着您无法使用 Firefox Snap 安装 GNOME 扩展的“错误”将在未来的某个时候得到修复——因此请考虑等待解决方案!

最后,Mozilla Team PPA 最初旨在提供浏览器的扩展支持版本 (ESR)。我还没有找到任何声明来说明 PPA 是否会尽快获得新版本的 Firefox(与 Snap 版本一样)或者只是在以后的日期,这取决于志愿者。请记住这一点。

但是嘿:我知道你们中的许多人一直在问如何用 deb 版本替换 Firefox Snap,并且没有下载和链接 Firefox 二进制文件——这不是最糟糕的运行方式;这是我在 21.10 期间的解决方法——这种方法可以说是(现在已经消失的)旧 apt 构建最类似的替代方法。

 


In this guide I detail how to install Mozilla Firefox as a .deb package on Ubuntu 22.04 LTS or 22.10 and not as a Snap app.

The latest versions of Ubuntu ship with Firefox as a Snap app by default. This Snap is the only version of Firefox included ‘out of the box’. If you run apt install firefox on Ubuntu 22.04 it will NOT install a .deb version as before. Instead, Ubuntu includes a transitionary package that (re)installs the Firefox Snap.

This isn’t ideal if you don’t want to use the Firefox Snap package — there are reasons you might not.

Snap apps have their pluses (no, really) but there some long-standing negatives:

  • Snap apps update automatically in the background
  • Snap app startup times are slower than regular software
  • Some third-party integrations are (currently) broken

All of these are surmountable; there are command line options to adjust, pause, or delay Snap app updates; slow app start up times are, says Mark Shuttleworth, an are being worked on; and the issue regarding broken desktop integrations (e.g, GNOME extensions, third-party password managers, etc) is being fixed.

Installing Firefox via Apt (Not Snap)

The good news is that you can install a Firefox deb on Ubuntu 22.04 (or 22.10) with a couple of commands. You fist add the Mozilla Team PPA, install the Firefox deb from the PPA, then ‘pin’ the package to ensure that the Firefox Snap is not reinstalled at a later date.

However, before you go any further you should backup/export any important browser settings, bookmarks, and other data from Firefox lest anything go rogue.

Step 1: Remove the Firefox Snap by running the following command in a new Terminal window:

sudo snap remove firefox

Step 2: Add the (Ubuntu) Mozilla team PPA to your list of software sources by running the following command in the same Terminal window:

 sudo add-apt-repository ppa:mozillateam/ppa

Step 3: Next, alter the Firefox package priority to ensure the PPA/deb/apt version of Firefox is preferred. This can be done using a slither of code from FosTips (copy and paste it whole, not line by line):

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

Step 4: Since you’ll (hopefully) want future Firefox upgrades to be installed automatically, Balint Reczey shares a concise command on his blog that ensures it happens:

echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:$distro_codename";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox

Step 5: Finally, install Firefox via apt by running this command:

sudo apt install firefox

As soon as the Firefox installation completes pop open the app launcher and click on the Firefox icon to launch a de-Snapped version you can pin to the Ubuntu dock.

Sidenotes…

If your main reason for wanting a .deb version of Firefox is so you can install GNOME extensions I will point out there is a simpler workaround: install the (fantastic) GNOME Extension Manager app from the repo using sudo apt install gnome-shell-extension-manager.

Want to install GNOME extensions? Try the new extension manager app instead!

That tool renders the need for browser integration totally moot which is why it’s on our list of things to do after installing Ubuntu 22.04. It lets you search, browse, update, install, and manage your extensions within an app not a browser.

Also, keep in mind that the “bug” that means you can’t install GNOME extensions using the Firefox Snap will be fixed at some point in the future — so consider hanging tight for a solution!

Finally, the Mozilla Team PPA was initially designed to provide Extended Support Release (ESR) versions of the browser. I haven’t been able to locate any statement to say whether the PPA will get new builds of Firefox ASAP (as with the Snap version) or merely at a later date, volunteer dependent. Keep this in mind.

But hey: I know many of you have been asking how to replace the Firefox Snap with a deb version and, short of downloading and linking the Firefox binary — not the worst way to run it; it was my workaround during 21.10 — this method is arguably the most analogous drop-in for the (now gone) old apt build.

 

以上是关于如何在 Ubuntu 22.04 上安 Firefox.Deb(不是How to Install Firefox as a .Deb on Ubuntu 22.04 (Not a Snap)的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Ubuntu 22.04 LTS 上安装 Rancher

如何在 Ubuntu 22.04 LTS 上安装 MyPaint

如何在 Ubuntu 22.04 LTS 上安装 Neovim

如何在 Ubuntu 22.04 上安装 最新版本Wine

VMware安装 Ubuntu Server 22.04

Ubuntu 22.04安装Cuda11.7和cudnn8.6