aptでGCloud入れてみた。

GoogleCloudPlatformDataStoreflaskを利用してGAEでAPIを作れないかと色々と調べているものの前回作成した環境だと2020年1月サービス終了のpython2系環境に固定されちゃうんで嫌だなぁと思って、何か他にうまい手がないか調べたところ、
公式ではaptで入れられるらしいし
ここを調べるとpython2系と3系をpyenvで併存させられるみたいなので、こっちの
環境でgcloudを入れ直してみた。

■以下はコマンド

#pyenv設定
$ pyenv global 2.7.16 3.7.3
$ pyenv global
2.7.16
3.7.3
#CloudSDKインストール
$ export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
$ echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
$ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
$ sudo apt-get update && sudo apt-get -y install google-cloud-sdk google-cloud-sdk-app-engine-python google-cloud-sdk-app-engine-python-extras google-cloud-sdk-datastore-emulator google-cloud-sdk-pubsub-emulator google-cloud-sdk-cbt google-cloud-sdk-bigtable-emulator kubectl
#インストール後確認
$ gcloud --version
Google Cloud SDK 259.0.0
alpha 2019.08.16
app-engine-python 1.9.86
app-engine-python-extras 1.9.86
beta 2019.08.16
bigtable
bq 2.0.46
cbt
cloud-datastore-emulator 2.1.0
core 2019.08.16
gsutil 4.42
kubectl 2019.08.16
pubsub-emulator 2019.08.16


To take a quick anonymous survey, run:
  $ gcloud alpha survey
#インストールリスト確認
$ gcloud components list

Your current Cloud SDK version is: 259.0.0
The latest available version is: 259.0.0

lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x                                                 Components                                                 x
tqqqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqwqqqqqqqqqqu
x     Status    x                         Name                         x            ID            x   Size   x
tqqqqqqqqqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqnqqqqqqqqqqu
x Not Installed x App Engine Go Extensions                             x app-engine-go            x 56.6 MiB x
x Not Installed x Cloud Datalab Command Line Tool                      x datalab                  x  < 1 MiB x
x Not Installed x Cloud Datastore Emulator (Legacy)                    x gcd-emulator             x 38.1 MiB x
x Not Installed x Cloud Firestore Emulator                             x cloud-firestore-emulator x 36.7 MiB x
x Not Installed x Cloud SQL Proxy                                      x cloud_sql_proxy          x  3.8 MiB x
x Not Installed x Emulator Reverse Proxy                               x emulator-reverse-proxy   x 14.5 MiB x
x Not Installed x Google Cloud Build Local Builder                     x cloud-build-local        x  6.0 MiB x
x Not Installed x Google Container Registry's Docker credential helper x docker-credential-gcr    x  1.8 MiB x
x Not Installed x gcloud app Java Extensions                           x app-engine-java          x 85.9 MiB x
x Not Installed x gcloud app PHP Extensions                            x app-engine-php           x          x
x Installed     x BigQuery Command Line Tool                           x bq                       x  < 1 MiB x
x Installed     x Cloud Bigtable Command Line Tool                     x cbt                      x  7.4 MiB x
x Installed     x Cloud Bigtable Emulator                              x bigtable                 x  6.6 MiB x
x Installed     x Cloud Datastore Emulator                             x cloud-datastore-emulator x 18.4 MiB x
x Installed     x Cloud Pub/Sub Emulator                               x pubsub-emulator          x 34.8 MiB x
x Installed     x Cloud SDK Core Libraries                             x core                     x 11.4 MiB x
x Installed     x Cloud Storage Command Line Tool                      x gsutil                   x  3.6 MiB x
x Installed     x gcloud Alpha Commands                                x alpha                    x  < 1 MiB x
x Installed     x gcloud Beta Commands                                 x beta                     x  < 1 MiB x
x Installed     x gcloud app Python Extensions                         x app-engine-python        x  6.0 MiB x
x Installed     x gcloud app Python Extensions (Extra Libraries)       x app-engine-python-extras x 28.5 MiB x
x Installed     x kubectl                                              x kubectl                  x  < 1 MiB x
mqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqj
To install or remove components at your current SDK version [259.0.0], run:
  $ gcloud components install COMPONENT_ID
  $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [259.0.0], run:
  $ gcloud components update


pythonだと2.7系、python2でもpython2系でpython3使うときはpython3でないと
駄目なようだ。pipも同様にpip3じゃないとpython3環境のパッケージ更新できない様だ。
とりあえず何とかCloudSDKを使える環境にはなったのでDataStoreとGAEを使ってAPIサーバ作れるかどうかがネックですな。時間はかかるかもしれませんが何とか頑張りたい。
次回以降で頑張ってみたい。




コメント

このブログの人気の投稿

GASでGoogleDriveのサブフォルダとファイル一覧を出力する

証券外務員1種勉強(計算式暗記用メモ)

マクロ経済学(IS-LM分析)