前人未踏の領域へ WEB・インフラ・プログラミング全般編

フロントエンド、バックエンド、インフラ、言語など、アプリ開発、IOT以外の記録

Snappy Ubuntuを試す

Snappy Ubuntu Coreがリリースされたので、Vagrant上で起動してみる。それだけの記事。

Boxを探す

Ubuntu Snappyのイメージを探す。オフィシャルなものが2つほど見つかる。 ubuntu-15.04-snappy-core-stableというのが安定版のようなのでそちらを使うことにする。

Discover Vagrant Boxes | Atlas by HashiCorp

インストール、起動

$ cd [任意のディレクトリ]
$ vagrant init ubuntu/ubuntu-15.04-snappy-core-stable
...output 省略
$ vagrant up
...output 省略

これで起動した。

確認

SSHで接続してみる。

$ vagrant ssh
Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-15-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Welcome to snappy Ubuntu Core, a transactionally updated Ubuntu.

 * See https://ubuntu.com/snappy

It's a brave new world here in snappy Ubuntu Core! This machine
does not use apt-get or deb packages. Please see 'snappy --help'
for app installation and transactional updates.

apt-get はもう使わないんだぜとかいてある。 snappy --help 見ろというので確認してみることにしよう。

snappyコマンド

snappy コマンドを使って色々とやるらしい。

$ which snappy
/usr/bin/snappy
$ snappy --help
Usage:
  snappy [OPTIONS] <command>

Help Options:
  -h, --help  Show this help message

Available commands:
  booted              Flag that rootfs booted successfully
  build               Builds a snap package (aliases: bu)
  config              Set configuraion for a installed package.
  firstboot           internal
  hw-assign           Assign a hardware device to a package
  hw-info             List assigned hardware device for a package
  hw-unassign         Unassign a hardware device to a package
  info                Display a summary of key attributes of the snappy system.
  install             Install a snap package
  internal-run-hooks  internal
  internal-unpack     internal
  list                List active components installed on a snappy system (aliases: li)
  login               Log into the store
  purge               Remove all the data from the listed packages
  remove              Remove a snapp part
  rollback            Rollback to a previous version of a package
  search              Search for packages to install (aliases: se)
  set                 Set properties of system or package
  update              Update all installed parts
  versions            (deprecated) please use "list"

各コマンドのヘルプは snappy [command] --help で確認できる。

$ snappy list --help
Usage:
  snappy [OPTIONS] list [list-OPTIONS]

Provides a list of all active components installed on a snappy system

If requested, the command will find out if there are updates for any of the
components and indicate that by appending a * to the date. This will be slower as it requires a round trip to the app store on the network.

The
developer information refers to non-mainline versions of a package (much like PPAs in deb-based Ubuntu). If the package is the primary version of that
package in Ubuntu then the developer info is not shown. This allows one to identify packages which have custom, non-standard versions installed. As a
special case, the “sideload” developer refers to packages installed manually on the system.

When a verbose listing is requested, information
about the channel used is displayed; which is one of alpha, beta, rc or stable, and all fields are fully expanded too. In some cases, older (inactive)
versions of snappy packages will be installed, these will be shown in the verbose output and the active version indicated with a * appended to the
name of the component.

Help Options:
  -h, --help         Show this help message

[list command options]
      -u, --updates  Show available updates (requires network)
      -v, --verbose  Show channel information and expand all fields

snappy search

ストアか利用可能なパッケージを探すコマンド。

$ snappy search --help
Usage:
  snappy [OPTIONS] search [search-OPTIONS]

Query the store for available packages

Help Options:
  -h, --help          Show this help message
[search command options]
          --show-all  Show all available forks of a package

--show-all で全て表示してくれるっぽいので実行してみる。

$ snappy search --show-all
Name                     Version   Summary                        
crossbar.crossbar        0.10.4    Crossbar.io                    
gumstix-overo.ash        0.1       gumstix-overo                  
webcam-demo              1.0.1     webcam-demo                    
pi2.lool                 0.11      pi2                            
go-example-webserver     1.0.6     go-example-webserver           
config-example           1.0.5     config-example                 
pastebinit.mvo           1.4.0.0.2 pastebinit                     
hello-dbus-fwk.canonical 1.0.0     hello-dbus-fwk                 
docker                   1.6.0.003 Docker                         
8nzc1x4iim2xj1g2ul64     43        Returns for store credit only. 
system-status.victor     1.0.3     System status web portal       
webdm                    0.5       webdm                          
beagleblack              1.7       beagleblack                    
hello-world              1.0.14    hello-world                    
hello-world.jdstrand     1.5.1     hello-world                    
generic-amd64            1.1       generic-amd64                  
xkcd-webserver           0.4       xkcd-webserver              

dockerがいるな。Docker Imageで使用するためにSnappyを使おうと思っていたけどSnappy自身もDockerのホストとして使えるのか。 他には hello-worldgo-example-webserver あたりが気になったので入れてみる。

$ sudo snappy install docker
sudo: unable to resolve host ubuntu-core-stable-2
Installing docker
Starting download of docker
8.36 MB / 8.36 MB [==============================================================================================================] 100.00 % 79.07 KB/s 
Done
Name          Date       Version   Developer 
ubuntu-core   2015-04-23 2         ubuntu    
docker        2015-05-02 1.6.0.003           
generic-amd64 2015-04-23 1.1                 

sudoコマンドを使うとhost名解決ができないといって怒られるがインストールはできる。 上記3点を入れた後の状態。

$ snappy list
Name                 Date       Version   Developer 
ubuntu-core          2015-04-23 2         ubuntu    
docker               2015-05-02 1.6.0.003           
go-example-webserver 2015-05-02 1.0.6     canonical 
hello-world          2015-05-02 1.0.14    canonical 
generic-amd64        2015-04-23 1.1

とりあえずdocker入れたのであとはどうとでもなりそうだけど、 Snappy自体がなんのこっちゃか分かってないので続きはまた今度。

/* Responsive: yes */