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

您所在的位置:网站首页 在哪里找卸载的软件安装包 Ubuntu中snap包的安装,删除,更新使用入门教程

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

2024-03-19 07:45| 来源: 网络整理| 查看: 265

概述

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

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

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

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

一些常用的命令

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

列出已经安装的snap包

sudo snap list

搜索要安装的snap包

sudo snap find

安装一个snap包

sudo snap install

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

sudo snap refresh

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

sudo snap revert

删除一个snap包

sudo snap remove

简单的使用

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

首先我想安装hello-world

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

linuxidc@linuxidc:~$ snap search hello-worldName                      Version  Developer  Notes    Summaryhello-world              6.3      canonical  -        The 'hello-world' of snapshello-world-om26er        0.2      om26er    -        A great snaptest-snapd-hello-classic  1.0      canonical  classic  A hello-world with classic confinementhello-lhc                1.0      cprov      -        Hello world application for LHC☂linuxidc@linuxidc:~$

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

linuxidc@linuxidc:~$ snap install hello-worldhello-world 6.3 from 'canonical' installed

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

linuxidc@linuxidc:~$ snap listName                  Version    Rev  Tracking  Developer  Notescommunitheme          0.1        246  stable    didrocks  -core                  16-2.32.6  4571  stable    canonical  corefirefox              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  classiclinuxidc@linuxidc:~$

最后我们删除它

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

snap包的地址

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

一个报错

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

linuxidc@linuxidc:~$ snap install Ubuntu-calculator-apperror: cannot install "ubuntu-calculator-app": snap "ubuntu-calculator-app" has      "install-snap" change in progresslinuxidc@linuxidc:~$

解决方式很简单

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

linuxidc@linuxidc:~$ snap changeID  Status  Spawn                Ready                Summary12  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" snap14  Done    2018-05-14T02:52:19Z  2018-05-14T02:53:00Z  Install "firefox" snap15  Done    2018-05-14T02:55:04Z  2018-05-14T02:55:14Z  Install "hello-world" snap16  Done    2018-05-14T02:58:30Z  2018-05-14T02:58:34Z  Remove "hello-world" snap17   Error    2018-05-14T03:02:28Z  2018-05-14T03:03:01Z  Install "ubuntu-calculator-app" snap18  Done    2018-05-14T03:47:37Z  2018-05-14T03:48:19Z  Install "john-the-ripper" snap

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

linuxidc@linuxidc:~$ snap changesID  Status  Spawn                Ready                Summary12  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" snap14  Done    2018-05-14T02:52:19Z  2018-05-14T02:53:00Z  Install "firefox" snap15  Done    2018-05-14T02:55:04Z  2018-05-14T02:55:14Z  Install "hello-world" snap16  Done    2018-05-14T02:58:30Z  2018-05-14T02:58:34Z  Remove "hello-world" snap17   Error    2018-05-14T03:02:28Z  2018-05-14T03:03:01Z  Install "ubuntu-calculator-app" snap18  Done    2018-05-14T03:47:37Z  2018-05-14T03:48:19Z  Install "john-the-ripper" snap

之后再次执行安装就好了

查询最近做的操作

$ snap changes

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

$ man snap

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

总结

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

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



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3