Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

5.2. snap - Tool to interact with snaps

5.2.1. 安装 snap

		
[root@netkiller test]# yum info snapd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
Name        : snapd
Arch        : x86_64
Version     : 2.37.4
Release     : 2.el7
Size        : 14 M
Repo        : epel/x86_64
Summary     : A transactional software package manager
URL         : https://github.com/snapcore/snapd
License     : GPLv3
Description : Snappy is a modern, cross-distribution, transactional package manager
            : designed for working with self-contained, immutable packages.

[root@netkiller ~]# yum install -y snapd		
[root@netkiller ~]# systemctl enable --now snapd.socket
Created symlink from /etc/systemd/system/sockets.target.wants/snapd.socket to /usr/lib/systemd/system/snapd.socket.
[root@netkiller ~]# systemctl start snapd

[root@netkiller ~]# snap install hello-world
2019-03-09T11:44:14+08:00 INFO Waiting for restart...
hello-world 6.3 from Canonical✓ installed

[root@netkiller ~]# snap list
Name         Version    Rev   Tracking  Publisher   Notes
core         16-2.37.2  6405  stable    canonical✓  core
hello-world  6.3        27    stable    canonical✓  -
		
		

5.2.2. 列出已经安装的snap包

		
neo@ubuntu:~$ snap list
Name  Version    Rev   Tracking  Publisher   Notes
core  16-2.37.2  6405  stable    canonical✓  core
go    1.12       3318  stable    mwhudson    classic		
		
		

5.2.3. 搜索要安装的snap包

		
sudo snap find <text to search>		
		
		

5.2.4. 安装snap包

		
sudo snap install <snap name>
		
		

5.2.5. 更新snap包

更新snap包,如果你后面不加包的名字的话那就是更新所有的snap包

		
sudo snap refresh <snap name>		
		
		

5.2.6. 把一个包还原到以前安装的版本

		
sudo snap revert <snap name>		
		
		

5.2.7. 删除snap包

删除一个snap包

		
sudo snap remove <snap name>
		
		

5.2.8. 查询最近做的操作日志

		
$ snap changes		
		
		
		
neo@ubuntu:~$ snap changes
ID   Status  Spawn               Ready               Summary
2    Done    today at 11:11 CST  today at 12:15 CST  Install "go" snap
3    Done    today at 11:11 CST  today at 11:11 CST  Initialize device