How to Install and Use Snap Packages on Linux
As many of you already know, the Ubuntu snap package format is coming to other major Linux distributions such as Arch Linux, Fedora, Debian and many more distros will support snap packages in the future. This tutorial is going to show you how to install Snap packages on Arch Linux, Fedora, Debian and Ubuntu.
We will need snapd service in order to install snap packages.
Install the snapd service on Arch Linux
We can install it from AUR with yaourt package manager.
yaourt snapd
Once done, enable the snapd service with systemctl . --now
option will start the service.
sudo systemctl enable --now snapd.service
To automatically update snap packages:
sudo systemctl start snapd.refresh.timer sudo systemctl enable snapd.refresh.timer
Install snapd on Fedora
Enable the copr zyga/snapcore
repository.
sudo dnf copr enable zyga/snapcore
Then install snapd
sudo dnf install snapd
Start and enable the snapd
systemd service:
sudo systemctl start snapd.service sudo systemctl enable snapd.service
On Fedora 24, you have to set permissive
as the SELinux security policy to allow starting the snapd
service. So let’s edit the SELinux config file.
sudo nano /etc/selinux/config
Change the security policy from enforcing to permissive.
SELINUX=permissive
Save and close the file. Now you can start snapd service with systemctl
. If it still doesn’t work and throw out the following error message.
error: system does not fully support snapd: cannot mount squashfs image using "squashfs": mount: /tmp/sanity-mountpoint-574715864: wrong fs type, bad option, bad superblock on /dev/loop1, missing codepage or helper program, or other error.
Then set the SELinux policy to disabled. Then restart your computer.
SELINUX=disabled
Install snapd on Debian
sudo apt install snapd
Install snapd on Ubuntu
sudo apt install snapd
Installing Snap Packages on Arch, Fedora
Now snapd is installed on Arch Linux, Fedora and the snapd service is started, we can install snap apps from the Ubuntu snap store.
Use this command to list available snap packages.
snap find
Search snap packages in the store.
snap find <package_name>
To install a snap package:
sudo snap install <package_name>
List installed snap packages.
snap list
For example, install Nextcloud server with the following command.
sudo snap install nextcloud
Snap apps are installed in /snap
directory.
Multiple Versions of Software
A benefit provided by Snap is that software developers can easily ship multiple versions of the same software. For example, I can list all available versions of Ruby with:
snap info ruby
Output:
channels: latest/stable: 3.1.2 2022-04-15 (278) 36MB classic latest/candidate: ↑ latest/beta: ↑ latest/edge: 3.1.2 2022-04-16 (281) 36MB classic 3.1/stable: 3.1.2 2022-04-15 (278) 36MB classic 3.1/candidate: ↑ 3.1/beta: ↑ 3.1/edge: ↑ 3.0/stable: 3.0.4 2022-04-15 (275) 34MB classic 3.0/candidate: ↑ 3.0/beta: ↑ 3.0/edge: ↑ 2.7/stable: 2.7.6 2022-04-15 (272) 21MB classic 2.7/candidate: ↑ 2.7/beta: ↑ 2.7/edge: ↑ 2.6/stable: 2.6.10 2022-04-15 (269) 27MB classic 2.6/candidate: ↑ 2.6/beta: ↑ 2.6/edge: ↑ 2.5/stable: 2.5.9 2021-04-07 (209) 23MB classic 2.5/candidate: ↑ 2.5/beta: ↑ 2.5/edge: ↑ 2.4/stable: 2.4.10 2020-04-01 (178) 26MB classic 2.4/candidate: ↑ 2.4/beta: ↑ 2.4/edge: ↑ 2.3/stable: 2.3.8 2018-11-08 (109) 33MB classic 2.3/candidate: ↑ 2.3/beta: ↑ 2.3/edge: ↑ installed: 2.6.10 (269) 27MB classic
Sometimes, an application (such as Discourse) may not be compatible with the latest version of Ruby, so instead of installing Ruby 3.1, I can install Ruby 3.0 with:
sudo snap install ruby --classic --channel=3.0/stable
How to Disable Snapd
If you don’t want to use Snapd, but you also don’t want to remove Snapd, then you can disable it with:
sudo systemctl disable snapd.service snapd.socket sudo systemctl mask snapd.service snapd.socket
If you want to remove Snap completely from your system, then also run the following command.
sudo apt purge snapd
Questions or suggestions are always welcome. If you found this post useful, 🙂 please share it with your friends on social media! Stay tuned for more Linux tutorials.