What is Snapcraft?

Snapcraft is a powerful command-line tool for developers to create new Snap packages from their programs. It can run on a Linux system as well as on Windows and macOS. Snapcraft reads a simple and declarative file and runs the build for us to build snap packages. You can install a wide range of packages available on the Snapcraft store in a single command.

How to Install Snapd on Linux

Snapd is a REST API daemon for managing snap packages. It also provides a snap command-line utility for client machines to interact with the snapd daemon. Users can interact with it by using the snap client. Most of the latest Linux operating systems are pre-installed with the snapd daemon service. But if your Linux machine doesn’t have snapd installed, use one of the following commands to install it.

To install Snapd on Debian based systems, type:sudo apt install snapd To install Snapd on Redhat based systems, type: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.

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:

How to Install a Snap Package

You can install any package available on snapcraft store with the following command. To install package type: 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: To install edge release:

List Installed Snap Packages

Use snap list command to view all the installed snaps on your system. To view installed packages, type:

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: Use the below command to update snap packages on your system.

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: 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:

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

In this tutorial, you have learned about Linux snap packages. You get a basic understanding of installing, updating, and removing the snap packages on a Linux system.

Working with the Snap Package in Linux   TecAdmin - 87Working with the Snap Package in Linux   TecAdmin - 31Working with the Snap Package in Linux   TecAdmin - 35Working with the Snap Package in Linux   TecAdmin - 28