How To Install Snapcraft On Ubuntu 16.04

To Install Snapcraft on Ubuntu

Snapcraft is an open-source tool that helps its users to package deb packages to the snappy format. This article sheds light on the installation process of Snapcraft on Ubuntu. Snapcraft is an easy to install tool.

Installing Snapcraft

Initiate the installation of Snapcraft by adding the repository for installing the Snapcraft.

root@linuxhelp1:~# add-apt-repository ppa:snappy-dev/tools
 Official PPA for the Snappy related tools.
 More info: https://launchpad.net/~snappy-dev/+archive/ubuntu/tools
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpswfavnih/secring.gpg'  created
gpg: keyring `/tmp/tmpswfavnih/pubring.gpg'  created
gpg: requesting key FC42E99D from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpswfavnih/trustdb.gpg: trustdb created
gpg: key FC42E99D: public key " Launchpad PPA for Snappy Developers"  imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

Once it is done, update the newly added repository by using the following command.

root@linuxhelp1:~# apt-get update
Get:1 http://ppa.launchpad.net/snappy-dev/tools/ubuntu xenial InRelease [18.1 kB]
Hit:2 http://in.archive.ubuntu.com/ubuntu xenial InRelease                     
Hit:3 http://security.ubuntu.com/ubuntu xenial-security InRelease                                         
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]                               
Get:5 http://ppa.launchpad.net/snappy-dev/tools/ubuntu xenial/main amd64 Packages [2,032 B]
Get:6 http://ppa.launchpad.net/snappy-dev/tools/ubuntu xenial/main i386 Packages [2,028 B]
Get:7 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]      
Get:8 http://ppa.launchpad.net/snappy-dev/tools/ubuntu xenial/main Translation-en [728 B]
Fetched 227 kB in 1s (121 kB/s)                          
Reading package lists... Done


Now is the time to install Snapcraft. Use the following command for the same purpose.

root@linuxhelp1:~# apt-get install snapcraft -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libsodium18 python3-docopt python3-jsonschema python3-libarchive-c python3-libnacl python3-magic python3-petname
  python3-progressbar python3-pymacaroons python3-requests-toolbelt python3-simplejson python3-tabulate python3-yaml
Suggested packages:
  lxd snapd
The following NEW packages will be installed:
  libsodium18 python3-docopt python3-jsonschema python3-libarchive-c python3-libnacl python3-magic python3-petname
  python3-progressbar python3-pymacaroons python3-requests-toolbelt python3-simplejson python3-tabulate python3-yaml snapcraft
0 upgraded, 14 newly installed, 0 to remove and 438 not upgraded.
Need to get 537 kB of archives.
After this operation, 2,555 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 libsodium18 amd64 1.0.8-5 [144 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-docopt all 0.6.2-1build1 [19.4 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python3-jsonschema all 2.5.1-4 [30.3 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python3-libnacl all 1.4.5-0ubuntu1 [9,576 B]
Get:5 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python3-petname all 2.0-0ubuntu1~16.04 [10.7 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-progressbar all 2.3-2 [9,570 B]
Get:7 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python3-pymacaroons all 0.9.2-0ubuntu1 [9,942 B]
Get:8 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-requests-toolbelt all 0.6.0-2 [31.6 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python3-simplejson amd64 3.8.1-1ubuntu2 [48.6 kB]
.
.
.
Unpacking snapcraft (2.22.1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libsodium18:amd64 (1.0.8-5) ...
Setting up python3-docopt (0.6.2-1build1) ...
Setting up python3-jsonschema (2.5.1-4) ...
update-alternatives: using /usr/bin/python3-jsonschema to provide /usr/bin/jsonschema (jsonschema) in auto mode
Setting up python3-libnacl (1.4.5-0ubuntu1) ...
Setting up python3-petname (2.0-0ubuntu1~16.04) ...
Setting up python3-progressbar (2.3-2) ...
Setting up python3-pymacaroons (0.9.2-0ubuntu1) ...
Setting up python3-requests-toolbelt (0.6.0-2) ...
Setting up python3-simplejson (3.8.1-1ubuntu2) ...
Setting up python3-tabulate (0.7.5-1) ...
Setting up python3-yaml (3.11-3build1) ...
Setting up python3-libarchive-c (2.1-3) ...
Setting up python3-magic (1:5.25-2ubuntu1) ...
Setting up snapcraft (2.22.1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...

Snapcraft has been installed, start the service by invoking the following command.

root@linuxhelp1:~# snapcraft init
Created snapcraft.yaml.

Edit the file to your liking or run `snapcraft` to get started

Use the following command to to create Snapcraft

root@linuxhelp1:~# snapcraft
Preparing to pull my-part 
Pulling my-part 
Preparing to build my-part 
Building my-part 
Staging my-part 
Priming my-part 
Snapping ' my-snap-name'  |                                                                                             
Snapped my-snap-name_0.1_amd64.snap

You can remove the Snapcraft package by invoking the following command.

root@linuxhelp1:~# apt-get remove snapcraft -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libsodium18 python3-docopt python3-jsonschema python3-libarchive-c python3-libnacl python3-magic python3-petname
  python3-progressbar python3-pymacaroons python3-requests-toolbelt python3-simplejson python3-tabulate python3-yaml
Use ' sudo apt autoremove'  to remove them.
The following packages will be REMOVED:
  snapcraft
0 upgraded, 0 newly installed, 1 to remove and 438 not upgraded.
After this operation, 543 kB disk space will be freed.
(Reading database ... 174243 files and directories currently installed.)
Removing snapcraft (2.22.1) ...
FAQ
Q
How can remove the Snapcraft package?
A
You can remove the Snapcraft package by invoking the following command.
# apt-get remove snapcraft
Q
How can remove the Snapcraft package?
A
You can remove the Snapcraft package by invoking the following command.
# apt-get remove snapcraft
Q
How to create Snapcraft?
A
Use the following command to create Snapcraft
# snapcraft
Q
What is Snapcraft?
A
Snapcraft is an open-source tool that helps its users to package deb packages to the snappy format.
Q
What are snaps?
A
Snaps are a new type of Linux package designed to be cross-distribution and more secure compared to traditional packages. Snaps are available on many desktop and server distributions and eventually will be available for Ubuntu Touch.