Google compute engine 如何安装谷歌云SDK';计算引擎上的应用程序引擎python(Ubuntu 16.04)?
我想在计算引擎中使用Google Cloud SDK(包括应用程序引擎的Python扩展),这样我就可以在虚拟机中复制我的本地开发设置。即,在VM上运行本地Google compute engine 如何安装谷歌云SDK';计算引擎上的应用程序引擎python(Ubuntu 16.04)?,google-compute-engine,google-cloud-sdk,Google Compute Engine,Google Cloud Sdk,我想在计算引擎中使用Google Cloud SDK(包括应用程序引擎的Python扩展),这样我就可以在虚拟机中复制我的本地开发设置。即,在VM上运行本地dev_appserver.py和单元测试,或者将新的应用程序版本部署到Google app Engine 从默认的Ubuntu 16.04映像和(机器类型n1-standard-1)创建了一个新的VM实例后,我注意到gcloud已经预装 anh@ani-dev-2:~$ gcloud components list Your curren
dev_appserver.py
和单元测试,或者将新的应用程序版本部署到Google app Engine
从默认的Ubuntu 16.04映像和(机器类型n1-standard-1
)创建了一个新的VM实例后,我注意到gcloud
已经预装
anh@ani-dev-2:~$ gcloud components list
Your current Cloud SDK version is: 163.0.0
The latest available version is: 169.0.0
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Components │
├──────────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│ Status │ Name │ ID │ Size │
├──────────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Update Available │ BigQuery Command Line Tool │ bq │ < 1 MiB │
│ Update Available │ Cloud SDK Core Libraries │ core │ 6.7 MiB │
│ Update Available │ Cloud Storage Command Line Tool │ gsutil │ 3.0 MiB │
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 98.0 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 4.1 MiB │
│ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 3.5 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 15.4 MiB │
│ Not Installed │ Cloud Datastore Emulator (Legacy) │ gcd-emulator │ 38.1 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 33.2 MiB │
│ Not Installed │ Emulator Reverse Proxy │ emulator-reverse-proxy │ 14.5 MiB │
│ Not Installed │ Google Container Local Builder │ container-builder-local │ 3.7 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 2.2 MiB │
│ Not Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │
│ Not Installed │ gcloud Beta Commands │ beta │ < 1 MiB │
│ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 128.1 MiB │
│ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 6.5 MiB │
│ Not Installed │ kubectl │ kubectl │ 16.0 MiB │
│ Installed │ Default set of gcloud commands │ gcloud │ │
└──────────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
anh@ani-dev-2:~$ gcloud components list
Your current Cloud SDK version is: 169.0.0
The latest available version is: 169.0.0
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Components │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│ Status │ Name │ ID │ Size │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 98.0 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 4.1 MiB │
│ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 3.5 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 15.4 MiB │
│ Not Installed │ Cloud Datastore Emulator (Legacy) │ gcd-emulator │ 38.1 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 33.2 MiB │
│ Not Installed │ Emulator Reverse Proxy │ emulator-reverse-proxy │ 14.5 MiB │
│ Not Installed │ Google Container Local Builder │ container-builder-local │ 3.7 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 2.2 MiB │
│ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 128.1 MiB │
│ Not Installed │ kubectl │ kubectl │ 16.0 MiB │
│ Installed │ BigQuery Command Line Tool │ bq │ < 1 MiB │
│ Installed │ Cloud SDK Core Libraries │ core │ 6.7 MiB │
│ Installed │ Cloud Storage Command Line Tool │ gsutil │ 3.0 MiB │
│ Installed │ Default set of gcloud commands │ gcloud │ │
│ Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │
│ Installed │ gcloud Beta Commands │ beta │ < 1 MiB │
│ Installed │ gcloud app Python Extensions │ app-engine-python │ 6.5 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
据我所知,有其他可用的安装方法(yum、debian)和用于VM映像的deb,这就是组件管理器被禁用的原因:
anh@ani-dev-2:~$ dpkg -s google-cloud-sdk
Package: google-cloud-sdk
Status: install ok installed
Priority: optional
Section: partner/admin
Installed-Size: 93228
Maintainer: Canonical CPC Team <cpc@canonical.com>
Architecture: all
Version: 163.0.0-0ubuntu1~16.04.0
Depends: findutils, python2.7, python:any (>= 2.6.6-7~), python-crcmod, python-google-compute-engine
Conflicts: gsutils
Conffiles:
/etc/bash_completion.d/completion.bash.inc 860b91bfb6a0e6b513321ea6ca429e4c
Description: Google Cloud SDK for interacting with Google Cloud services.
The command-line tools for Google App Engine, Compute Engine,
Cloud Storage, BigQuery, Cloud SQL, and Cloud DNS are bundled as part of
the Cloud SDK.
.
This is a packaged distribution of the Google Cloud SDK. For up-to-date
versions please see https://developers.google.com/cloud/sdk.
Homepage: https://developers.google.com/cloud/sdk/
f1 micro
(或g1 small
)就足以满足我的需要。但是可能因为在较小的类型中VM共享CPU,所以我没有更改安装的权限。如果是这种情况,我是否应该像在Mac上那样,在我的用户文件夹中手动安装一个额外的自定义云SDK,例如$HOME/google Cloud SDK
f1 micro
(相同的VM图像)中执行相同步骤时的输出,我在两个新实例上尝试了两次:
anh@ani-dev-1:~$ sudo apt-get update && sudo apt-get install google-cloud-sdk
Hit:1 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:4 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial/main Sources [868 kB]
Get:5 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial/restricted Sources [4,808 B]
Get:6 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial/universe Sources [7,728 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:8 http://archive.canonical.com/ubuntu xenial InRelease
Get:9 http://packages.cloud.google.com/apt cloud-sdk-xenial InRelease [6,327 B]
Get:10 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial/multiverse Sources [179 kB]
Get:11 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/main Sources [273 kB]
Get:12 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/restricted Sources [3,400 B]
Get:13 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/universe Sources [171 kB]
Get:14 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/multiverse Sources [7,232 B]
Get:15 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [632 kB]
Get:16 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [261 kB]
Get:17 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [8,048 B]
Get:18 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en [2,688 B]
Get:19 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [529 kB]
Get:20 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [209 kB]
Get:21 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-backports/main Sources [3,396 B]
Get:22 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-backports/universe Sources [4,404 B]
Get:23 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4,884 B]
Get:24 http://packages.cloud.google.com/apt cloud-sdk-xenial/main amd64 Packages [9,625 B]
Get:25 http://security.ubuntu.com/ubuntu xenial-security/main Sources [90.1 kB]
Get:26 http://security.ubuntu.com/ubuntu xenial-security/restricted Sources [2,604 B]
Get:27 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [40.9 kB]
Get:28 http://security.ubuntu.com/ubuntu xenial-security/multiverse Sources [1,144 B]
Get:29 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [353 kB]
Get:30 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [154 kB]
Get:31 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [166 kB]
Get:32 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [86.8 kB]
Fetched 12.1 MB in 2s (4,922 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
google-cloud-sdk-app-engine-java google-cloud-sdk-app-engine-python google-cloud-sdk-pubsub-emulator
google-cloud-sdk-bigtable-emulator google-cloud-sdk-datastore-emulator kubectl
The following packages will be upgraded:
google-cloud-sdk
1 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
Need to get 13.8 MB of archives.
After this operation, 10.7 MB of additional disk space will be used.
Get:1 http://packages.cloud.google.com/apt cloud-sdk-xenial/main amd64 google-cloud-sdk all 169.0.0-0 [13.8 MB]
Fetched 13.8 MB in 1s (11.4 MB/s)
(Reading database ... 64568 files and directories currently installed.)
Preparing to unpack .../google-cloud-sdk_169.0.0-0_all.deb ...
Unpacking google-cloud-sdk (169.0.0-0) over (163.0.0-0ubuntu1~16.04.0) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up google-cloud-sdk (169.0.0-0) ...
Killed
dpkg: error processing package google-cloud-sdk (--configure):
subprocess installed post-installation script returned error exit status 137
E: Sub-process /usr/bin/dpkg returned an error code (1)
第2页
似乎安装进程在f1 micro中被终止的原因是某种内存不足错误。见:
及
但是,我可以用更大的机器类型来实现我的目标。是在Ubuntu/Debían系统中安装应用程序引擎组件的方法
如果这是VM中的重复安装,您可能需要编写一个启动脚本来执行此安装。或者将完成的安装保存为映像,具体取决于启动时间要求
关于共享处理器,这不会影响您的安装。谢谢。我将研究启动脚本和图像导入之间的区别。在我给这个答案打分之前,请你看一下我的附录“PS 1”。我曾尝试在f1 micro中执行同样的操作,但没有成功。因此,共享处理器只是多个独立VM映像之间的CPU节流,我仍然可以完全控制映像,对吗?
anh@ani-dev-1:~$ sudo apt-get update && sudo apt-get install google-cloud-sdk
Hit:1 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:4 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial/main Sources [868 kB]
Get:5 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial/restricted Sources [4,808 B]
Get:6 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial/universe Sources [7,728 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:8 http://archive.canonical.com/ubuntu xenial InRelease
Get:9 http://packages.cloud.google.com/apt cloud-sdk-xenial InRelease [6,327 B]
Get:10 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial/multiverse Sources [179 kB]
Get:11 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/main Sources [273 kB]
Get:12 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/restricted Sources [3,400 B]
Get:13 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/universe Sources [171 kB]
Get:14 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/multiverse Sources [7,232 B]
Get:15 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [632 kB]
Get:16 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [261 kB]
Get:17 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [8,048 B]
Get:18 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en [2,688 B]
Get:19 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [529 kB]
Get:20 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [209 kB]
Get:21 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-backports/main Sources [3,396 B]
Get:22 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-backports/universe Sources [4,404 B]
Get:23 http://us-east1.gce.archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4,884 B]
Get:24 http://packages.cloud.google.com/apt cloud-sdk-xenial/main amd64 Packages [9,625 B]
Get:25 http://security.ubuntu.com/ubuntu xenial-security/main Sources [90.1 kB]
Get:26 http://security.ubuntu.com/ubuntu xenial-security/restricted Sources [2,604 B]
Get:27 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [40.9 kB]
Get:28 http://security.ubuntu.com/ubuntu xenial-security/multiverse Sources [1,144 B]
Get:29 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [353 kB]
Get:30 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [154 kB]
Get:31 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [166 kB]
Get:32 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [86.8 kB]
Fetched 12.1 MB in 2s (4,922 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
google-cloud-sdk-app-engine-java google-cloud-sdk-app-engine-python google-cloud-sdk-pubsub-emulator
google-cloud-sdk-bigtable-emulator google-cloud-sdk-datastore-emulator kubectl
The following packages will be upgraded:
google-cloud-sdk
1 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
Need to get 13.8 MB of archives.
After this operation, 10.7 MB of additional disk space will be used.
Get:1 http://packages.cloud.google.com/apt cloud-sdk-xenial/main amd64 google-cloud-sdk all 169.0.0-0 [13.8 MB]
Fetched 13.8 MB in 1s (11.4 MB/s)
(Reading database ... 64568 files and directories currently installed.)
Preparing to unpack .../google-cloud-sdk_169.0.0-0_all.deb ...
Unpacking google-cloud-sdk (169.0.0-0) over (163.0.0-0ubuntu1~16.04.0) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up google-cloud-sdk (169.0.0-0) ...
Killed
dpkg: error processing package google-cloud-sdk (--configure):
subprocess installed post-installation script returned error exit status 137
E: Sub-process /usr/bin/dpkg returned an error code (1)