开始使用

Fedora Silverblue 的设计简单明了,一般不需要专业知识就可以上手。然而 Fedora Silverblue 的构建方式与其它操作系统不同,因此你可能需要先熟悉一下这个系统。

相比 Fedora Workstation 和其它基于软件包的发行版,Fedora Silverblue 有三种方式安装软件,包括:

  • Flatpak:这是在 Fedora Silverblue 安装图形化应用的主要方式。

  • Toolbox: Used primarily for CLI apps; development, debugging tools, etc., but also has support for graphical apps.

  • Package layering: Most Fedora packages can be installed on the system with the help of package layering. By default the system operates in pure image mode, but package layering is useful for things like libvirt, drivers, etc.

要想了解有关 Flatpak软件包层叠 有关的更多信息,请继续阅读。

要想了解 Toolbox,有 专门的页面 可供查阅。

Flatpak

Flatpak is the primary way that apps can be installed on Fedora Silverblue (for more information, see flatpak.org). Flatpak works out of the box in Fedora Silverblue, and Fedora provides a small (but growing) collection of apps that can be installed.

Flatpak 应用程序的另一主要来源是 Flathub ,Flathub 提供了大量的 Flatpak 应用程序供用户选用。

初始化 Flathub

To setup Flathub on Fedora Silverblue, open the Flathub setup page for Fedora and click the “Flathub repository file” button to download the Flathub configuration.

sfg flathub fedora
Figure 1. Fedora 快速设置页

此时会有弹窗供你指定下载选项,选择『打开,通过』一栏并使用『软件安装(默认)』,点击『确定』开始下载。

sfg flathub download
Figure 2. Flathub 下载选项

当下载完成后,新的窗口就会弹出供你查看与确认 Flathub 软件源的相关信息。要应用 Flatpak 软件源,点击『安装』按钮。

sfg flathub install
Figure 3. Flathub 安装向导

当软件源安装完成,『安装』按钮就会被『移除』按钮取代。

Alternatively, you can use the following command from the terminal:

$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

从 Flathub 安装 Flatpak 应用程序

Once the Flathub repository has been setup, it can be used to install Flatpak apps. This can be done directly from the GNOME Software application, or apps can be browsed on the Flathub website.

If you choose to install apps from the Flathub website, clicking "Install" will download a file which will be opened by the GNOME Software application, which can then be used to install the app. For example, to install LibreOffice, you first search for and open the LibreOffice page, and then press the “Install” button (2).

在点击 Install 按钮后,一个下载信息框就会弹出。只需确认文件名与你所要安装的应用程序相匹配就可以点击『确定』开始下载。

sfg libreoffice install
Figure 4. 下载 LibreOffice Flatpak

Once the Flatpak is downloaded, the GNOME Software application will open a new window with an “Install” button (2). Click this button to begin installation.

Alternatively, each application on flathub.org can be installed through the terminal by running the installation command at the bottom of the page that should look something like this:

$ flatpak install flathub <package-name>

As an example, Firefox can be installed by running the following command which can be found on Firefox’s flathub page:

$ flatpak install flathub org.mozilla.firefox

Flatpak 命令行工具

Additional details about the flatpak command line interface can be found in the official Flatpak documentation.

软件包层叠

软件包层叠通过修改你的 Fedora Silverblue 安装以实现。正如名字所示,它通过在 Fedora Silverblue 构建时拓展软件包而工作。

适合软件包层叠的一些好例子包括:

  • fish:一个备选的 UNIX Shell

  • sway:一个基于 Wayland 的平铺窗口管理器

  • libvirt:libvirt 守护进程

Fedora 提供的大部分(但不是所有的)RPM 都可以通过这个方法安装在 Fedora Silverblue 上。

Currently, using package layering creates a new "deployment", or bootable filesystem root. It does not affect your current root. This preserves rollback and the transactional model, but means that the system must be rebooted after a package has been layered or updated. You can alternatively use rpm-ostree install --apply-live <pkg> to also temporarily apply the change directly to your currently booted deployment. It’s generally expected that you use package layering sparingly, and use flatpak and dnf install inside a toolbox etc.

软件包层叠通常需要在命令行下完成。然而,GNOME 商店有时候确实会通过这种方式安装一些难以通过 Flatpak 的形式安装的应用程序。

安装软件包

在 Fedora Silverblue,我们使用下面的命令安装软件包:

$ rpm-ostree install <package name>

This will download the package and any required dependencies, and recompose your Fedora Silverblue image with them. rpm-ostree uses standard Fedora package names, which can be searched with rpm-ostree search since Fedora Silverblue 39, or using DNF inside a toolbox for previous versions.

当软件包通过这种方式安装之后,它就会随着 Silverblue 映像一起保持着最新状态。

替换软件包

在一些情形下,你可能希望测试新版的 podmankernel 或其它的一些软件包。 rpm-ostree override 命令允许你将一个软件包替换为其它版本。目前你可以手动下载软件包到本地,然后执行:

$ rpm-ostree override replace <path to package>

或者你也可以直接使用 koji 或 bodhi 的链接以进行软件包替换。例如:

$ rpm-ostree override replace https://kojipkgs.fedoraproject.org//packages/podman/3.1.2/1.fc34/x86_64/podman-3.1.2-1.fc34.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/podman/3.1.2/1.fc34/x86_64/podman-plugins-3.1.2-1.fc34.x86_64.rpm

你也可以使用 override remove 来隐藏一个软件包;它们仍在底层映像中,但他们不会在部署的系统中出现。

移除或替换层叠的软件包是不被推荐的。要了解更多信息,请查阅 rpm-ostree 文档

Adding packages from external repositories