如何使用dnf命令在Fedora Linux系统上安装snap

时间:2020-01-09 10:41:00  来源:igfitidea点击:

如何在Fedora Linux上安装snapd以运行和管理snap?
快照不过是容器格式的Linux软件包。
它们易于创建并且易于在Fedora Linux上安装。
我最喜欢的许多开放源码和封闭源软件都以快照格式分发。
与常规软件包rpm软件包相比,每个快照都捆绑了它们的依赖项。
并在后台自动更新。
它们很容易更新。
因此,它们在Fedora Linux上开箱即用。
因此,建议使用快照。
让我们看看如何使用dnf命令在Fedora Linux上安装snapd。

在Fedora上安装快照

  • 打开终端应用程序
  • 现在,可以在Fedora上安装snap,运行:sudo dnf install snapd
  • 在Fedora Linux上启用经典快照支持:sudo ln -s/var/lib/snapd/snap/snap /
  • 通过运行以下命令来测试安装:snap version
  • 在Fedora上搜索vlc快照:snap search vlc
  • 最后测试您的Fedora Linux,安装vlc snap并确保其正确运行::sudo snap install vlc

让我们详细查看所有示例。

如何在Fedora Linux上安装snapd

要安装捕捉的软件包,请输入以下dnf命令:

sudo dnf install snapd

使用ln命令设置符号链接

使用经典限制(例如代码编辑器)的快照也需要从/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 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软件包的snap命令的conman示例。

查找要安装的软件包

我将搜索名为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的快照安装到系统

语法为:

sudo snap install package
sudo snap install vlc

如何运行名为VLC的快照

每个快照可能包括多个相关命令,并且默认命令的名称与快照本身相同。
赶紧运行:

vlc

使用snap在Linux上运行的VLC

如何显示有关称为vlc的快照的详细信息

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: 2016-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 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 stop lxd
snap start lxd

有关快照更新的更多信息

快照每天都会在后台自动更新为最新版本。
也可以使用快照刷新来手动安装所有已安装的快照,也可以通过指定要刷新的特定快照来手动完成此操作。
如果开发人员已在多个渠道发布快照,则还可以通过刷新到另一个发行渠道来切换到快照的另一个版本。
有效的发布渠道是稳定的,候选版本,beta版本,边缘版本,其名称反映了其中包含的快照的开发状态。

这是快照命令的完整列表:

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