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

安装应用

我们以安装 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 Kubernetes
  clusters.                                                      
                                                                 
  For more information about kubectl, including syntax, descriptions of command operations, and
  common examples, see the [overview](https://kubernetes.io/docs/reference/kubectl/overview/). For
  details about each command, including all the supported flags and subcommands, see the [kubectl
  reference                                                      
  documentation](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands/).
snap-id: ZgG2URycDgvxSVskfoZxn44uaRMw0iwe                        
channels:                                                        
  latest/stable:    1.18.8         2020-08-27 (1612) 10MB classic
  latest/candidate: 1.18.8         2020-08-27 (1612) 10MB classic
  latest/beta:      1.18.8         2020-08-27 (1612) 10MB classic
  latest/edge:      1.18.8         2020-08-27 (1612) 10MB classic
  1.19/stable:      1.19.0         2020-08-27 (1623) 10MB classic
  1.19/candidate:   1.19.0         2020-08-27 (1623) 10MB classic
  1.19/beta:        1.19.0         2020-08-27 (1623) 10MB classic
  1.19/edge:        1.19.0         2020-08-27 (1623) 10MB classic
  1.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

猜你喜欢

转载自blog.csdn.net/u013670453/article/details/108703954