Beginner’s Trick To Install Snap In Linux Distros

As we all know that Snaps now become a very common way to deliver cross-distribution package management system, and this article includes instructions to install and use snaps in different Linux distributions. So, if you use Linux variants like Ubuntu, Debian, Fedora, CentOS, RHEL, Arch Linux, Manjaro, etc on your machine, then installing Snap package manager offers an easy approach to install various applications or packages.

Introduction to Snap Packages

Snaps are widely known approach for Linux users that offers cross distribution, independent and easy way to install various applications along with all required dependencies. Technically, the Snap is built as a single component that can run over wide range of Linux variants on platforms like desktop, cloud, and loT as well. Also, it supports various distributions too.

Moreover, the Snaps are secure as well because they are well confined and snadboxed by its developers, so it’s really hard for criminals to compromise those packages. The developers use to select interface of every snap carefully on the basis of snap’s requirements, thus provide easy access to specific system resources like network access, desktop access and many more.

Means, with the help of snaps, you needn’t to worry about specific packages suitable for your Linux distributions such as DEB package for Debian/Ubuntu, RPM package for Fedora, and so on. You just need to install and enable Snap that works with all Linux variants with Snap support.

Also Read:   How To Install A Device Driver On Linux- 2 Methods

What are the advantages of snaps?

Easy to create and manage: Snaps are easier to create for its developers along with all its dependencies and libraries which are required to run, means the applications will use always the latest libraries and face no dependency issues.
Auto-Updates: Installed snaps are updated automatically on daily basis and reaches out to every user. By-default, the snapd daemon checks for updates 4 times a day, also the user can check for updates manually.
Single Build, Multiple Platforms: Means, just a single build is required to install and can be accessed on any platforms like desktop, server or cloud.
Availability to various releases: Means, a user can easily switch between any releases like Stable, Beta, and daily build, as all these releases are maintained for snap packages.
Secure: Snap packages are secured and can’t be compromised as they are under a sandbox environment and isolated from rest of the system.

Essential components of Snap Package Manager:

snapd: A background service that runs in background which manages and maintains snaps on a Linux computer.
Snap: A command line tool and the application package format used to install and remove snaps.
snapcraft: A framework and a useful command-line tool to build snaps.
snap store: A place where the snap developers share their snap packages and Linux users can easily search and install their preferred applications.

How to install and enable Snapd in Linux variants?

In order to use install snaps on a Linux distributions, the snapd daemon must be installed and enabled as it’s a background service that manages and maintains the snap environment. Unless this service is enabled, the users can’t use snap command to do installation, removal, and more other tasks. So, here we will discuss the approaches to install and enable Snapd in various Linux distributions.

Also Read:   Beginner’s Guide To Install Flatpak in Linux Distributions

Installing Snapd on Debian/Ubuntu

sudo apt update
sudo apt install snapd

Installing Snapd on Fedora

sudo dnf install snapd

Installing Snapd on RHEL/CentOS

sudo yum install epel-release
sudo yum install snapd

Installing Snapd on Arch based distributions

git clone https://aur.archlinux.org/snapd.git
cd snapd
makepkg -si

Installing Snapd on openSUSE

sudo zypper addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.2 snappy
sudo zypper --gpg-auto-import-keys refresh
sudo zypper dup --from snappy
sudo zypper install snapd

Installing Snapd on Manjaro Linux

sudo pacman -S snapd

After the installation of snapd is done on system, the systemd unit must be enabled as it manages the main snap communication socket. This can be done using systemctl command as here mentioned:

sudo systemctl enable --now snapd.socket
Important Note

For Ubuntu and its derived Linux distros, the package installer will automatically trigger above execution, means the users need to do nothing.

Check if snapd.socket is enabled

If the snapd.socket is not running, the users won’t be able to run snap command on their machine. And in order to verify this, run the following commands as here mentioned:

sudo systemctl is-active snapd.socket
sudo systemctl status snapd.socket
sudo systemctl is-enabled snapd.socket

Next is to create a symlink between /var/lib/snapd/snap and /snap if required by your Linux variant. You can do this by running:

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

Basic Snap Commands: Using snap with examples

After you have successfully installed snapd, you might like to learn how to use Snap basic commands to find, install, remove, update and do even more. So let’s discuss each of the tasks one by one.

Also Read:   How To Manage MySQL Database, Users and Tables From Command Line

Finding a snap

Before you install any snap on your machine, you might like to search if your preferred snap package is available on snap store.

sudo snap find <snap_name>

Also, you can search any snap based on its categories. Suppose you want to search available apps related to media server, run the following command:

sudo snap find <snap_category_name>

Checking information of a snap

sudo snap info <snap_name>

Installing snap packages

sudo snap install <snap_name>

Listing installed snaps

sudo snap list

Updating installed snap

Sudo snap refresh <snap_name>

Disabling/Enabling and removing snaps

sudo snap disable <snap_name>
sudo snap enable <snap_name>
sudo snap remove <snap_name>

Final Thoughts

Snap can be the best solution to Linux distribution users who want a single built that can easily aid to install and manage applications easily. Also, it helps the users to avoid issues like missing library as all packages that comes under snap are installed with all its dependencies and latest required libraries. And this article might helped you to install snap on Linux and using it through various basic commands. Do share this tutorial with your friends. If you have any question, you can click to Visit Our Discussion Board.

Nishant

Nishant Verma is a senior web developer who love to share his knowledge about Linux, SysAdmin, and more other web handlers. Currently, he loves to write as content contributor for ServoNode.