Install and Use Snap Packages in all Linux Distributions

Snap is backed by Canonical, the same organization that developed the popular Debian-based Ubuntu Operating System.

The Canonical goal for the Snaps Packages is to create a standalone sandboxed application to package the application with the required dependencies and libraries.

This removes the use of outdated dependencies and libraries without affecting the operating system files making it easier for developers to develop an application and for users to use it.

Features

  • Remove the use of outdated dependencies and libraries.
  • Making it easier for developers to develop one application for all Linux distributions.
  • Users can easily install the latest version of an application without waiting for the update to come in the official repository.
  • Easily maintaining different versions of application releases such as stable releases, beta versions, and nightly builds simultaneously.
  • Snaps packages maintain the integrity and security of the application by isolating it within the sandbox.

How to Install Snap on all Linux Distributions

Before you start using any snap packages on your Linux system, first install snapd.

Snapd is a snap daemon required to run the snaps package for handling installation by downloading them from the snap store, updating, and running them.

Snapd also includes the snap command required to communicate with snapd.

Install Snapd on Debian-based Distributions (Ubuntu, Pop!_OS)

Debian-based distributions already included the snapd in the official repository making it available to install using the apt package manager.

$ sudo apt install snapd

After the installation is complete, it’s good to reboot your system to ensure that the snap’s path is updated correctly.

Install Snapd on Arch-based Distributions (Manjaro)

Arch-based distributions provide multiple ways to install the snapd in the system, first with the official repository by building and compiling the application. Another is using the AUR helper such as yay.

Method 1: Build and Compile

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

After the installation is complete, execute the below command to enable the snapd systemd unit use to manage the main snap communication socket.

$ sudo systemctl enable --now snapd.socket

Lastly, create a symbolic link for the snap command for global access.

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

Method 2: AUR helper (yay)

AUR helpers such as yay can quickly build and compile the snapd in your system without any interaction, as shown below.

$ yay -Sy snapd

Install Snapd on RHEL-based Distributions (Fedora)

RHEL-based distributions such as Fedora users can easily install it using the DNF package manager, as shown below.

$ sudo dnf install snapd

Test Snapd is Successfully Installed on your System

After installing snapd using any of the methods mentioned above, depending upon your Linux distribution, use the below command to download the sample hello-world snap program to check whether it is working.

$ sudo snap install hello-world
hello-world 6.4 from Canonical✓ installed
$ hello-world
Hello World!

How to use Snap to Search and Install Snap Packages from the Snap Store

After the installation of the snapd is complete, you can easily access the snap command using your terminal app. As mentioned earlier, snap applications hosted on the snap store can be easily managed using the snap command.

Find an Application on Snap Store

Many popular applications, such as Spotify, GIMP, LibreOffice, Thunderbird, etc., are available on the snap store. You can easily search for them using the snap command as shown below.

$ sudo snap find spotify

Install an Application using the snap command

Once the application is found, you can easily install it using the same snap command with the application name as shown below.

$ sudo snap install spotify

Update an Application using the snap command

In the future, if any update comes for the installed application using snap can be easily updated using the following command with the application name.

$ sudo snap refresh spotify

List all Installed Applications using the snap command

Once you find the advantage of using the snaps, you may bulk your system with many snap packages. Use the below command to list all the currently installed applications using the snap command.

$ snap list

Remove an Application using the snap command

Once you find the unnecessary snap application on your system, you can easily remove it from your system using the following command.

$ sudo snap remove spotify

Wrap Up

As you are now aware of the snap packages, don’t forget about the flatpak alternative to the snap package.

Leave a Reply