如何使用 dnf 命令在 Fedora Linux 系统上安装 snapd
Snap 只不过是容器格式的 Linux 软件包。它们易于创建,并且易于在 Fedora Linux 上安装。我最喜欢的许多开源和闭源软件都以 snap 格式分发。与常规软件包 rpm 包相比,每个 snap 都捆绑了它们的依赖项。并在后台自动更新。它们易于更新。因此它们在 Fedora Linux 上开箱即用。因此建议使用 snap。让我们看看如何使用 dnf 命令在 Fedora Linux 上安装 snapd。
教程详细信息 | |
---|---|
难度等级 | 简单的 |
Root 权限 | 是的 |
要求 | Linux 终端 |
类别 | 包管理器 |
先决条件 | dnf 命令 |
操作系统兼容性 | Fedora • Linux |
预计阅读时间 | 6 分钟 |
在 Fedora Linux 上安装 snapd
流程如下:
- 打开终端应用程序
- 现在可以在 Fedora 上安装 snap,运行:sudo dnf install snapd
- 在 Fedora Linux 上启用经典 snap 支持:
sudo ln -s /var/lib/snapd/snap /snap - 通过运行以下命令测试您的安装:snap version
- 在 Fedora 上搜索 vlc snap:snap search vlc
- 最后测试你的 Fedora Linux,安装 vlc snap 并确保它正确运行::sudo snap install vlc
让我们详细地看一下所有的例子。
如何在 Fedora Linux 上安装 snapd
要安装 snapd 包,请输入以下 dnf 命令:
$ sudo dnf install snapd
使用 ln 命令设置符号链接
使用传统限制的 Snap(例如代码编辑器)也需要从 /var/lib/snapd/snap 到 /snap 的符号链接。输入以下 ln 命令:
$ sudo ln -s /var/lib/snapd/snap /snap
使用 ls 命令进行验证:
$ ls -l /snap
示例输出:
lrwxrwxrwx. 1 root root 19 May 23 01:36 /snap -> /var/lib/snapd/snap
确认并显示 snap 版本详情
$ snap version
示例输出:
snap 2.39.2-1.fc30 snapd 2.39.2-1.fc30 series 16 fedora 30 kernel 5.1.18-300.fc30.x86_64
如何使用 snap 命令来管理快照?
Snap Store 包含公共和私有 snap。让我们看一些 snap 命令安装、配置、刷新和删除 snap 包的示例。
查找要安装的包
我将搜索名为 vlc 的终极媒体播放器:
$ snap search vlc
示例输出:
Name Version Publisher Notes Summary vlc 3.0.7 videolan? - The ultimate media player dav1d 0.2.0-1-ge29cb9a videolan? - AV1 decoder from VideoLAN peerflix v0.39.0+git1.df28e20 pmagill - Streaming torrent client for Node.js mjpg-streamer 2.0 ogra - UVC webcam streaming tool audio-recorder 3.0.5+rev1432+pkg-7b07 brlin - A free audio-recorder for Linux (EXTREMELY BUGGY)
如何将名为 vlc 的 snap 安装到系统中
语法是:
$ sudo snap install package
$ sudo snap install vlc
如何运行名为 vlc 的 snap
每个 snap 可能包含多个相关命令,其中一个默认命令与 snap 本身同名。只需运行:
$ vlc
使用 snap 在 Linux 上运行 VLC
如何显示有关名为 vlc 的 snap 的详细信息
$ snap info {nameHere}
$ snap info vlc
示例输出:
name: vlc
summary: The ultimate media player
publisher: videolan
contact: https://www.videolan.org/support/
license: unknown
description: |
VLC is the VideoLAN project's media player.
Completely open source and privacy-friendly, it plays every multimedia file and streams.
It notably plays MKV, MP4, MPEG, MPEG-2, MPEG-4, DivX, MOV, WMV, QuickTime, WebM, FLAC, MP3,
Ogg/Vorbis files, BluRays, DVDs, VCDs, podcasts, and multimedia streams from various network sources.
It supports subtitles, closed captions and is translated in numerous languages.
commands:
- vlc
snap-id: RT9mcUhVsRYrDLG8qnvGiy26NKvv6Qkd
tracking: stable
refreshed: 2018-02-27T05:41:05Z
installed: 3.0.1-4-g14a4897 (190) 189MB -
channels:
stable: 3.0.1-4-g14a4897 (190) 189MB -
candidate: 3.0.2 (277) 192MB -
beta: 3.0.2-198-g5b749f7 (345) 198MB -
edge: 4.0.0-dev-3037-g2cb5965 (344) 197MB -
如何列出已安装的 snap 包
$ snap list
示例输出:
Name Version Rev Tracking Developer Notes core 16-2.32.8 4650 stable canonical core hello-world 6.3 27 stable canonical - vlc 3.0.1-4-g14a4897 190 stable videolan -
列出已启用的服务
$ snap services
示例输出:
Service Startup Current lxd.daemon enabled active
您可以使用以下命令停止或启动 lxd 服务 snap:
[vivek@fedora28-example ~]$ snap services
$ snap stop lxd
$ snap start lxd
有关 Snap 更新和频道的更多信息
从此页面
Snap 每天都会在后台自动更新至最新版本。您也可以手动使用 snap 刷新功能刷新所有已安装的 snap 或指定要刷新的特定 snap。如果开发人员已在多个发布渠道发布了 snap,您还可以通过刷新到另一个发布渠道切换到 snap 的另一个版本。有效的发布渠道包括稳定版、候选版、测试版、边缘版,它们的名称反映了它们所包含 snap 的开发状态。
以下是 snap 命令的完整列表:
$ snap help
示例输出:
Usage: snap [OPTIONS] <command> Install, configure, refresh and remove snap packages. Snaps are 'universal' packages that work across many different Linux systems, enabling secure distribution of the latest apps and utilities for cloud, servers, desktops and the internet of things. This is the CLI for snapd, a background service that takes care of snaps on the system. Start with 'snap list' to see installed snaps. Application Options: --version Print the version and exit Help Options: -h, --help Show this help message Available commands: abort Abort a pending change ack Adds an assertion to the system alias Sets up a manual alias aliases Lists aliases in the system buy Buys a snap changes List system changes connect Connects a plug to a slot disable Disables a snap in the system disconnect Disconnects a plug from a slot download Downloads the given snap enable Enables a snap in the system find Finds packages to install (aliases: search) get Prints configuration options help Help info Show detailed information about a snap install Installs a snap to the system interface Lists snap interfaces interfaces Lists interfaces in the system known Shows known assertions of the provided type list List installed snaps login Authenticates on snapd and the store logout Log out of the store logs Retrieve logs of services pack Pack the given target dir as a snap prefer Prefer aliases from a snap and disable conflicts refresh Refreshes a snap in the system remove Removes a snap from the system restart Restart services revert Reverts the given snap to the previous state run Run the given snap command services Query the status of services set Changes configuration options start Start services stop Stop services switch Switches snap to a different channel tasks List a change's tasks (aliases: change) try Tests a snap in the system unalias Unalias a manual alias or an entire snap version Shows version details watch Watch a change in progress whoami Prints the email the user is logged in with
要了解更多信息,请输入以下 man 命令来阅读手册页:
$ man snap
结论
就这样,你就在 Fedora Linux 系统上安装并配置了 snapd。请注意,不要从未知来源安装 snap。你最终可能会感染恶意软件或病毒。因此,我建议你使用此处所述的可信 snap 来源。