Snap is a software package management platform created by Canonical for installing and managing package applications on Linux.

Unlike traditional package managers, Snap packages (or “snaps“) are self-contained applications that come with all the needed dependencies to reduce package conflicts across all Linux distributions.

This article will go through the steps to install a specific package version using Snap and provide some examples of common Snap commands.

Installing Snapd in Linux

To install the snapd daemon and enable snap package support, use the following appropriate command for your specific Linux distribution.

On Ubuntu and Debian-based distributions.

sudo apt install snapd

 

 

On Fedora and Red Hat-based distributions.

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

On openSUSE.

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

On Arch Linux.

sudo yay -S snapd
OR
sudo pacman -S snapd
sudo systemctl enable --now snapd.socket

Once the installation is complete, reboot your machine for the settings to take effect, or log out and log back in.

Installing a Specific Version of a Package

Snap packages often come in different versions, and sometimes you need a specific version for compatibility or testing purposes. Here’s how you can install a specific version.

Find Available Versions of Snap Packages

To see the available versions of a Snap package called ‘vlc‘, you can use the snap info command.

snap info vlc
Find Versions of Snap Packages
Find Versions of Snap Packages

Install a Specific Version of the Package

To install the particular version of the package, use the --channel option, which can be stable, candidate, beta, or edge followed by the version number.

For example, to install VLC version 3.0.20 from the stable channel, use:

sudo snap install vlc --channel=latest/stable

After installation, verify the installed version of ‘vlc‘ using the snap list command.

snap list vlc
Install Specific Version of Snap Package
Install Specific Version of Snap Package

Switch to a Different Package Version

Switching to a different version of a Snap package is a useful feature that allows you to change the installed version without removing and reinstalling the package.

For example, to switch to a different version of ‘vlc’ package, use the --channel option with a desired channel and version of the package as shown.

sudo snap refresh vlc --channel=latest/beta

After switching the version, verify the change using the snap list command.

snap list vlc
Switch to Different Package Version
Switch to a Different Package Version

Downgrade Package to the Specific Version

If you find the updated or installed version of VLC unsatisfactory, you can revert to the previously installed version using the snap revert command.

sudo snap revert vlc

This command will roll back VLC to the version that was installed before the most recent update.

After reverting, you can again verify the installed version of VLC to ensure it has been reverted successfully.

snap list vlc
Downgrade Package to Specific Version
Downgrade Package to Specific Version

Removing a Snap Package

To remove a snap package called ‘vlc’, use the snap remove command, which will uninstall the specified Snap package from your system.

sudo snap remove vlc

After removing the package, you can verify that it has been successfully removed by listing installed Snap packages.

snap list
Remove Snap Packages
Remove Snap Packages
Conclusion

Using Snap to manage packages in Linux is straightforward and powerful, especially when you need to handle specific versions of applications.

By following the steps outlined in this article, you can easily install and manage different versions of Snap packages.

Similar Posts