Table of Contents
In this article, I will take you through the steps to install and use Snapd on RHEL/CentOS 7/8 Using 10 Easy Steps. Snapd is a daemon which manages the snap environment on a Local System. Snaps are applications packaged with all their dependencies to run on almost all the famous Linux environments like RHEL, CentOS, Ubuntu, Debian etc. Snaps are installed from Snap store, an app store with an audience of millions. In RHEL/CentOS based Systems, it is available from 7.6+ versions. The installation of snapd will include the snap tool for interacting with apps. We will see the steps to install and use snapd on RHEL/CentOS based systems in great detail. More about snapd.
How to Install and Use Snapd on RHEL/CentOS 7/8 Using 10 Easy Steps
Also Read: How to Install and Use Ddosify High Performance Testing Tool in Linux
Step 1: Prerequisites
a) You should have a running RHEL/CentOS 7/8
Server.
b) You should have sudo
or root
access to run privileged commands.
c) You should have yum
or dnf
utility available in your Server.
Step 2: Update Your Server
Before installing a new package, it is always a good idea to check for any latest available updates by using yum update
or dnf update
command. In our case, as you can see below system is already synced with the latest updates so it does not find any new packages that needs to be updated. This might not be same for you.
NOTE:
root
user to run all the below commands. You can use any user with sudo
access to run all these commands. For more information, Please check Step by Step: How to Add User to Sudoers to provide sudo
access to the User.[root@cyberithub ~]# yum update Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos-hcm.viettelidc.com.vn * epel: download.nus.edu.sg * extras: centos-hcm.viettelidc.com.vn * updates: centos-hcm.viettelidc.com.vn No packages marked for update
Step 3: Install EPEL Release
Since snapd package is only available through EPEL so we need to first install the EPEL Release package by using yum install epel-release
command as shown below.
[root@cyberithub ~]# yum install epel-release Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos-hcm.viettelidc.com.vn * extras: centos-hcm.viettelidc.com.vn * updates: centos-hcm.viettelidc.com.vn Resolving Dependencies --> Running transaction check ---> Package epel-release.noarch 0:7-11 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================= Installing: epel-release noarch 7-11 extras 15 k Transaction Summary ============================================================================================================================================================= Install 1 Package Total download size: 15 k Installed size: 24 k Is this ok [y/d/N]: Y Downloading packages: epel-release-7-11.noarch.rpm | 15 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : epel-release-7-11.noarch 1/1 Verifying : epel-release-7-11.noarch 1/1 Installed: epel-release.noarch 0:7-11 Complete!
Step 4: Install Snapd
Next step is to install snapd package by using yum install snapd
command as shown below. This will install the package along with all its dependencies.
[root@cyberithub ~]# yum install snapd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos-hcm.viettelidc.com.vn
* epel: download.nus.edu.sg
* extras: centos-hcm.viettelidc.com.vn
* updates: centos-hcm.viettelidc.com.vn
Resolving Dependencies
--> Running transaction check
---> Package snapd.x86_64 0:2.54.3-1.el7 will be installed
--> Processing Dependency: snap-confine(x86-64) = 2.54.3-1.el7 for package: snapd-2.54.3-1.el7.x86_64
--> Processing Dependency: snapd-selinux = 2.54.3-1.el7 for package: snapd-2.54.3-1.el7.x86_64
--> Processing Dependency: squashfs-tools for package: snapd-2.54.3-1.el7.x86_64
--> Processing Dependency: squashfuse for package: snapd-2.54.3-1.el7.x86_64
--> Running transaction check
---> Package snap-confine.x86_64 0:2.54.3-1.el7 will be installed
---> Package snapd-selinux.noarch 0:2.54.3-1.el7 will be installed
---> Package squashfs-tools.x86_64 0:4.3-0.21.gitaae0aff4.el7 will be installed
---> Package squashfuse.x86_64 0:0.1.102-1.el7 will be installed
--> Processing Dependency: squashfuse-libs(x86-64) = 0.1.102-1.el7 for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libfuseprivate.so.0()(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libsquashfuse.so.0()(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Processing Dependency: libzstd.so.1()(64bit) for package: squashfuse-0.1.102-1.el7.x86_64
--> Running transaction check
---> Package libzstd.x86_64 0:1.5.2-1.el7 will be installed
---> Package squashfuse-libs.x86_64 0:0.1.102-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
snapd x86_64 2.54.3-1.el7 epel 16 M
Installing for dependencies:
libzstd x86_64 1.5.2-1.el7 epel 282 k
snap-confine x86_64 2.54.3-1.el7 epel 3.2 M
snapd-selinux noarch 2.54.3-1.el7 epel 478 k
squashfs-tools x86_64 4.3-0.21.gitaae0aff4.el7 base 101 k
squashfuse x86_64 0.1.102-1.el7 epel 18 k
squashfuse-libs x86_64 0.1.102-1.el7 epel 24 k
Transaction Summary
=============================================================================================================================================================
Install 1 Package (+6 Dependent packages)
Total download size: 20 M
Installed size: 56 M
Is this ok [y/d/N]: y
..........................
Step 5: Enable Snap
Once installed, the systemd unit that manages the main snap communication socket needs to be enabled. This can be done by using systemctl enable --now snapd.socket
command as shown below.
[root@cyberithub ~]# systemctl enable --now snapd.socket
Created symlink from /etc/systemd/system/sockets.target.wants/snapd.socket to /usr/lib/systemd/system/snapd.socket.
Step 6: Create a Symbolic Link(Optional)
You can also enable the classic snap support by creating a symbolic link between /var/lib/snapd/snap
and /snap
using ln -s /var/lib/snapd/snap /snap
command as shown below.
[root@cyberithub ~]# ln -s /var/lib/snapd/snap /snap
Step 7: Restart Your System
After performing above steps, either log out or log in or restart your system to ensure snap’s paths are updated correctly.
[root@cyberithub ~]# reboot
Step 8: Check Snap Version
After restarting the system, you can verify the installed version of snap utility by using snap --version command as shown below. It will also show the current installed version of snapd which will be same as snap utility.
[root@cyberithub ~]# snap --version snap 2.54.3-1.el7 snapd 2.54.3-1.el7 series 16 centos 7 kernel 3.10.0-1160.53.1.el7.x86_64
Step 9: Install Snap Package
Now that snap utility is successfully installed, it is time to test the utility by installing a snap package. For example here we are installing ngrok
using snap install ngrok
command as shown below.
[root@cyberithub ~]# snap install ngrok
2022-03-16T02:48:14-04:00 INFO Waiting for automatic snapd restart...
ngrok 2.3.40 from Kyle Wenholz (kyle-ngrok) installed
Step 10: Remove Snapd
Once you are done using snap utility, it can also be removed from the System by using yum remove snapd
command as shown below. But be very cautious before removing this utility as it might remove all the snap packages which is sometime critical to your application.
[root@cyberithub ~]# yum remove snapd
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package snapd.x86_64 0:2.54.3-1.el7 will be erased
--> Finished Dependency Resolution
base/7/x86_64 | 3.6 kB 00:00:00
epel/x86_64/metalink | 9.1 kB 00:00:00
epel/x86_64 | 4.7 kB 00:00:00
epel/x86_64/updateinfo | 1.0 MB 00:00:00
epel/x86_64/primary_db | 7.0 MB 00:00:02
extras/7/x86_64 | 2.9 kB 00:00:00
hashicorp/7/x86_64 | 1.4 kB 00:00:00
packages-microsoft-com-prod | 3.0 kB 00:00:00
updates/7/x86_64 | 2.9 kB 00:00:00
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Removing:
snapd x86_64 2.54.3-1.el7 @epel 46 M
Transaction Summary
=============================================================================================================================================================
Remove 1 Package
Installed size: 46 M
Is this ok [y/N]: y
.................................