Introduction to Snap Packages
Ubuntu users have long relied on traditional package management systems like APT to install and manage software. While APT is powerful and widely used, it primarily deals with .deb packages, which come from specific repositories. However, there are newer alternatives to installing software on Ubuntu, with Snap being one of the most prominent solutions.
Snap packages offer a more flexible and distribution-agnostic method of software installation that includes all the necessary dependencies within a single package, thus making it easier to distribute and install software across various Linux distributions. Whether you're using Ubuntu, Debian, Fedora, Arch, or other distributions, Snap packages are designed to "just work" without dependency conflicts.
In this guide, we'll dive deep into the Snap ecosystem, discussing what it is, how it works, and how you can take advantage of Snap packages on your Ubuntu system.
1. What Is Snap?
1.1 The Concept Behind Snap
Snap is a package management system developed by Canonical, the company behind Ubuntu. It allows developers to package applications along with their dependencies and configuration files into a single unit called a Snap package. The key advantage of this approach is that Snap packages are self-contained, meaning that they are not dependent on the specific version of libraries or tools present on the system. This avoids the typical dependency issues that can arise with traditional package managers.
Snaps are containerized, which means they run in a sandboxed environment, separate from the core operating system. This isolation makes Snaps more secure and easier to distribute across different Linux distributions without modifications.
1.2 Why Use Snap?
The traditional method of installing software in Linux often involves dealing with different package formats, dependency conflicts, and the risk of breaking your system when upgrading certain libraries. Snap aims to simplify software installation by packaging everything an application needs to run, including dependencies and specific versions of required libraries. Here are some reasons why Snap is so widely adopted:
- Universal Compatibility: A Snap package can run on any Linux distribution that supports Snap, including Ubuntu, Fedora, Arch, and more.
- No Dependency Conflicts: Since all required libraries and dependencies are included in the Snap package, there’s no risk of dependency issues.
- Automatic Updates: Snap automatically updates your installed applications in the background, ensuring you always have the latest versions and security patches.
- Security: Snaps are sandboxed, meaning they run in an isolated environment, reducing the potential security risks to your system.
- Ease of Use: Installing Snap packages is incredibly easy and doesn’t require in-depth knowledge of package management.
1.3 How Snap Differs from Traditional Package Managers
Snap is different from traditional package managers like APT and YUM in several ways:
- Self-Contained: Unlike APT, which installs software from a repository and pulls in dependencies, Snap packages include everything needed to run the software.
- Universal: Snap works across multiple distributions without the need to create separate package versions for each.
- Sandboxing: Snap packages run in isolation, reducing the risk of system-wide interference or security vulnerabilities.
- Versioning: Multiple versions of the same Snap package can be installed on the same system, unlike APT, which can only manage one version of a package at a time.
2. Installing Snap on Ubuntu
Ubuntu comes pre-installed with Snap support in most modern releases, but if you’re using an older version or a different Linux distribution, you may need to install the snapd service manually.
2.1 Installing the snapd Service
If Snap isn’t already installed on your Ubuntu system, you can install it using the APT package manager. Open a terminal and run the following command:
sudo apt update
sudo apt install snapd
This command installs the snapd service, which is necessary to manage and run Snap packages on your system.
2.2 Checking for Snap Pre-Installation on Ubuntu
To check whether Snap is already installed on your system, you can run the following command in the terminal:
snap version
If Snap is installed, you will see output similar to the following:
snap 2.65.3+24.04
snapd 2.65.3+24.04
series 16
ubuntu 24.04
kernel 6.8.0-47-generic
If you don’t get any output or if the command is not recognized, you’ll need to install Snap as described in the previous section.
3. How to Install Snap Packages
Once you have Snap installed on your system, installing Snap packages is a breeze. Snap packages can be installed from the Snap Store, which is an online repository of Snap applications maintained by Canonical.
3.1 Installing a Snap Package
To install a Snap package, you can use the following command:
sudo snap install <package-name>
For example, to install the VLC media player as a Snap package, you would run:
sudo snap install vlc
Name Version Publisher Notes Summary
vlc 3.0.20-1-g2617de71b6 videolan✓ - The ultimate media player
orion-desktop 3.0.0 keshavnrj✪ - Complete torrent client and streamer for Linux Desktop
audio-sharing 0.2.2 soumyadghosh✪ - Share your computer audio
gridplayer 0.5.2 vzhd1701 - Play multiple videos side-by-side
ustreamer 6.17 pgentili - Lightweight and fast MJPEG-HTTP streamer
mjpg-streamer 2.0 ogra - UVC webcam streaming tool
audio-recorder 3.0.5+rev1432+pkg-7b07 brlin - A free audio-recorder for Linux (EXTREMELY BUGGY)
kycli 0+git.9591d6e dvlc - The command line interface to the unofficialKYC platform.
peerflix v0.39.0+git1.df28e20 pmagill - Streaming torrent client for Node.js
test-streamlink 1.4.1-64-g599f362e addq1eax - test-StreamlinkOnce the installation is complete, you can launch the application from the menu, or by typing the application name (e.g., vlc) in the terminal.
3.2 Searching for Snap Packages
To search for available Snap packages, use the search command:
snap search <keyword>
For example, to search for all available packages related to VLC, run:
snap search vlc
This command will return a list of Snap packages that match the keyword, along with their descriptions and versions.
3.3 Managing Installed Snap Packages
To view a list of installed Snap packages on your system, use the following command:
snap list
This will display all the Snap packages you have installed, along with their version numbers and the channels they are installed from.
3.4 Removing Snap Packages
To remove a Snap package, use the following command:
sudo snap remove <package-name>
For example, to remove VLC, run:
sudo snap remove vlc
4. Updating Snap Packages
4.1 How Snap Handles Updates
One of the most convenient features of Snap is its ability to update applications automatically. By default, Snap packages check for updates and apply them in the background. This ensures that you always have the latest version of an application without needing to manually download and install updates.
4.2 Manual Updates and Scheduling
If you want to manually check for and apply updates, use the following command:
sudo snap refresh
You can also configure Snap to update packages at specific times by setting up a refresh schedule. For example, to set Snap to update only at 2 AM, you can use:
sudo snap set system refresh.timer=2:00-3:00
This will limit Snap package updates to the specified time window.
5. Popular Applications Available as Snap Packages
Snap has gained significant popularity because it offers a large variety of applications, both open-source and proprietary. Here are some of the most popular applications available as Snap packages:
- VLC (Media Player)
- Spotify (Music Streaming)
- Slack (Collaboration Tool)
- Postman (API Development Tool)
- Visual Studio Code (Code Editor)
- Chromium (Web Browser)
- Docker (Container Management Tool)
These applications can be installed using the snap install command, just like any other Snap package.
6. Managing Snap Permissions
Since Snap packages are sandboxed, they run with limited access to the system by default. However, certain applications may require access to specific parts of your system, such as your home directory, network, or hardware devices.
You can manage the permissions for a Snap package using the connections command. For example:
snap connections <package-name>
This command will display a list of interfaces (permissions) that the Snap package is using. You can manually disconnect or connect specific permissions by running:
sudo snap connect <package-name>:<interface>
sudo snap disconnect <package-name>:<interface>
Conclusion
Snap packages have revolutionized software distribution and installation on Linux, providing a universal and seamless experience for users of all distributions, including Ubuntu. With their built-in dependencies, automatic updates, and secure sandboxing, Snap packages make it easier than ever to manage software without worrying about dependency issues or system compatibility.
In this guide, you’ve learned what Snap packages are, how they differ from traditional package managers, and how to install, manage, and update Snap packages on your system. Whether you're a seasoned Linux user or new to the world of open-source operating systems, Snap provides an intuitive and powerful way to manage your software on Ubuntu.