Share on Social Media

Learn how to easily install Snap on Linux 9 with step-by-step instructions. Get started with Snap packages for streamlined software management on your Linux system. #centlinux #linux #snapstore

What is Snap?

Snap is a software packaging and deployment system, developed by Canonical for operating systems that use the Linux kernel and the systemd init system. The packages, called snaps, and the tool for using them, snapd, work across a range of Linux distributions and allow upstream software developers to distribute their applications directly to users. Snaps are self-contained applications running in a sandbox with mediated access to the host system. Snap installation tool was originally released for cloud applications but was later ported to also work for Internet of Things devices and desktop applications.

Snaps are packaged with all their dependencies to run on all popular Linux distributions from a single build. They update automatically and roll back gracefully.

Snaps are discoverable and installable from the Snap Store, an app store with an audience of millions.

Features of Snap Installation Tool

Some of the most popular features of Snap software are:

  • Snap Store: The Snap Store allows developers to publish their snap-packaged applications. All apps uploaded to the Snap Store undergo automatic testing, including a malware scan.
  • Universal Linux Packages: Snaps are self-contained packages that work across a range of Linux distributions. This is unlike traditional Linux package management approaches, which require specifically adapted packages for each Linux distribution.
  • Configurable Sandbox: Applications in a Snap run in a container with limited access to the host system. Using Interfaces, users can give an application mediated access to additional features of the host such as recording audio, accessing USB devices and recording video. These interfaces mediate regular Linux APIs so that applications can function in the sandbox without needing to be rewritten. Desktop applications can also use the XDG Desktop Portals, a standardized API originally created by the Flatpak project to give sandboxed desktop applications access to host resources.
  • Automatic and Atomic Updates: Multiple times a day, snapd checks for available updates of all Snaps and installs them in the background using an atomic operation. Updates can be reverted and use delta encoding to reduce their download size.
  • Snapcraft: Snapcraft is a tool for developers to package their programs in the Snap format. It runs on any Linux distribution supported by Snap, macOS and Microsoft Windows. Snapcraft builds the packages in a Virtual Machine using Multipass, in order to ensure the result of a build is the same, regardless of which distribution or operating system it is built on. Snapcraft supports multiple build tools and programming languages, such as Go, Java, JavaScript, Python, C/C++ and Rust. It also allows importing application metadata from multiple sources such as AppStream, git, shell scripts and setup.py files.

Snap vs YUM

Snap and YUM are both package management systems used in Linux distributions, but they serve different purposes and have distinct features:

  1. Purpose:
  • Snap: Snap is a universal package management system developed by Canonical. It aims to provide a way to package and distribute software across different Linux distributions while ensuring security, reliability, and ease of use.
  • YUM: YUM (Yellowdog Updater, Modified) is a package manager primarily used in RPM-based Linux distributions such as CentOS, Fedora, and Red Hat Enterprise Linux. It is used to install, update, and remove packages on the system.
  1. Packaging Format:
  • Snap: Snap packages are self-contained and include all the dependencies needed to run the software. They are designed to work across different Linux distributions without compatibility issues.
  • YUM: YUM uses RPM (Red Hat Package Manager) packages, which are also used by other package managers like DNF (the successor of YUM in newer Fedora versions). RPM packages contain the files needed for installation but may require additional dependencies to be installed separately.
  1. Installation and Management:
  • Snap: Installing software using Snap is typically straightforward, as it involves a single command to install, update, or remove packages. Snap packages are installed in a sandboxed environment, which enhances security and isolates them from the rest of the system.
  • YUM: YUM requires users to run commands to install, update, or remove packages. It manages packages and their dependencies but does not provide sandboxing features like Snap.
  1. Distribution Support:
  • Snap: Snap is designed to work across different Linux distributions, including Ubuntu, Debian, Fedora, CentOS, and others. It aims to provide a consistent experience regardless of the underlying distribution.
  • YUM: YUM is primarily used in RPM-based distributions like CentOS, Fedora, and Red Hat Enterprise Linux. While it can be adapted for other distributions, its primary focus is on RPM-based systems.

In summary, Snap and YUM are both valuable tools for managing software packages on Linux systems, but they serve different purposes and excel in different areas. Snap offers cross-distribution compatibility, sandboxing, and ease of use, while YUM is tailored for RPM-based distributions with a focus on package management.

Environment Specification

We are using a virtual machine with minimal Rocky Linux 9 OS with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – Rocky Linux release 9.1 (Blue Onyx)
  • Hostname – rocky-01.centlinux.com
  • IP Address – 192.168.116.128/24

Prepare your Linux Server

By using a ssh tool, login as root user on your Rocky Linux server.

Execute dnf command to update software packages in your Linux OS.

# dnf update -y

Snap installation tool is available in EPEL (Extra Packages for Enterprise Linux) yum repository. Therefore, you should install it now by executing following command.

# dnf install -y epel-release

EPEL repository is dependent upon CRB (CodeReady Builder) yum repository. Therefore, you need to enable CRB before starting to install Snap on Linux.

# /usr/bin/crb enable
Enabling CRB repo
CRB repo is enabled and named: crb

Rebuild your cache for newly installed yum repositories.

# dnf makecache
Extra Packages for Enterprise Linux 9 - x86_64  515 kB/s |  15 MB     00:30
Rocky Linux 9 - BaseOS                          816  B/s | 4.1 kB     00:05
Rocky Linux 9 - AppStream                       857  B/s | 4.5 kB     00:05
Rocky Linux 9 - CRB                             372 kB/s | 2.1 MB     00:05
Rocky Linux 9 - Extras                          737  B/s | 2.9 kB     00:04
Metadata cache created.

All required yum repositories has been setup. Now, you can easily install snap installation tool.

Install Snap on Linux

To setup Snap installation tool on your Linux OS, you need to install snapd software package.

Search for snapd by using dnf command.

# dnf search snapd
Last metadata expiration check: 0:00:30 ago on Sat 13 May 2023 08:11:20 PM PKT.
========================= Name Exactly Matched: snapd ==========================
snapd.x86_64 : A transactional software package manager
======================== Name & Summary Matched: snapd =========================
snapd-devel.noarch : Development files for snapd
snapd-glib.x86_64 : Library providing a GLib interface to snapd
snapd-glib-devel.x86_64 : Development files for snapd-glib
snapd-glib-tests.x86_64 : Installed tests for snapd-glib
snapd-qt.x86_64 : Library providing a Qt5 interface to snapd
snapd-qt-devel.x86_64 : Development files for snapd-qt
snapd-qt-qml.x86_64 : Library providing a Qt5 QML interface to snapd
snapd-qt-tests.x86_64 : Installed tests for snapd-qt
snapd-selinux.noarch : SELinux module for snapd

Install snapd software package by executing following command.

# dnf install -y snapd

Enable and start snapd.socket by running following command at Linux terminal.

# systemctl enable --now snapd.socket
Created symlink /etc/systemd/system/sockets.target.wants/snapd.socket → /usr/lib/systemd/system/snapd.socket.

To enable classic snap support, enter the following to create a symbolic link between /var/lib/snapd/snap and /snap directories.

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

Snap environment variables are not set for your current session. Therefore, obtain a new Linux Bash shell by using su command.

# su -

Install Snap Store on Linux

To install Snap store on Linux, simply run the following command at Linux terminal.

# snap install snap-store
snap-store 41.3-71-g709398e from Canonical✓ installed

To get the list of installed snaps, you can execute following command.

# snap list
Name               Version           Rev    Tracking       Publisher        Notes
snap-store         41.3-71-g709398e  959    latest/stable  canonical✓       -

You can get more details about a snap as follows.

# snap info snap-store
name:    snap-store
summary: Snap Store is a graphical desktop application for discovering,
  installing and managing snaps on Linux.
publisher: Canonical✓
store-url: https://snapcraft.io/snap-store
contact:   https://bugs.launchpad.net/snap-store/
license:   unset
description: |
  Snap Store showcases featured and popular applications with useful
  descriptions, ratings, reviews and screenshots.


  Applications can be found either through browsing categories
  or by searching.


  Snap Store can also be used to switch channels, view and alter snap
  permissions and view and submit reviews and ratings.


  Snap Store is based on GNOME Software, optimized for the Snap experience.
commands:
  - snap-store
  - snap-store.ubuntu-software
  - snap-store.ubuntu-software-local-file
snap-id:      gjf3IPXoRiipCu9K0kVu52f0H56fIksg
tracking:     latest/stable
refresh-date: today at 22:26 PKT
channels:
  latest/stable:     41.3-71-g709398e 2023-04-28 (959) 12MB -
  latest/candidate:  41.3-71-g709398e 2023-04-27 (959) 12MB -
  latest/beta:       ↑
  latest/edge:       41.3-71-g709398e 2023-03-29 (959) 12MB -
  preview/stable:    –
  preview/candidate: 0.2.7-alpha      2023-02-02 (864) 10MB -
  preview/beta:      ↑
  preview/edge:      0.2.9-alpha      2023-05-09 (965) 10MB -
installed:           41.3-71-g709398e            (959) 12MB -

To update all installed snaps, you can execute following command at Linux terminal.

# snap refresh
All snaps up to date.

Video: How to install Snap on Linux 9

YouTube player

Final Thoughts

Mastering how to install Snap on Linux 9, opens the door to a vast array of software possibilities. With Snap’s streamlined package management, accessing and managing applications becomes a breeze. Whether you’re a developer or an everyday user, embracing Snap empowers you with a versatile toolset for your Linux experience. If you are new to Linux command-line, then we strongly recommend that you should attend online training: Linux command line for beginners

Leave a Reply

Your email address will not be published. Required fields are marked *