In this blog post, we will cover the steps to install and use snapd service on Fedora. Snappy is a package management and software deployment system from Canonical.

What is a snap?

snap :

  • is a squashFS filesystem containing your app code and a snap.yaml file containing specific metadata. It has a read-only file-system and, once installed, a writable area.
  • is self-contained. It bundles most of the libraries and runtimes it needs and can be updated and reverted without affecting the rest of the system.
  • is confined from the OS and other apps through security mechanisms, but can exchange content and functions with other snaps according to fine-grained policies controlled by the user and the OS defaults.
install snap centos 7

What is Snapd?

Snapd is a REST API daemon service that runs on your Linux system to manage snap packages (“snaps“). It interacts with the snap store and provides the command clientsnap used to interact with it. You must install snapd before you can start managing snaps on any Linux distribution.

Why use Snaps?

Snap packages any app for every Linux desktop, server, cloud or device. Snaps are faster to install, easier to create, safer to run, and they update automatically and transactionally so your app is always fresh and never broken. You can bring your own build infrastructure or use ours.

Install and Use Snapd on Fedora

Install Snapd on Fedora by executing the command below in your terminal.

sudo dnf -y install snapd fuse squashfuse kernel-modules

Wait for the installation to finish then confirm the version of snapd installed:

$ rpm -qi snapd
Name        : snapd
Version     : 2.63
Release     : 0.el8
Architecture: x86_64
Install Date: Wed 10 Jul 2024 05:54:00 PM UTC
Group       : Unspecified
Size        : 57445720
License     : GPLv3
....

Then enable snapd socket:

$ sudo systemctl enable --now snapd.socket
Created symlink from /etc/systemd/system/sockets.target.wants/snapd.socket to /usr/lib/systemd/system/snapd.socket.

Classic confinement requires snaps under /snap or symlink from /snap to /var/lib/snapd/snap. Create a symlink for it like below:

sudo ln -s /var/lib/snapd/snap /snap

Snapd is now ready for use. You interact with it using the snap command. See help page below:

$ snap --help
The snap command lets you install, configure, refresh and remove snaps.
Snaps are packages that work across many different Linux distributions,
enabling secure delivery and operation of the latest apps and utilities.

Usage: snap <command> [<options>...]

Commonly used commands can be classified as follows:

         Basics: find, info, install, remove, list
        ...more: refresh, revert, switch, disable, enable, create-cohort
        History: changes, tasks, abort, watch
        Daemons: services, start, stop, restart, logs
    Permissions: connections, interface, connect, disconnect
  Configuration: get, set, unset, wait
    App Aliases: alias, aliases, unalias, prefer
        Account: login, logout, whoami
      Snapshots: saved, save, check-snapshot, restore, forget
         Device: model, reboot, recovery
      ... Other: warnings, okay, known, ack, version
    Development: download, pack, run, try

For more information about a command, run 'snap help <command>'.
For a short summary of all commands, run 'snap help --all'.

Now reboot the system for the changes to take effect:

sudo reboot now

How to Install Snap Applications on Fedora

The snap command is used to interact with snaps available on Snap Store.

Searching for a snap:

To search for Snaps, use

$ snap find <search terms>

This will query the store and list the results with their version number, developer names, and the description.

I’ll do an example for installation of Powershell from Snap Store.

$ snap search powershell
Name                Version          Publisher              Notes    Summary
powershell          7.4.3            microsoft-powershell✓  classic  PowerShell for every system!
powershell-preview  7.5.0-preview.3  microsoft-powershell✓  classic  PowerShell for every system!
portal              1.2.3            zinokader              -        Quick and easy command-line file transfer utility from any computer to another.
v2rayx              0.4.5            shaonhuang             -        ✨✨V2ray GUI client with cross-platform desktop support powered by Electron⚛️, made especially for Linux / Windows / MacOS users.
ctfreak             1.15.0           jyp-software           -        IT task scheduler with concurrent and remote executions

Install snap by running:

$ sudo dnf install -y icu
$ sudo snap install powershell --classic
Automatically connect eligible plugs and slots of snap "snapd"                                                                                                                                       
powershell 7.4.3 from Microsoft PowerShell✓ installed

Wait for the download to finish, it should take short time to complete. Since the binary file is located under,/snap/bin/ we need to add this to the $PATHvariable.

sudo tee -a  /etc/profile<<EOF
export PATH="\$PATH:/snap/bin/"
EOF

Source the file to get new PATH

source /etc/profile

Test by starting the pwshsession.

$ pwsh 
PowerShell 7.4.3
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /home/jmutai>

To list installed snaps:

To list all installed snaps use the command:

$ snap list
Name        Version   Rev    Tracking       Publisher              Notes
core20      20240416  2318   latest/stable  canonical✓             base
powershell  7.4.3     269    latest/stable  microsoft-powershell✓  classic
snapd       2.63      21759  latest/stable  canonical✓             snapd

Manually update snaps by running snap refresh

Manually upgrade snap using refresh command:

$ sudo snap refresh powershell 
snap "powershell" has no updates available

Check snap info:

Use the command snap info to check for more info about a snap package.

 snap info powershell

Removing Snaps

To remove a snap, all you need to do is run.snap remove <snap name>  In our case just do:

$ snap remove powershell
powershell removed

Roll back to a previous version of an application

Use snap revert

 snap revert <snap_name>

Conclusion

By now you should be able to install snaps the store, manually update them, remove them, check installed snaps and much more. The snap command line is designed to be as simple and memorable as possible. It should become second nature to you after using it just a couple of times.

Another example which uses a snap for installation is Install Wekan Open source Kanban on CentOS 7 with Nginx and Letsencrypt SSL.

2 COMMENTS

  1. This install does not work on fedora 38: snap is installed but cannot work: if you want to install something via snap, the answer is:

    error: system does not fully support snapd: cannot mount squashfs image using “squashfs”:
    —– mount: /tmp/syscheck-mountpoint-1817200727: type de système de fichiers « squashfs »
    inconnu.

    • Hello @frpatte,
      You should reboot the system after installing and enabling snapd.socket. The guide has been updated to capture that!

LEAVE A REPLY

Please enter your comment!
Please enter your name here