Is it possible to install the .snap application in an offline computer?

In DEB package, it is not possible to install an application in offline (in a computer which does not have any internet access). Because of the dependencies. In case of .snap, according to the OMG!Ubuntu, Snap packages can contain both application binary and any dependencies required for it to run.

Does it mean that, any .snap application can be installed in an offline pc (like the .dmg in MacOSX)? As there is no need to fetch any dependencies from the source.


Solution 1:

It seems you first have to download and install the ubuntu-core snap before you can do offline installs for any other snaps. For me this worked:

Run the following commands on an online Ubuntu system:

snap download ubuntu-core
snap download somePackage

This will put the following files in your current directory:

ubuntu-core_1797.assert
ubuntu-core_1797.snap
somePackage.assert
somePackage.snap

Copy these files to the offline system, then install them (from the directory they were copied to):

sudo snap ack ubuntu-core_1797.assert
sudo snap install ubuntu-core_1797.snap
sudo snap ack somePackage.assert
sudo snap install somePackage.snap

This should solve the problem @lane had where it tried to connect to the internet while installing a local .snap file.

Solution 2:

First of all, you can indeed install debs offline:

$ sudo dpkg -i <deb>

However, you're right in that it doesn't take into account the deb's dependencies-- you actually need to have the deb and all its dependencies available offline in order to successfully install it:

$ sudo dpkg -i <deb> <dependency1> <dependency2> ...

So yes, installing a snap offline is very easy, and all you need to have is that single snap (since as you know, it includes its dependencies):

$ sudo snap install path/to/snap