How to install snapd on Fedora Linux system using dnf command

Posted on in Categories , last updated May 22, 2018

How do I install snapd on Fedora Linux to run and manage snaps?

Snaps are nothing but Linux software packages in containers format. They are simple to create and easy to install on Fedora Linux. Many of my favorite open source and closed source software distributed in snaps format. As compared to regular package rpm packages, each snap bundles their dependencies. And automatically updated in the background. They are easy to update. So they work out of the box on Fedora Linux. Therefore using snaps are recommended. Let us see how to install snapd on Fedora Linux using the dnf command.

How to install snapd on Fedora Linux

To install the snapd package type the following dnf command:
sudo dnf install snapd
How to install snapd on Fedora Linux system using dnf command

Setup a symlink using the ln command

Snaps using classic confinement, such as code editors, also require a symlink from /var/lib/snapd/snap to /snap. Type the following ln command:
$ sudo ln -s /var/lib/snapd/snap /snap
Verify it with the ls command:
ls -l /snap
Sample outputs:

lrwxrwxrwx. 1 root root 19 May 23 01:36 /snap -> /var/lib/snapd/snap

Confirm and shows snap version details

snap version
Sample outputs:

snap    2.32.4-1.fc28
snapd   2.32.4-1.fc28
series  16
fedora  28
kernel  4.16.8-300.fc28.x86_64

How do I use the snap command to manage snaps?

The Snap Store contains both public and private snaps. Let us see some conman examples of snap command to install, configure, refresh and remove snap packages.

Finds packages to install

I am going to search the ultimate media player called vlc:
snap search vlc
Sample outputs:

Name                        Version           Developer  Notes  Summary
vlc                         3.0.1-4-g14a4897  videolan   -      The ultimate media player
mjpg-streamer               2.0               ogra       -      UVC webcam streaming tool
simplescreenrecorder-mardy  0.3.8-3           mardy      -      Simple Screen Recorder

How to install a snap named vlc to the system

The syntax is:
sudo snap install package
sudo snap install vlc

install vlc on fedora using snap

How to run snap named vlc

Each snap might include multiple related commands, with a default command that has the same name as the snap itself. Just run:
vlc

VLC running on Linux using snap
VLC running on Linux using snap

How to show detailed information about a snap called vlc

snap info {nameHere}
snap info vlc

Sample outputs:

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 -

How to list installed snaps

snap list
Sample outputs:

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   -

List enabled services

snap services
Sample outputs:

Service     Startup  Current
lxd.daemon  enabled  active

You can stop or start lxd service snap using the following command:
snap stop lxd
snap start lxd

[vivek@fedora28-nixcraft ~]$ snap services

More info about snap updates and channels

From this page

Snaps are updated automatically in the background to the latest version, every day. This can also be done manually using snap refresh for either all installed snaps or by specifying a particular snap to refresh. You can also switch to another version of a snap by refreshing into another release channel, if the developer has published the snap in multiple channels. Valid release channels are stable, candidate, beta, edge and their name reflects the development status of snaps they contain.

Here is a complete list of snap commands:
snap help
Sample outputs:

 
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

For more info read the man page by typing the following man command:
man snap

Conclusion

And there you have it. snapd installed and configured on a Fedora Linux system. Please note that do not install snap from unknown sources. You might end up getting malware or viruses. Hence I recommend that you use the trusted source of snap.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Share this on (or read 1 comments/add one below):

Join the discussion at www.nixcraft.com