Snap packages are a relatively new form of package management system designed for Linux. They were created by Canonical, the company behind Ubuntu, in 2014. The goal of snap packages is to make it easier to install, update, and manage software on Linux systems. In this article, we will provide an introduction to snap packages in Linux, discussing what they are and how they work.
In this article, we will discuss how to install snap packages on Ubuntu and other Linux distributions.
Installing Snapd
Before we can install snap packages, we need to make sure that the snapd daemon is installed on our system. Snapd is the background process that handles the installation and management of snap packages. It is not pre-installed on some Linux distributions, so we will need to install it manually.
- On Ubuntu, snapd can be installed from the command line using the following command:
sudo apt install snapd
- On other Linux distributions, snapd can be installed using the distribution’s package manager. For example, on Fedora, the following command can be used:
sudo dnf install snapd
Once the installation is finished, snapd daemon will be up and running on your system. You can find the status of the service with the following command.
sudo systemctl status snapd
Searching for Snap Packages
Snap command line utility provides you option to search for available snap packages/applications on snapcraft store. You can directly search applications on online Snapcrat store.
You can also use find sub-command followed by the package name to search. To find Snap packages, type:
sudo snap find postman
How to Install a Snap Package
You can install any package available on snapcraft store with the following command. To install package type:
sudo snap install postman
Snappy also maintains the different channels for package installation. This allows users to install any package stable version, beta, or daily updated versions. Here are the 4 major channels available for snap packages:
- stable: Stable version of packages, recommended for the most of users or production environments.
- candidate: It provides packages with updates prior to stable deployment, or those verifying whether a specific issue has been resolved.
- beta: for users wanting to test the latest features, typically outside of a production environment.
- edge: for users wanting to closely track development.
You can use --channel
to specify the channel name to install the package from It. Channel is a snap concept that stands for the release of a snap.
To install beta release:
sudo snap install postman --channel=beta
To install edge release:
sudo snap install postman --channel=edge
List Installed Snap Packages
Use snap list command to view all the installed snaps on your system. To view installed packages, type:
sudo snap list
How to Upgrade Snap Packages
The Snap packages are automatically update by default. You can also update it manually using the command line. To find out the available updates for the packages, execute:
sudo snap refresh --list
Use the below command to update snap packages on your system.
sudo snap refresh
How to Downgrade a Snap Package
Snapd also allows reverting any package to the previous version. If you accidentally updated for the package or you don’t like the upgraded package. Use the following command to revert any package:
sudo snap revert <package_name>
This will revert both the snap revision and the data associated with the application.
Removing Snap Packages
You can remove snap packages anytime, whenever you don’t’ required. Run the following command with the package name to remove from your system:
sudo snap remove <package_name>
The above command will remove all the associated user data, applications and dependencies from the systems. It will also stop and remove all the associated services with that package.
Conclusion
Snap packages are becoming an increasingly popular way to install and manage software on Linux. They offer several advantages over traditional package management systems, including ease of use, portability, and enhanced security. By following the steps outlined in this article, you can easily install and manage snap packages on your Ubuntu or other Linux distribution system.