Snap is a software deployment & package management system, it has containerized software packages that are simple to create & install. Snap packages are safe to run, they auto-update & we can also roll-back the changes easily.
The main advantage of using snap is that it combines a package & all the required dependencies into a single package, which allows each package to work on all Linux distribution without any issue.
Recommended Read: Beginner’s guide to Backup Postgres Database
Also Read: Conda Commands cheat sheet for Beginners
The name snap comes from snappy which was a package management system for Ubuntu phones. So also In this tutorial, we will learn to install Snap on CentOS & Ubuntu systems. Once we install snap on Linux machines, we will also discuss some mostly used snap commands for package management.
Install Snap on Ubuntu
Starting with Ubuntu 16.04, the snap comes pre-installed on the system. But if it’s not installed or you need to install it on other Ubuntu versions, then the command to do so is,
$ sudo apt update && sudo apt install snapd
Once the package has been installed, we need to log out & then log back in to update all the snap’s paths correctly. We can then use snap for package management using the commands mentioned below.
Install Snap on CentOS/RHEL
Snap on CentOS & RHEL is not available with default repository & we need to install 3rd party repository i.e. EPEL. You can refer to our tutorial on how to install EPEL repository or you can try the following command, which works on the new versions,
$ sudo yum install epel-release
Now we can start the snap installation with the following command,
$ sudo yum install snapd
After installation, we need to enable the snap package,
$ sudo systemctl enable –now snapd.socket
We now have snap installed on our systems & if we also want to enable classic snap support then we can create a system link for the same,
$ sudo ln -s /var/lib/snapd/snap /snap
Now we can either restart or log out & log back in to make sure that all the snapd paths are updated.
Snap Commands for Beginners
After snap installation, we must be aware of the commands that can be used for the package management using snap. Below mentioned are some commands that you should know for package management using snap,
To install a package using snap, execute the following from the terminal
$ snap install package
To remove a package from the system, run
$ snap remove package
As mentioned above, snap packages are updated automatically & we might not be required to run the below-mentioned command at all but none the less, for your information,
$ snap refresh
This command will update all the snap packages.
To find a package in the snap repository, execute the following command,
$ snap find package_query
List installed packages
To check all the installed packages on your system, run
$ snap list
Information for a package
To check complete information for a package, use the following
$ snap info package
This concludes our tutorial on how to install snap on Linux systems. Please feel free to send in any questions, queries or suggestions using the comment box below.