In our previous tutorial, we have discussed what is Snap packages, its advantages and disadvantages, where you can get the Snap packages, and how to create your own Snap packages etc. For more details, check our previous article titled "An introduction to Ubuntu’s Snap packages". Today, we will see how to install Snap packages and use them in real time. As you may already know, Snapd, which is used to install Snap packages, comes preinstalled by default in Ubuntu 16.04 LTS. So, we don't have to install it in Ubuntu 16.04 Desktop or Server. If you're a Ubuntu 16.04 user, just skip the installation part and go to the 'Usage' part.
Install Snapd in Arch Linux
Snapd is not available in the Arch Linux's official repositories. Yes, it is available now. To install Snapd on Arch linux and its derivatives like Antergos, Manjaro Linux, run the following command:
sudo pacman -S snapd
After installing Snapd, enable and start snapd service using commands:
sudo systemctl enable --now snapd.socket
If you want your apps to be automatically updated from the store start/enable the snapd.refresh.timer.
sudo systemctl enable --now snapd.refresh.timer
After installing Snapd, reboot once before start using it.
Install Snapd in Fedora
Snapd is not available in Fedora's default repositories. So, we need to add Copr Repository for snapcore to install it. To do so, run the following commands as root user:
dnf install 'dnf-command(copr)'
Then, Enable Copr repository for snapcore using command:
dnf copr enable zyga/snapcore
Update the repository lists:
Finally, Install Snapd using command:
dnf install snapd
Then, set SELinux to permissive mode.
To do so, edit:
sudo nano /etc/selinux/config
Find the following line:
And, Set the value as 'permissive' as shown below:
Save and close the file.
And then, log out and login or reboot your system to start installing snaps.
Snapd usage is fairly simple, and it is same for all distributions that supports snapd. Let us see some examples.
Let us search the available snaps with command:
The above command displays the list of available snaps in a nice tabular column. You can check a snap package version, developer name, and its description etc.
To search a specific package, for example htop, run:
snap find htop
Name Version Developer Notes Summary htop 2.0.1 maxiberta - Interactive processes viewer
Install a Snap package
To install a snap package, run:
sudo snap install krita
Krita is a free digital painting studio application. It is one of the best alternative to MS-PAINT application.
[sudo] password for sk: 97.80 MB / 97.84 MB [=======================================================================================================] 99.96 % 256.74 KB/s 6m30s Name Version Rev Developer Notes krita 3.0-snap12 3 krita devmode
Then, launch the installed snap either.
Note: If the Snap package is not shown in the Menu, reboot your system. And then try to launch it. I hope this is a bug. Since Snapd is in earlier stages, you might have some problems while using it.
Here it is my Krita snap package in Arch Linux.
As I mentioned in the previous article, each Snap package will be installed in a separate directory and doesn't mess up with other system directories.
See Krita application is installed in a separate ( ex. /home/sk/snap/krita) directory in my Arch Linux desktop.
Similarly, All future snaps will be stored in separate directory within /home/sk/snap/ directory as well.
Updating Snap packages
To update a snap package, run:
sudo snap refresh <packagename>
sudo snap refresh krita
If there is any update available for the snap package, it will be installed.
If there isn't any update, you will see a message something like below.
error: cannot perform the following tasks: - Download snap "krita" from channel "stable" (revision 3 of snap "krita" already installed)
List out installed Snap packages
We can find the list of available snaps from the repository using command "sudo snap find", right? But what about installed snap packages? It is simple too.
To list out the installed snaps in our system, run:
sudo snap list
Name Version Rev Developer Notes krita 3.0-snap12 3 krita devmode ubuntu-core 16.04+20160531.11-56 122 canonical -
Removing Snap packages
To remove an installed snap, run:
sudo snap remove krita
The above command will remove krita snap package from your system.
You can also view the list of system changes during installing or updating or removing snap packages.
To view any recent changes in the snap packages, run:
ID Status Spawn Ready Summary 1 Done 2016-06-20T07:56:14Z 2016-06-20T08:07:09Z Install "krita" snap 2 Error 2016-06-20T08:44:59Z 2016-06-20T08:45:01Z Refresh "krita" snap
I hope you got a basic usage idea of snap packages. Though, snap is still in its early development stage, it worked well as I expected. I have tested only few snap packages. You can find all available snaps either using command - 'snap find' or on the snap store. I will keep you updated more about snap's usage in the days to come.
For more details about snap, check the man pages.
Please note that Manual entry for snap is available only in Ubuntu, not in other distros. If you are testing snap in other distros, you will not have any man pages for snap command.
That's all for now. If you find this guide useful, please share it on your social, professional networks and support OSTechNix.