Skip to content

Snap — Universal Package Management for Linux

Snap is a universal package management system developed by Canonical that allows applications to be packaged once and installed across multiple Linux distributions. Snap packages include their required dependencies, provide automatic updates, and run in isolated environments for improved security and portability.


Learning Path

Linux Mastery → Module 7: Package Management → Lesson 5

Difficulty: Beginner → Intermediate

Reading Time: 55 Minutes

Course Progress

Course: Linux Mastery

Module: Package Management

Lesson: 5 of 10


What You'll Learn

After completing this lesson, you'll be able to:

  • Understand Snap packages
  • Install and remove Snap applications
  • Search the Snap Store
  • Manage Snap updates
  • Work with Snap channels
  • Understand Snap confinement
  • Compare Snap with traditional package managers
  • Apply Snap in real-world environments

Prerequisites

Complete:

  • Module 1 – Linux Fundamentals
  • Module 2 – Linux Command Line Essentials
  • Module 3 – Text Processing
  • Module 4 – File Management and Permissions
  • Module 5 – Users and Groups
  • Module 6 – Process Management
  • Module 7 Lessons 1–4

Why Learn Snap?

Imagine you want to install:

  • Visual Studio Code
  • Postman
  • Spotify
  • Docker
  • Node.js
  • Slack

Different Linux distributions use different package managers.

Wouldn't it be easier if one package worked everywhere?

That's exactly what Snap provides.


What is Snap?

Snap is a universal package format that works across multiple Linux distributions.

A Snap package contains:

  • Application
  • Required libraries
  • Dependencies
  • Metadata
  • Runtime information

Everything required to run the application is bundled together.


How Snap Works

Snap Store
Download Snap Package
Install Package
Run in Sandboxed Environment
Automatic Updates

What is snapd?

snapd is the background service that manages Snap packages.

It handles:

  • Installation
  • Updates
  • Security
  • Snap services
  • Communication with the Snap Store

Verify the service:

systemctl status snapd

Install Snap (Ubuntu)

Snap is pre-installed on most Ubuntu systems.

Check:

snap version

Example:

snap    2.xx

snapd   2.xx

Install Snap (RHEL/Rocky/AlmaLinux)

Install snapd.

sudo dnf install snapd

Enable the service.

sudo systemctl enable --now snapd

Create the symbolic link.

sudo ln -s /var/lib/snapd/snap /snap

Search for Applications

snap find vscode

Example:

code

code-insiders

Install a Snap Package

Example:

sudo snap install code --classic

Install VLC.

sudo snap install vlc

Install Postman.

sudo snap install postman

List Installed Snaps

snap list

Example:

Name

Version

Publisher

Remove a Snap Package

sudo snap remove vlc

Refresh Installed Packages

Update all installed Snap packages.

sudo snap refresh

Update a specific package.

sudo snap refresh code

Check for Updates

snap refresh --list

Displays available Snap updates.


Snap Channels

Each Snap package may provide different release channels.

Common channels:

Channel Description
stable Production-ready releases
candidate Pre-release candidate
beta Testing releases
edge Latest development builds

Install from a specific channel.

sudo snap install node --channel=edge

Switch Channels

sudo snap refresh node --channel=stable

Revert to Previous Version

sudo snap revert code

Useful if an update introduces unexpected issues.


View Package Information

snap info code

Displays:

  • Version
  • Channels
  • Publisher
  • Description

Snap Services

Some Snap packages include services.

View services.

snap services

Start a service.

sudo snap start <service>

Stop a service.

sudo snap stop <service>

Restart a service.

sudo snap restart <service>

Security and Sandboxing

Snap applications run inside isolated environments.

Benefits:

  • Better security
  • Reduced impact of vulnerabilities
  • Controlled access to system resources

Permissions are managed through interfaces.

View connected interfaces.

snap connections

Common Commands

Search package.

snap find nginx

Install package.

sudo snap install nginx

List packages.

snap list

Update packages.

sudo snap refresh

Remove package.

sudo snap remove nginx

View information.

snap info nginx

Real Production Examples

Install Visual Studio Code.

sudo snap install code --classic

Install Node.js.

sudo snap install node

Install MicroK8s.

sudo snap install microk8s --classic

Install Postman.

sudo snap install postman

Production Perspective

Snap is commonly used for:

  • Developer workstations
  • Desktop Linux systems
  • Cross-distribution software deployment
  • IoT devices
  • Rapid application delivery
  • Applications requiring automatic updates

Traditional package managers are still preferred for most core operating system packages on enterprise Linux servers.


Hands-on Lab

Task 1

Check Snap version.

snap version

Task 2

Search for VLC.

snap find vlc

Task 3

View package information.

snap info vlc

Task 4

Install VLC.

sudo snap install vlc

Task 5

List installed Snap packages.

snap list

Task 6

Check available updates.

snap refresh --list

Task 7

Update installed Snap packages.

sudo snap refresh

Task 8

Remove VLC.

sudo snap remove vlc

Command Deep Dive

Command Purpose Production Example
snap find Search packages Application discovery
snap install Install application Software deployment
snap list List installed packages Inventory
snap refresh Update packages Maintenance
snap remove Remove application Cleanup
snap info View package details Verification
snap services View Snap-managed services Service management
snap revert Roll back to previous version Incident recovery

Snap vs Traditional Package Managers

Feature Snap APT/DNF/YUM
Package Format .snap .deb / .rpm
Cross-Distribution
Automatic Updates Manual or scheduled
Bundled Dependencies Shared system libraries
Sandboxed Applications Usually no
Ideal For Desktop & portable apps Core operating system software

Production Troubleshooting Scenario

Scenario

A developer installs Visual Studio Code.

sudo snap install code

The application cannot access a removable USB drive.

Investigation:

snap connections code

The required interface is not connected.

After granting the necessary permission, the application can access the device successfully.

This demonstrates how Snap improves security through application isolation and controlled permissions.


Best Practices

  • Use the stable channel for production environments.
  • Keep Snap packages updated.
  • Review application permissions using snap connections.
  • Prefer traditional package managers for core operating system packages.
  • Use Snap for cross-distribution desktop and developer applications.

Common Mistakes

❌ Installing development (edge) builds on production systems.

✅ Avoid this mistake: installing development (edge) builds on production systems.


❌ Ignoring Snap application permissions when troubleshooting access issues.

✅ Always review Snap application permissions when troubleshooting access issues.


❌ Assuming Snap packages behave exactly like traditional packages.

✅ They run in isolated environments and may have different filesystem access.


❌ Using Snap as the primary package manager for core operating system components.

✅ Avoid using Snap as the primary package manager for core operating system components when a safer approach exists.


Interview Questions

Beginner

  1. What is Snap?
  2. Which company developed Snap?
  3. Which command installs a Snap package?
  4. How do you list installed Snap packages?

Intermediate

  1. What is snapd?
  2. What are Snap channels?
  3. What is Snap confinement?
  4. How do you roll back to a previous Snap version?

Architect Level

  1. When would you choose Snap over APT or DNF?
  2. What are the advantages and disadvantages of bundled dependencies?
  3. How does Snap improve application security compared to traditional package managers?

Summary

In this lesson, you learned:

  • Snap package management
  • Installing and removing Snap packages
  • Searching the Snap Store
  • Automatic updates
  • Snap channels
  • Snap services
  • Sandboxed applications
  • Production best practices

Snap provides a universal package management solution that simplifies software distribution across multiple Linux distributions. Its bundled dependencies, automatic updates, and application isolation make it particularly useful for desktop software, developer tools, and cross-platform deployments.


Key Takeaways

  • Snap is a universal package management system.
  • snapd manages Snap packages and services.
  • Use snap install to install applications.
  • Use snap refresh to update installed packages.
  • Snap applications run in isolated, sandboxed environments.
  • Use the stable channel for production deployments.

What's Next?

Flatpak — Universal Package Management for Linux Applications

You'll explore:

  • What Flatpak is
  • Installing Flatpak applications
  • Managing repositories (remotes)
  • Installing applications from Flathub
  • Sandboxing and permissions
  • Comparing Flatpak with Snap
  • Desktop and enterprise use cases

Flatpak is another popular universal package management system designed for secure and portable Linux applications.