We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install Snapd and Snap applications on Fedora 37/36/35/34/33

Learn how to – Install Snapd and Snap applications on Fedora 37/36/35/34/33.

In this blog post, we will cover the steps to install and use snapd service on Fedora 37/36/35/34/33. 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.

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 37/36/35/34/33

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.57.6
Release     : 2.fc37
Architecture: x86_64
Install Date: Wed 25 Jan 2023 04:03:25 PM UTC
Group       : Unspecified
Size        : 53445939
License     : GPLv3
Signature   : RSA/SHA256, Fri 16 Dec 2022 08:47:40 AM UTC, Key ID f55ad3fb5323552a
Source RPM  : snapd-2.57.6-2.fc37.src.rpm
Build Date  : Fri 16 Dec 2022 08:36:51 AM UTC
Build Host  : buildvm-x86-06.iad2.fedoraproject.org
....

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'.

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.3.1       microsoft-powershell✓  classic  PowerShell for every system!
powershell-preview  7.3.0-rc.1  microsoft-powershell✓  classic  PowerShell for every system!
starship            1.6.3       matankushner           -        The minimal, blazing-fast, and infinitely customizable prompt for any shell!

Install snap by running:

$ sudo dnf install -y icu
$ sudo snap install powershell --classic
2023-01-25T16:26:31Z INFO Waiting for automatic snapd restart...
powershell 7.3.1 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 vim /etc/profile
export PATH="$PATH:/snap/bin/"

Source the file to get new PATH

source /etc/profile

Test by starting the pwshsession.

$ pwsh 
PowerShell 7.3.1
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      20221212  1778   latest/stable  canonical✓             base
powershell  7.3.1     226    latest/stable  microsoft-powershell✓  classic
snapd       2.58      17950  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
name:      powershell
summary:   PowerShell for every system!
publisher: Microsoft PowerShell✓
store-url: https://snapcraft.io/powershell
contact:   https://github.com/powershell/powershell
license:   unset
description: |
  PowerShell is an automation and configuration management platform.
  It consists of a cross-platform (Windows, Linux, and macOS)
  command-line shell and associated scripting language.

  See https://docs.microsoft.com/powershell/scripting/powershell-support-lifecycle for support
  details.
commands:
  - powershell
snap-id:      JSNnoJl3EqkMuWoy5Dgq8PMqZ0uNcpie
tracking:     latest/stable
refresh-date: today at 16:26 UTC
channels:
  latest/stable:    7.3.1 2022-12-13 (226) 74MB classic
  latest/candidate: 7.3.1 2022-12-13 (226) 74MB classic
  latest/beta:      7.3.1 2022-12-13 (226) 74MB classic
  latest/edge:      7.3.1 2022-12-13 (226) 74MB classic
  lts/stable:       7.2.8 2022-12-13 (227) 71MB classic
  lts/candidate:    7.2.8 2022-12-13 (227) 71MB classic
  lts/beta:         7.2.8 2022-12-13 (227) 71MB classic
  lts/edge:         7.2.8 2022-12-13 (227) 71MB classic
installed:          7.3.1            (226) 74MB classic

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.

6
136.595,15