Linuxディストリビューションを問わず動作するソフトウェアパッケージ「Snap」形式で配布されるアプリが増えています。GitHubなどでもsnapコマンドでの導入方法を案内しているページをよく見るようになってきました。
そこで、Snapを利用するために必要なツール「snapd」を、各ディストリビューションにインストールする方法をまとめます。debやrpmといったパッケージになっていないアプリや、より新しいバージョンのアプリがSnapで配布されていることもあります。もし、使いたいSnapがあるなら、以下の手順でsnapdをインストールしてください。
snapdインストール方法
Ubuntu
Ubuntu 16.04 LTS以降のUbuntuにはデフォルトでsnapdがインストールされています。
入っていなければ、以下のコマンドでインストールできます。
sudo apt -y install snapd Linux Mint
sudo apt install snapdDebian
sudo apt -y install snapdFedora
sudo dnf -y install snapd
sudo systemctl enable --now snapd.socket Arch Linux
sudo pacman -S snapd
sudo systemctl enable --now snapd.socketOpenSUSE
42.2:
sudo zypper addrepo http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_42.2/ snappy
sudo zypper install snapd
sudo systemctl enable --now snapd.socketTumbleweed(ローリングリリース版):
sudo zypper addrepo http://download.opensuse.org/repositories/system:/snappy/openSUSE_Tumbleweed/ snappy
sudo zypper install snapd
sudo systemctl enable --now snapd.socketインストール後のテスト
インストールしたら、snapコマンドが正しく動くか試してみましょう。以下のコマンドで、「hello」にマッチするSnapを検索できます。
snap find hello-worldマッチしたsnapの一覧が表示されれば問題ありません。次に、テスト用のSnap「hello」をインストールしてみましょう。
sudo snap install hello-world「hello」や「hello.universe」を実行して、以下のように出力されるか確認してみましょう。
$ hello-world
Hello, world!これで、snapをインストールできるようになりました。snapは、Webブラウザでhttps://uappexplorer.com/snapsを開いて検索することもできます。ただし、Snapsが便利な場合もあれば、普通にDEBやRPMといったパッケージで入れたほうがいいものもあります。Webや雑誌の記事などを参考に、どのSnapを使うのかを決めるのもいいでしょう。
Snap関連用語まとめ
Snappy、Snap、snapd、Snapcraftなど、なんだかややこしいですよね。なので、以下にまとめておきます。
Snappyはソフトウエアデプロイメント(配備)&パッケージ管理システムの名称です。
SnappyのパッケージをSnapと呼びます。
Snapのファイル形式はSnapフォーマットと呼ばれます。ファイルシステムになっていて、使用時にシステムにマウントされます。
snapdは、Snapを使うためのツールの名前です。このページでインストール方法を紹介したのがこれです。
Snapcraftは、プログラムをSnappy用にSnapフォーマットでSnapを作成するツールです。
英語圏の人たちにとっては分かりやすいのかもしれないですが、日本人にとっては似たような言葉が違う意味なので分かりにくいですね。
snapコマンドのヘルプ
$ snap --help
Usage:
snap [OPTIONS] <command>
Install, configure, refresh and remove snap packages. Snaps are
'universal' packages that work across many different Linux systems,
enabling secure distribution of the latest apps and utilities for
cloud, servers, desktops and the internet of things.
This is the CLI for snapd, a background service that takes care of
snaps on the system. Start with 'snap list' to see installed snaps.
Application Options:
--version Print the version and exit
Help Options:
-h, --help Show this help message
Available commands:
abort Abort a pending change
ack Adds an assertion to the system
alias Sets up a manual alias
aliases Lists aliases in the system
buy Buys a snap
changes List system changes
connect Connects a plug to a slot
disable Disables a snap in the system
disconnect Disconnects a plug from a slot
download Downloads the given snap
enable Enables a snap in the system
find Finds packages to install (aliases: search)
get Prints configuration options
help Help
info show detailed information about a snap
install Installs a snap to the system
interfaces Lists interfaces in the system
known Shows known assertions of the provided type
list List installed snaps
login Authenticates on snapd and the store
logout Log out of the store
prefer Prefer aliases from a snap and disable conflicts
refresh Refreshes a snap in the system
remove Removes a snap from the system
revert Reverts the given snap to the previous state
run Run the given snap command
set Changes configuration options
tasks List a change's tasks (aliases: change)
try Tests a snap in the system
unalias Unalias a manual alias or an entire snap
version Shows version details
watch Watch a change in progress
whoami Prints the email the user is logged in with.関連リンク
https://snapcraft.io/
https://snapcraft.io/docs/core/
https://build.snapcraft.io/
https://uappexplorer.com/snaps
https://www.ubuntu.com/desktop/snappy
コメント