Comparar revisiones

在 GNU/Linux 中安装 Firefox

Revisión 275934:

Revisión 275934 por wxie2016 en

Revisión 282758:

Revisión 282758 por wxie2016 en

Palabras clave:

ubuntu opensuse debian
ubuntu opensuse debian

Resumen de los resultados de la búsqueda:

本文将向您展示如何将 Firefox 安装到 GNU/Linux 上。
本文将向您展示如何将 Firefox 安装到 GNU/Linux 上。

Contenido:

许多 GNU/Linux 发行版已经从其发行包管理器中预装了 Firefox,并将其配置为默认浏览器。本文介绍了在 GNU/Linux 上下载和安装 Firefox 的其他方法。 {for mac,win}{note}'''本文仅适用于 GNU/Linux。''' {for mac}在 Mac 上安装 Firefox,请参看 [[How to download and install Firefox on Mac]]。{/for}{for win}在 Windows 上安装 Firefox,请参看 [[Installing Firefox on Windows]]。{/for}{/note}{/for} __TOC__ = 从发行版提供的包安装 (推荐) = 要使用您的发行包管理器安装 Firefox,请参阅您的 GNU/Linux 发行版的文档。 推荐使用这种方法,因为它能确保火狐浏览器和所有必需的库都已安装,并为您的发行版进行了最佳配置。不过,新版 Firefox 正式发布与发行版更新其发行版本之间可能会有一点延迟。您的发行版也可能在不带 Firefox 商标的情况下发布新版本,或者只发布 ESR 版本。 =通过 Flatpak 安装= 要从 Flatpak 安装 Firefox,请 [https://flatpak.org/setup/ 安装并配置 FlatPak]。安装 Flatpak 之后,打开 [https://flathub.org/apps/details/org.mozilla.firefox Firefox Flathub 页面] 并点击 {button 安装} 按钮。也可以在终端输入下方的命令: ;<code>'''flatpak install flathub org.mozilla.firefox'''</code> 默认时,Flatpak 会安装和操作系统一致的语言。如果需要特定的语言,请参看 [[Use Firefox in another language|如何使用其他语言的 Firefox]]。 = 从 Snap 安装 = 如果从 Snap 安装 Firefox,请 [https://snapcraft.io/docs/installing-snapd 安装l Snap]。Snap安装完成后,打开 [https://snapcraft.io/firefox Firefox Snapcraft's Store 页面],点击 {button 安装} 按钮并按指导进行。您也可以在终端上输入以下命令: ;<code>'''sudo snap install firefox'''</code> Snap 会安装和操作系统一致的语言。需要特定的语言?请参看 [[Use Firefox in another language|如何使用其他语言的 Firefox]]。 =使用基于 Debian 发行版的 .deb 包安装 Firefox= 要通过 APT 库安装基于 <code>'''.deb'''</code> 包,请: #创建一个保存 APT 库密钥的目录: #;<code>'''sudo install -d -m 0755 /etc/apt/keyrings'''</code> #导入 Mozilla APT 密钥环: #;<code>'''wget -q https://packages.mozilla<!-- -->.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null'''</code> #;如果没有安装 <code>'''wget'''</code>,请通过命令 <code>'''sudo apt-get install wget'''</code> 安装。 <!-- Please check with the Release Engineering team (release@mozilla.com) before changing/removing'''bold text''' the following fingerprint --> #密钥指纹应该是 '''35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3'''。<!-- Please check with the Release Engineering team (release@mozilla.com) before changing/removing this fingerprint -->你可以用以下命令检查: #;<code>'''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"}''''</code> #把 Mozilla APT 库添加到源列表中: #;<code>'''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'''</code> #配置 APT 优先使用 Mozilla 库中的包: #;<code>'''echo ''''</code> #;<code>'''Package: *'''</code> #;<code>'''Pin: origin packages.mozilla<!-- -->.org'''</code> #;<code>'''Pin-Priority: 1000'''</code> #;<code>'''' | sudo tee /etc/apt/preferences.d/mozilla'''</code> #更新软件列表并安装 Firefox .deb 包: ;<code>'''sudo apt-get update && sudo apt-get install firefox'''</code> ==使用 .deb 包设置 Firefox 语言== 需要在不是英语的环境下使用 Firefox 的用户,请使用 <code>'''.deb'''</code> 包里带有的 Firefox 语言包。使用以下命令安装其他语言包,注意把其中的 fr 换成目标语言代码: ;<code>'''sudo apt-get install firefox-l10n-fr'''</code> 安装 Mozilla APT 库之后,可以使用 <code>sudo apt-get update</code>: ;<code>'''apt-cache search firefox-l10n'''</code> 列出所有语言。 ==数据迁移== 如果以前使用的是 Snap 或 Flatpak,你需要导入配置。你可以使用以下两种方法之一来操作: *'''方法1:'''设置同步,参考 [[How do I set up Sync on my computer?|同步设置]]。 *'''方法2:'''在电脑上复制配置文件。复制前请退出所有的 Firefix 应用: *Flatpak: **Flatpak:<br><code>'''mkdir -p ~/.mozilla/firefox/ && cp -a ~/.var/app/org.mozilla.firefox/.mozilla/firefox/* ~/.mozilla/firefox/'''</code> **Snap:<br><code>'''mkdir -p ~/.mozilla/firefox/ && cp -a ~/snap/firefox/common/.mozilla/firefox/* ~/.mozilla/firefox/'''</code> 不论使用哪种方法,复制完成之后,请从终端打开 Firefox: '''<code>firefox -P</code>''',选择目标配置。此后,你就不必再用 '''<code>-P</code>''' 参数打开 Firefox 了。 = 从 Mozilla 安装 Firefox = 在您安装 Firefox 之前,确保您的计算机安装了'''[http://www.mozilla.com/firefox/system-requirements.html#gnulinux 需要的库]'''。缺失库文件会导致 Firefox 无法运行。 == 系统安装 Firefox(高级用户)== {note} 要用此安装方法,你 '''必须''' 要能够作为 root 登录或运行 <code>'''sudo'''</code> 命令。 这样安装的 Firefox 版本比包管理系统优先级高。要运行包管理安装的版本,你要在终端里运行: <br><code>'''/usr/bin/firefox'''</code> {/note} <!-- Auto-list doesn't work with a newline character in front of a <code> block. This means we need to manually set the list number --> #从 [https://www.mozilla.org/firefox/linux/?utm_medium=referral&utm_source=support.mozilla.org Firefox 下载页面] 并点击 {button 立即下载} 按钮。 #打开一个'''终端''',转到下载 Firefox 的目录,比如 #;<code>'''cd ~/Downloads'''</code> #;将下载文件的内容解压缩: #;<code>'''tar xjf firefox-*.tar.bz2'''</code> #;<br>''以下命令必须以 root 身份执行,或以 <code>'''sudo'''</code> 开头。'' #将解压的 Firefox 目录移到 {filepath /opt}: #;<code>'''mv firefox /opt'''</code> #创建一个指向 Firefox 可执行文件的 symlink: #;<code>'''ln -s /opt/firefox/firefox /usr/local/bin/firefox'''</code> #下载一个 desktop 文件: #; <code>'''wget https://raw.githubusercontent<!-- -->.com/mozilla/sumo-kb/main/install-firefox-linux/firefox.desktop -P /usr/local/share/applications'''</code> 如果,没有安装 <code>'''wget'''</code>,那么你可以右击以上链接,打开弹出菜单并选择 {menu 另存为}。下载好文件之后,把它放到 {filepath /usr/local/share/applications}。 你可以打开 [[Use the Troubleshooting Information page to help fix Firefox issues|排障信息]] 页面来验证安装是否成功。在 ''应用基础'' 部分,''Application Binary'' 应该是 <code>'''/opt/firefox/firefox-bin'''</code>。 == 从用户账号安装本地 Firefox == {note}如果你没有 root 或者没有执行 <code>'''sudo'''</code> 的权限,或者你只是要在自己的本地账号使用 Firefox,那么你可以使用此方法。这个方法也适用于安装多个不同的 Firefox 版本。{/note} # 打开 [https://www.mozilla.org/firefox/linux/?utm_medium=referral&utm_source=support.mozilla.org Firefox 下载页面] 并点击 {button 立即下载} 按钮。 #* 你也可以在 '''下载其他平台或语言版''' 链接处选择其他版本:Nightly、Beta、Developer、ESR # 打开终端,找到下载路径。比如 #; <code>'''cd ~/Downloads'''</code> # 解压下载文件,此时它会创建一个名为 {filepath firefox} 的文件夹。此后,你可以删除下载文件: #; <code>'''tar xjf firefox-*.tar.bz2<br>rm firefox-*.tar.bz2'''</code> # 如果你下载的是其他版本,路径名字可以被改动。比如 #; <code>'''mv firefox firefox-nightly'''</code> # 解压好的文件夹可以不动,也可以移动到你的账号下。比如 #; <code>'''mv firefox ~/firefox'''</code> # 现在 Firefox 已经可以使用了。你只需在终端里输入: #; <code>'''~/firefox/firefox &'''</code> # 创建一个桌面快捷方式。(不同的发行版方法不同。) #* 在桌面上空白处右击鼠标,在弹出菜单里选择 '''创建启动命令'''。 #* 你也可以在终端里输入: #*; <code>'''ln -s ~/firefox/firefox ~/Desktop/'''</code> #* Firefox 的桌面快捷方式图标放在 <code>'''~/firefox/browser/chrome/icons/default/'''</code> {note}'''注意:'''此方法不会改变系统文件的属性,所以其他应用里的链接不会在此本地安装的 Firefox 里自动打开。你需要把要打开的链接复制粘贴到此 Firefox 的地址栏。{/note}
许多 GNU/Linux 发行版已经从其发行包管理器中预装了 Firefox,并将其配置为默认浏览器。本文介绍了在 GNU/Linux 上下载和安装 Firefox 的其他方法。 {for mac,win}{note}'''本文仅适用于 GNU/Linux。''' {for mac}在 Mac 上安装 Firefox,请参看 [[How to download and install Firefox on Mac]]。{/for}{for win}在 Windows 上安装 Firefox,请参看 [[Installing Firefox on Windows]]。{/for}{/note}{/for} __TOC__ = 从发行版提供的包安装 (推荐) = 要使用您的发行包管理器安装 Firefox,请参阅您的 GNU/Linux 发行版的文档。 推荐使用这种方法,因为它能确保火狐浏览器和所有必需的库都已安装,并为您的发行版进行了最佳配置。不过,新版 Firefox 正式发布与发行版更新其发行版本之间可能会有一点延迟。您的发行版也可能在不带 Firefox 商标的情况下发布新版本,或者只发布 ESR 版本。 =通过 Flatpak 安装= 要从 Flatpak 安装 Firefox,请 [https://flatpak.org/setup/ 安装并配置 FlatPak]。安装 Flatpak 之后,打开 [https://flathub.org/apps/details/org.mozilla.firefox Firefox Flathub 页面] 并点击 {button 安装} 按钮。也可以在终端输入下方的命令: ;<code>'''flatpak install flathub org.mozilla.firefox'''</code> 默认时,Flatpak 会安装和操作系统一致的语言。如果需要特定的语言,请参看 [[Use Firefox in another language|如何使用其他语言的 Firefox]]。 = 从 Snap 安装 = 如果从 Snap 安装 Firefox,请 [https://snapcraft.io/docs/installing-snapd 安装l Snap]。Snap安装完成后,打开 [https://snapcraft.io/firefox Firefox Snapcraft's Store 页面],点击 {button 安装} 按钮并按指导进行。您也可以在终端上输入以下命令: ;<code>'''sudo snap install firefox'''</code> Snap 会安装和操作系统一致的语言。需要特定的语言?请参看 [[Use Firefox in another language|如何使用其他语言的 Firefox]]。 =使用基于 Debian 发行版的 .deb 包安装 Firefox= 要通过 APT 库安装基于 <code>'''.deb'''</code> 包,请: #创建一个保存 APT 库密钥的目录: #;<code>'''sudo install -d -m 0755 /etc/apt/keyrings'''</code> #导入 Mozilla APT 密钥环: #;<code>'''wget -q https://packages.mozilla<!-- -->.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null'''</code> #;如果没有安装 <code>'''wget'''</code>,请通过命令 <code>'''sudo apt-get install wget'''</code> 安装。 <!-- Please check with the Release Engineering team (release@mozilla.com) before changing/removing'''bold text''' the following fingerprint --> #密钥指纹应该是 '''35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3'''。<!-- Please check with the Release Engineering team (release@mozilla.com) before changing/removing this fingerprint -->你可以用以下命令检查: #;<code>'''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"}''''</code> #把 Mozilla APT 库添加到源列表中: #;<code>'''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'''</code> #配置 APT 优先使用 Mozilla 库中的包: #;<code>'''echo ''''</code> #;<code>'''Package: *'''</code> #;<code>'''Pin: origin packages.mozilla<!-- -->.org'''</code> #;<code>'''Pin-Priority: 1000'''</code> #;<code>'''' | sudo tee /etc/apt/preferences.d/mozilla'''</code> #更新软件列表并安装 Firefox .deb 包: ;<code>'''sudo apt-get update && sudo apt-get install firefox'''</code> ==使用 .deb 包设置 Firefox 语言== 需要在不是英语的环境下使用 Firefox 的用户,请使用 <code>'''.deb'''</code> 包里带有的 Firefox 语言包。使用以下命令安装其他语言包,注意把其中的 fr 换成目标语言代码: ;<code>'''sudo apt-get install firefox-l10n-fr'''</code> 安装 Mozilla APT 库之后,可以使用 <code>sudo apt-get update</code>: ;<code>'''apt-cache search firefox-l10n'''</code> 列出所有语言。 ==数据迁移== 如果以前使用的是 Snap 或 Flatpak,你需要导入配置。你可以使用以下两种方法之一来操作: *'''方法1:'''设置同步,参考 [[How do I set up Sync on my computer?|同步设置]]。 *'''方法2:'''在电脑上复制配置文件。复制前请退出所有的 Firefix 应用: *Flatpak: **Flatpak:<br><code>'''mkdir -p ~/.mozilla/firefox/ && cp -a ~/.var/app/org.mozilla.firefox/.mozilla/firefox/* ~/.mozilla/firefox/'''</code> **Snap:<br><code>'''mkdir -p ~/.mozilla/firefox/ && cp -a ~/snap/firefox/common/.mozilla/firefox/* ~/.mozilla/firefox/'''</code> 不论使用哪种方法,复制完成之后,请从终端打开 Firefox: '''<code>firefox -P</code>''',选择目标配置。此后,你就不必再用 '''<code>-P</code>''' 参数打开 Firefox 了。 = 从 Mozilla 安装 Firefox = 在您安装 Firefox 之前,确保您的计算机安装了'''[http://www.mozilla.com/firefox/system-requirements.html#gnulinux 需要的库]'''。缺失库文件会导致 Firefox 无法运行。 == 系统安装 Firefox(高级用户)== {note} 要用此安装方法,你 '''必须''' 要能够作为 root 登录或运行 <code>'''sudo'''</code> 命令。 这样安装的 Firefox 版本比包管理系统优先级高。要运行包管理安装的版本,你要在终端里运行: <br><code>'''/usr/bin/firefox'''</code> {/note} <!-- Auto-list doesn't work with a newline character in front of a <code> block. This means we need to manually set the list number --> #从 [https://www.mozilla.org/firefox/linux/?utm_medium=referral&utm_source=support.mozilla.org Firefox 下载页面] 并点击 {button 立即下载} 按钮。 #打开一个'''终端''',转到下载 Firefox 的目录,比如 #;<code>'''cd ~/Downloads'''</code> #;将下载文件的内容解压缩: #;<code>'''tar xjf firefox-*.tar.bz2'''</code> #;<br>''以下命令必须以 root 身份执行,或以 <code>'''sudo'''</code> 开头。'' #将解压的 Firefox 目录移到 {filepath /opt}: #;<code>'''mv firefox /opt'''</code> #创建一个指向 Firefox 可执行文件的 symlink: #;<code>'''ln -s /opt/firefox/firefox /usr/local/bin/firefox'''</code> #下载一个 desktop 文件: #; <code>'''wget https://raw.githubusercontent<!-- -->.com/mozilla/sumo-kb/main/install-firefox-linux/firefox.desktop -P /usr/local/share/applications'''</code> 如果,没有安装 <code>'''wget'''</code>,那么你可以右击以上链接,打开弹出菜单并选择 {menu 另存为}。下载好文件之后,把它放到 {filepath /usr/local/share/applications}。 你可以打开 [[Use the Troubleshooting Information page to help fix Firefox issues|排障信息]] 页面来验证安装是否成功。在 ''应用基础'' 部分,''Application Binary'' 应该是 <code>'''/opt/firefox/firefox-bin'''</code>。 == 从用户账号安装本地 Firefox == {note}如果你没有 root 或者没有执行 <code>'''sudo'''</code> 的权限,或者你只是要在自己的本地账号使用 Firefox,那么你可以使用此方法。这个方法也适用于安装多个不同的 Firefox 版本。{/note} # 打开 [https://www.mozilla.org/firefox/linux/?utm_medium=referral&utm_source=support.mozilla.org Firefox 下载页面] 并点击 {button 立即下载} 按钮。 #* 你也可以在 '''下载其他平台或语言版''' 链接处选择其他版本:Nightly、Beta、Developer、ESR # 打开终端,找到下载路径。比如 #; <code>'''cd ~/Downloads'''</code> # 解压下载文件,此时它会创建一个名为 {filepath firefox} 的文件夹。此后,你可以删除下载文件: #; <code>'''tar xjf firefox-*.tar.bz2<br>rm firefox-*.tar.bz2'''</code> # 如果你下载的是其他版本,路径名字可以被改动。比如 #; <code>'''mv firefox firefox-nightly'''</code> # 解压好的文件夹可以不动,也可以移动到你的账号下。比如 #; <code>'''mv firefox ~/firefox'''</code> # 现在 Firefox 已经可以使用了。你只需在终端里输入: #; <code>'''~/firefox/firefox &'''</code> # 创建一个桌面快捷方式。(不同的发行版方法不同。) #* 在桌面上空白处右击鼠标,在弹出菜单里选择 '''创建启动命令'''。 #* 你也可以在终端里输入: #*; <code>'''ln -s ~/firefox/firefox ~/Desktop/'''</code> #* Firefox 的桌面快捷方式图标放在 <code>'''~/firefox/browser/chrome/icons/default/'''</code> {note}'''注意:'''此方法不会改变系统文件的属性,所以其他应用里的链接不会在此本地安装的 Firefox 里自动打开。你需要把要打开的链接复制粘贴到此 Firefox 的地址栏。{/note} =安全功能警告= 你可能会看到类似“Firefox 的某些安全特性并不能给当前系统提供足够安全保护”的警告。 Firefox 的沙盒在创建新进程时为了更安全使用了没有更高权限的用户名域。这一作法有时被看成时安全风险,所以某些 GNU/Linux 发行版作出限制,只允许有 AppArmor 配置的程序这样做。 其实这种配置只能覆盖有限的安装路径,比如 Snap 和 Debian 安装包,不能覆盖 tarball 安装和本地安装等场景。 为 Firefox 创建一个 AppArmor 配置文件: 在目录 <code>'''/etc/apparmor.d/'''</code> 下,创建一个名为 <code>'''firefox-local'''</code> 的文件。 在此文件中,写入以下内容: <code>'''# This profile allows everything and only exists to give the'''</code> <code>'''# application a name instead of having the label "unconfined"'''</code> <code>'''abi <abi/4.0>,'''</code> <code>'''include <tunables/global>'''</code> <code>'''profile firefox-local'''</code> <code>'''/home/<USER>/bin/firefox/{firefox,firefox-bin,updater}'''</code> <code>'''flags=(unconfined) {'''</code> :<code>'''userns,'''</code> :<code>'''# Site-specific additions and overrides. See local/README for details.'''</code> :<code>'''include if exists <local/firefox>'''</code> <code>'''}'''</code> 请将其中的 <code>'''<USER>'''</code> 替换为你的 GNU/Linux 用户名。 上面假定 Firefox 安装在 <code>'''$HOME/bin/'''</code> 保存该文件之后,请运行 <code>'''sudo systemctl restart apparmor.service'''</code> 命令。

Volver al historial