首页 > 解决方案 > 在 Ubuntu 上安装 Google Cloud SDK 时出错,如何解决?

问题描述

我正在尝试设置 Google Cloud SDK CLI 来管理一些计算资源,而我只是按照这部分的指南进行操作。我运行了这个命令,它成功安装了很多东西,但遇到了下面的问题。谁能提出解决方案或如何调试?

$ sudo apt-get update && sudo apt-get install google-cloud-sdk                                   
[sudo] password for #######:                                                                                              
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease                                                                  
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB]                                                         
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]                                                   
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]                                              
Get:5 https://packages.cloud.google.com/apt cloud-sdk InRelease [6349 B]                                                
Ign:6 http://packages.cloud.google.com/apt cloud-sdk-focal InRelease                                                    
Err:7 http://packages.cloud.google.com/apt cloud-sdk-focal Release                                                        
404  Not Found [IP: 216.58.204.238 80]                                                                                
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [255 kB]                                       
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [7492 B]                                 
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [132 kB]                                  
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [4732 B]                            
Reading package lists... Done                                                                                           
E: The repository 'http://packages.cloud.google.com/apt cloud-sdk-focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.   

标签: google-cloud-sdk

解决方案


我在 Ubuntu 20 上遇到了同样的问题。解决方案是使用 snap 安装。

snap install google-cloud-sdk --classic

确保你有--classic最后,否则你会得到这个错误:

错误:快照“google-cloud-sdk”的此修订版是使用经典限制发布的,因此可能会在快照通常受限的安全沙箱之外执行任意系统更改,这可能会使您的系统面临风险。如果您理解并想继续,请重复包括 --classic 在内的命令。


推荐阅读