15

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.

1
  • 1
    What? Of course you can install .deb packages offline. May 16, 2016 at 12:09

2 Answers 2

14

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.

3
  • So I have found some snap packages still try to connect to the Internet while installing. For quake-shareware_5.snap it says "Ensure prerequistites for "quake-share" are available". This will timeout on an offline machine.
    – Seth
    Jun 15, 2018 at 16:17
  • @Seth Check whether core.snap has been installed Jul 12, 2019 at 3:31
  • just a reminder, maybe you need to do snap download core too
    – milkice
    Mar 18, 2023 at 12:59
9

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
4
  • 1
    Is this still the case? When I try installing a locally-built copy of the hello_world snap on Ubuntu 16.04 behind our corporate firewall I get error: cannot install snap file: Get https://search.apps.ubuntu.com/api/v1/snaps/details/core?channel=stable&fields=anon_download_url%2Carchitecture%2Cchannel%2Cdownload_sha3_384%2Csummary%2Cdescription%2Cdeltas%2Cbinary_filesize%2Cdownload_url...%2Cconfinement: dial tcp 162.213.33.196:443: getsockopt: connection refused. It seems to be insisting on going online for something...
    – lane
    Apr 25, 2017 at 8:53
  • Looks like it's trying to fetch the snap. What command exactly did you run? snap install hello-world? Or snap install /path/to/my/hello-world?
    – kyrofa
    Apr 25, 2017 at 14:40
  • 1
    You can also try using --dangerous, it may be checking the store for assertions.
    – kyrofa
    Apr 25, 2017 at 14:41
  • 4
    This was using sudo snap install --dangerous ./hello_2.10_amd64.snap
    – lane
    Apr 26, 2017 at 6:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .