Snap on Linux- Installation, update and delete commands

What is a snap? Snap has been introduced as a package management method by Canonical developers, the people behind the popular Ubuntu Linux systems.  We can install and use the SNAP on various types of Linux distros such as Redhat, Ubuntu, CentOS, Elementary, Debian, Linux Mint, Manjaro, and more…

It is similar to a container with all the files and libraries of an application, and each application is completely independent. So the advantage of using the snap package is that it solves the dependency problem between applications, making it easier to manage between applications. Thus, we can install any Lincu software or packages available in the SNAP repository on any supported Linux distro regardless of its origin, I mean it doesn’t matter what it is. RPM-based or.Deb.

It is based on the squashFS File system file but the problem is that it takes up more disk space.

Snap’s installation package extension is .snap, similar to a container, it contains all the files and libraries needed by an application (snap package contains a private root file system, which contains dependent packages).

They will be installed into separate directories; each application is isolated from the other. There are many advantages to using a snap. First, it solves the problem of package dependencies; second, it also makes the application easier to manage.

It is completely independent of the system. The package, contains all the required libraries and runtime (such as python or Java, etc.), and it can be updated via the internet. The official page that has a list of all available packages and the way to install the same is Snapcraft.com.

Snaps universal package manager for Linux

So, first, let’s see the installation of it on some popular Linux operating systems.  

Install & Enable SNAP on Redhat

If you are running RedHat and want to install different software available for SNAP, here is the command to enable SNAPD first.

Add EPL repository:
————————–

#For RHEL 9

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

#For RHEL 8

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

#For RHEL 7

sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Enable optional and extra repos

sudo subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"

Run update command:

sudo yum update

Install Snapd

sudo yum install snapd

Enable it:

sudo systemctl enable --now snapd.socket

To get classic support of it you use this command:

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

Snap installation & Enabling steps for CentOS

CentOS is RHEL-based open-source Linux, therefore the command to enable snapd on it will also be the same:

sudo dnfinstall epel-release
sudo dnf update

sudo dnf install snapd
sudo systemctl enable --now snapd.socket

Install and enable Snap on Manjaro Linux

Well, the default package manager of the Manjaro Linux is Pacman, thus the only thing which will change in the command is only that. Instead of using yum or DNF, here use Pacman.

sudo pacman -S snapd
sudo pacman -Syy
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

For Fedora:

sudo dnf install snapd

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

Enable Snap on Ubuntu, KDE Neon, Kubuntu, Linux Mint, Elementary

Although the latest version of Ubuntu and Linux Mint along with others based on them don’t need to install because of the box availability of this package management tool, however, those who don’t have, run the below command:

sudo apt update
sudo apt install snapd

Only for Linux Mint:

sudo mv /etc/apt/preferences.d/nosnap.pref ~/Documents/nosnap.backup
sudo apt update
sudo apt install snapd

 


Instal snaps on Arch Linux

git clone https://aur.archlinux.org/snapd.git
cd snapd
makepkg -si
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

Those who are using OpenSUSE Tumbleweed & Leap can use these commands to get it

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

See: Quick Steps to Install Docker-CE on OpenSUSE Linux


Some commonly used SNAP Linux commands

In fact, using the snap package is very simple, let me introduce some commonly used commands:

  • List the installed snap packages:
sudo snap list<
  • Search for the snap package to be installed
sudo snap find <text to search>
  • Install a snap package
sudo snap install <snap name>
  • Update a snap package, if you do not add the name of the package later, it is to update all snap packages
sudo snap refresh <snap name>
  • Restore a package to the previously installed version
sudo snap revert <snap name>
  • Delete a snap package
sudo snap remove <snap name>
  • Query recent operations
 snap changes
  • For more information about snap, check the man manual:
 man snap

So, this was a quick guide on this universal package manager for Linux. You can explore the Snapcraft official page using the link given at the beginning of this article where you will find all available software to download and install using this tool along with their single-line command.

Other Articles:

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.