当前位置: 代码迷 >> 综合 >> # 2020/09/20 #「Snappy」- 使用 snap 安装应用
  详细解决方案

# 2020/09/20 #「Snappy」- 使用 snap 安装应用

热度:49   发布时间:2024-02-20 20:37:35.0

安装应用

我们以安装 kubectl 命令为例:

第一步、先进行应用的搜索

# snap search kubectl
Name                  Version                Publisher              Notes    Summary
kubectl               1.18.8                 canonical?             classic  Command line client for controlling a Kubernetes cluster.
kubernetes-worker     0.0.1                  canonical?             -        A complete Kubernetes worker
kafkactl              1.11.0                 dwi-di                 -        A command-line interface for interaction with Apache Kafka
kubectl-eks           1.10.3                 canonical-cloud-snaps  classic  kubectl controls the Kubernetes cluster manager.
kubectl-iexec         v1.6.2-next            leetserve              -        plugin to interactively exec to a pod
client-keystone-auth  v1.14.0+git36.e163280  knobby                 -        Client plugin for kubectl to enable keystone authentication.
devoperator           1.5.1                  art-hens-teeth         classic  DevOps tools
kube-commander        0.2.1                  anatoly-rugalev        -        Browse your kubernetes clusters in a casual way

第二步、查看软件包信息,获取所有可用版本

# snap info kubectl                                              
name:      kubectl                                               
summary:   Command line client for controlling a Kubernetes cluster.
publisher: Canonical?                                            
store-url: https://snapcraft.io/kubectl                          
contact:   https://www.ubuntu.com/kubernetes                     
license:   Apache-2.0                                            
description: |                                                   kubectl is a command line client for running commands against Kubernetesclusters.                                                      For more information about kubectl, including syntax, descriptions of command operations, andcommon examples, see the [overview](https://kubernetes.io/docs/reference/kubectl/overview/). Fordetails about each command, including all the supported flags and subcommands, see the [kubectlreference                                                      documentation](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands/).
snap-id: ZgG2URycDgvxSVskfoZxn44uaRMw0iwe                        
channels:                                                        latest/stable:    1.18.8         2020-08-27 (1612) 10MB classiclatest/candidate: 1.18.8         2020-08-27 (1612) 10MB classiclatest/beta:      1.18.8         2020-08-27 (1612) 10MB classiclatest/edge:      1.18.8         2020-08-27 (1612) 10MB classic1.19/stable:      1.19.0         2020-08-27 (1623) 10MB classic1.19/candidate:   1.19.0         2020-08-27 (1623) 10MB classic1.19/beta:        1.19.0         2020-08-27 (1623) 10MB classic1.19/edge:        1.19.0         2020-08-27 (1623) 10MB classic1.18/stable:      1.18.8         2020-08-26 (1612) 10MB classic
...

第三步、安装应用(或特定版本)

# snap install kubectl --classic// 如果需要安装特定版本# snap install kubectl --classic --channel=1.18/stable

注意事项,是否使用 --classic 选项与应用程序权限有关,应用的 Snapcraft 主页或者错误信息会提示是否需要使用 --classic 选项。

相关链接

Installing the Snap Store app

参考文献

K4NZ / 使用 snap 安装应用
How to install snap packages behind web proxy on Ubuntu 16.04 - Ask Ubuntu
How to list all available versions of a snap which is not installed? - Ask Ubuntu
ubuntu - Install specific previous version of package using snap? - Unix & Linux Stack Exchange