2024-02-01
Before diving into Snap’s capabilities, you need to install it. The installation process varies slightly depending on your distribution, but generally involves executing a single command in your terminal.
On Debian/Ubuntu based systems:
sudo apt update
sudo apt install snapd
sudo systemctl enable --now snapd.socket
sudo systemctl enable --now snapd.seeded.serviceOn Fedora/Red Hat based systems:
The process is slightly different, requiring the use of dnf:
sudo dnf install snapd
sudo systemctl enable --now snapd.socket
sudo systemctl enable --now snapd.seeded.serviceOn Arch Linux:
Use pacman:
sudo pacman -S snapd
sudo systemctl enable --now snapd.socket
sudo systemctl enable --now snapd.seeded.serviceAfter installation, you need to refresh the Snap store:
sudo snap refreshOnce Snap is installed, installing applications is straightforward. Simply use the snap install command followed by the package name. For example, to install the popular code editor VSCode:
sudo snap install code --classicThe --classic flag grants the application full access to system resources. Use it only when necessary, prioritizing the default confinement level for enhanced security. Many snaps do not require this.
Let’s install another popular application, the VLC media player:
sudo snap install vlcTo list all installed snap packages:
snap listThis command will output a table showing installed snaps, their versions, and channels.
To update all installed snaps:
sudo snap refreshOr update a specific snap:
sudo snap refresh <snap_name>
``` Replace `<snap_name>` with the actual name of the snap (e.g., `vlc`, `code`).
Removing a snap is equally simple:
```bash
sudo snap remove <snap_name>Snap utilizes channels to manage different versions of a software package. These channels represent different stages of development (e.g., stable, beta, candidate). You can list available channels for a specific snap using:
snap channels <snap_name>Switching to a different channel (e.g., a beta version) is done with:
sudo snap switch <snap_name> <channel_name>Remember to replace <snap_name> and <channel_name> with the appropriate values.
To search for available snaps, use the snap find command. This is useful if you’re unsure of the exact name of the package you want:
snap find <search_term>Replace <search_term> with keywords describing the application you are searching for.
This guide provides a solid foundation for utilizing Snap for package management on your Linux system. The versatility and security features of Snap make it a tool for any Linux user.