Snap簡介
Snap 是 Canonical 開發的包管理系統,默認安裝於 Ubuntu 16.04 及其後的發行版本中。
優勢:
自包含:不受限於發行版的系統庫版本,且每個包之間不存在運行庫依賴。
只讀掛載:應用程序不能修改或刪除,且不會污染系統應用程序或庫。
回退:內置回退舊版本。
快照:內置備份和恢復應用數據。
版本新:相比發行版更新緩慢,其應用程序版本都比較新。
缺點主要為安裝包佔用較多存儲空間。如果您正在運行Ubuntu 16.04 LTS或更高版本,您可以在命令行中使用snap。
列出計算機上所有snap安裝情況:
sudo snap list
在應用商店中查找snap:
sudo snap find <snapname>
搜尋snap包
snap search <snapname>
安裝Snap軟件:
sudo snap install <snapname>
指定安裝版本:
$ snap info node name: node summary: Node.js publisher: NodeSource, Inc. (nodesource✓) store-url: https://snapcraft.io/node contact: https://github.com/nodesource/distributions license: MIT description: | A JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. https://nodejs.org/ snap-id: MEd4V4HHFkCXBSz6UzVmKF2D2PmWcVwR channels: latest/stable: – latest/candidate: – latest/beta: – latest/edge: 15.0.0-nightly202005078607f9ec 2020-05-07 (2716) 30MB classic 14/stable: 14.2.0 2020-05-05 (2710) 30MB classic 14/candidate: ↑ 14/beta: ↑ 14/edge: ↑ 13/stable: 13.14.0 2020-04-29 (2690) 29MB classic 13/candidate: ↑ 13/beta: ↑ 13/edge: ↑ 12/stable: 12.16.3 2020-04-28 (2680) 21MB classic 12/candidate: ↑ 12/beta: ↑ 12/edge: ↑ 11/stable: 11.15.0 2019-06-26 (2336) 19MB classic 11/candidate: ↑ 11/beta: ↑ 11/edge: ↑ 10/stable: 10.20.1 2020-04-23 (2638) 20MB classic 10/candidate: ↑ 10/beta: ↑ 10/edge: ↑ 9/stable: 9.11.2 2018-12-14 (1407) 17MB classic 9/candidate: ↑ 9/beta: ↑ 9/edge: ↑ 8/stable: 8.16.0 2019-06-24 (2310) 16MB classic 8/candidate: ↑ 8/beta: ↑ 8/edge: ↑ 6/stable: 6.17.1 2019-06-24 (2311) 13MB classic 6/candidate: ↑ 6/beta: ↑ 6/edge: ↑ $ sudo snap install node --channel=13/stable --classic
安裝edge或bate版本
sudo snap install <snapname> --edge sudo snap install <snapname> --beta --classic
更新Snap軟件:
sudo snap refresh <snapname>
更新所有的snap軟件包:
sudo snap refresh all
要將Snap還原到以前安裝的版本:
sudo snap revert <snapname>
卸載snap軟件:
sudo snap remove <snapname>