Ubuntu中snap包的安装,删除,更新使用入门教程

2020-09-01 0 439 百度已收录

概述

什么是snap,snap安装包是Canonical公司发布的全新的软件包管理方式,它类似一个容器拥有一个应用程序所有的文件和库,各个应用程序之间完全独立。所以使用snap包的好处就是它解决了应用程序之间的依赖问题,使应用程序之间更容易管理。但是由此带来的问题就是它占用更多磁盘空间

snap应用可以安装同样一个软件的不同版本(比如一个安装Python 2.7,另外一个应用安装Python 3.3)而不造成任何的干扰理论上一个snap应用可以安装到任何一个Linux的发行版上,因为它不依赖于操作系统及其发布版本.

Snap的安装包扩展名是.snap,类似于一个容器,它包含一个应用程序需要用到的所有文件和库(snap包包含一个私有的root文件系统,里面包含了依赖的软件包)。它们会被安装到单独的目录;各个应用程序之间相互隔离。使用snap有很多好处,首先它解决了软件包的依赖问题;其次,也使应用程序更容易管理。

Ubuntu中snap包的安装,删除,更新使用入门教程

现在支持snap的应用已经越来越多了,snap软件包一般安装在/snap目录下

一些常用命令

其实使用snap包很简单,下面我来介绍一下一些常用的命令

列出已经安装的snap包

sudo snap list

Ubuntu中snap包的安装,删除,更新使用入门教程

搜索要安装的snap包

sudo snap find <text to search>

Ubuntu中snap包的安装,删除,更新使用入门教程

安装一个snap包

sudo snap install <snap name>

Ubuntu中snap包的安装,删除,更新使用入门教程

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

sudo snap refresh <snap name>

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

sudo snap revert <snap name>

删除一个snap包

sudo snap remove <snap name>

Ubuntu中snap包的安装,删除,更新使用入门教程

简单的使用

下面我就安装一个编辑器来演示怎么安装删除一个软件包

首先我想安装hello-world

那么先找一下有没有hello-world

Ubuntu中snap包的安装,删除,更新使用入门教程

linuxidc@linuxidc:~$ snap search hello-world
Name                      Version  Developer  Notes    Summary
hello-world              6.3      canonical  –        The ‘hello-world’ of snaps
hello-world-om26er        0.2      om26er    –        A great snap
test-snapd-hello-classic  1.0      canonical  classic  A hello-world with classic confinement
hello-lhc                1.0      cprov      –        Hello world application for LHC☂
linuxidc@linuxidc:~$

没错有,那么我们就来安装

linuxidc@linuxidc:~$ snap install hello-world
hello-world 6.3 from ‘canonical’ installed

接着我们看一下有没有安装好

linuxidc@linuxidc:~$ snap list
Name                  Version    Rev  Tracking  Developer  Notes
communitheme          0.1        246  stable    didrocks  –
core                  16-2.32.6  4571  stable    canonical  core
firefox              59.0.2-1  71    stable    mozilla    –
gnome-3-26-1604      3.26.0    64    stable/…  canonical  –
gnome-calculator      3.28.1    167  stable/…  canonical  –
gnome-characters      3.28.0    86    stable/…  canonical  –
gnome-logs            3.28.0    31    stable/…  canonical  –
gnome-system-monitor  3.26.0    39    stable/…  canonical  –
hello-world          6.3        27    stable    canonical  –
snapcraft            2.42      1500  stable    canonical  classic
linuxidc@linuxidc:~$

最后我们删除它

linuxidc@linuxidc:~$ snap remove hello-world
hello-world removed

Ubuntu中snap包的安装,删除,更新使用入门教程

snap包的地址

如果你不知道可以下载什么snap包,你可以在下面的地址下载snap包来安装
https://uappexplorer.com/snaps

一个报错

因为安装douban-fm的时候时间太长了,我就终止了一下这个操作,之后再次安装这个包的时候就报了一个错误

linuxidc@linuxidc:~$ snap install Ubuntu-calculator-app
error: cannot install “ubuntu-calculator-app”: snap “ubuntu-calculator-app” has
      “install-snap” change in progress
linuxidc@linuxidc:~$

Ubuntu中snap包的安装,删除,更新使用入门教程

解决方式很简单

首先查看一下正在进行的change

linuxidc@linuxidc:~$ snap change
ID  Status  Spawn                Ready                Summary
12  Done    2018-05-14T02:49:05Z  2018-05-14T02:57:04Z  Auto-refresh snaps “gnome-3-26-1604”, “communitheme”
13  Done    2018-05-14T02:50:23Z  2018-05-14T02:50:37Z  Remove “firefox” snap
14  Done    2018-05-14T02:52:19Z  2018-05-14T02:53:00Z  Install “firefox” snap
15  Done    2018-05-14T02:55:04Z  2018-05-14T02:55:14Z  Install “hello-world” snap
16  Done    2018-05-14T02:58:30Z  2018-05-14T02:58:34Z  Remove “hello-world” snap
17   Error    2018-05-14T03:02:28Z  2018-05-14T03:03:01Z  Install “ubuntu-calculator-app” snap
18  Done    2018-05-14T03:47:37Z  2018-05-14T03:48:19Z  Install “john-the-ripper” snap

没错install ubuntu-calculator-app在doing中,所以要终止这个进程

linuxidc@linuxidc:~$ snap changes
ID  Status  Spawn                Ready                Summary
12  Done    2018-05-14T02:49:05Z  2018-05-14T02:57:04Z  Auto-refresh snaps “gnome-3-26-1604”, “communitheme”
13  Done    2018-05-14T02:50:23Z  2018-05-14T02:50:37Z  Remove “firefox” snap
14  Done    2018-05-14T02:52:19Z  2018-05-14T02:53:00Z  Install “firefox” snap
15  Done    2018-05-14T02:55:04Z  2018-05-14T02:55:14Z  Install “hello-world” snap
16  Done    2018-05-14T02:58:30Z  2018-05-14T02:58:34Z  Remove “hello-world” snap
17   Error    2018-05-14T03:02:28Z  2018-05-14T03:03:01Z  Install “ubuntu-calculator-app” snap
18  Done    2018-05-14T03:47:37Z  2018-05-14T03:48:19Z  Install “john-the-ripper” snap

之后再次执行安装就好

查询最近做的操作

$ snap changes

关于snap更多信息,查看man手册:

$ man snap

Ubuntu中snap包的安装,删除,更新使用入门教程

update:现在Snap可以在大多数Linux发行版上使用,极大的简化了Linux软件的安装。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对Linux公社的支持。

本文永久更新链接地址:https://www.linuxidc.com/Linux/2018-05/152385.htm

Ubuntu中snap包的安装,删除,更新使用入门教程

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

栗子博客 软件 Ubuntu中snap包的安装,删除,更新使用入门教程 https://www.lizi.tw/soft/9138.html

常见问题
  • 1、杰齐1.7仅适用于PHP5.2 2、需Zend支持 3、尽量使用宝塔面板 4、尽量使用Windows 系统,关关对Linux支持不太友好。
查看详情

相关文章

评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务

Ubuntu中snap包的安装,删除,更新使用入门教程-海报

分享本文封面