Gcloud install mac os

linux-notes.org

Установка Google Cloud SDK/gcloud в Unix/Linux

Google Cloud SDK — Это набор библиотек, который предоставляет google для работы со своим облаком.

gcloud — Утилита, которая позволяет работать с облаком.

Установка Google Cloud SDK/gcloud в Mac OS X

Имеется пару способов как поставить данное SDK.

-=== СПОСОБ 1 ===-

Скачиваем пакет с официального сайта (например):

Как по мне, ребята с гугла хрень написали! Google SDK ставится в хомяк. Нахрен он мне там?

Можно конечно перекинуть данный архив в другое место и поправить пути в

/.bash_profile, но много работы.

-=== СПОСОБ 2 ===-

Можно использовать готовый скрипт с официального сайта:

Тоже фигня! Ставит в хомяк!

-=== СПОСОБ 3 ===-

Использовать Brew, но для начала установим homebrew, и потом, выполняем:

Самый простой и лучший ваиант установки!

Установка Google Cloud SDK/gcloud в Linux

Для установки сойдет 1 или 2-й варианты, которые я описывал для Mac OS X.

-=== СПОСОБ 1 ===-

Скачиваем пакет с официального сайта (например):

Как по мне, ребята с гугла хрень написали! Google SDK ставится в хомяк. Нахрен он мне там?

Можно конечно перекинуть данный архив в другое место и поправить пути в

/.bash_profile, но много работы.

-=== СПОСОБ 2 ===-

Можно использовать готовый скрипт с официального сайта:

Тоже фигня! Ставит в хомяк!

-=== СПОСОБ 3 ===-

Можно еще поставить репозиторий и через него установить.

Установка Google Cloud SDK/gcloud в CentOS/RedHat.

PS: Можно поставить вспомогательные компоненты:

Установка Google Cloud SDK/gcloud в Debian/Ubuntu.

Создайте переменную окружения (ENV) для правильного распространения:

PS: Если у вас установлен «apt-transport-https» пакет, вы можете использовать «https» вместо «http» на этом шаге.

Импортируем паблик ключ:

Можно поставить дополнительные компоненты:

Перейдем к настройке.

Настройка Google Cloud SDK/gcloud в Unix/Linux

После установки google SDK, нужно инициализировать проект:

Следуем инструкциям и настраиваем инициализацию.

Использование Google Cloud SDK/gcloud в Unix/Linux

Чтобы просмотреть аккаунты для авторизации, используйте:

Создаем авторизацию по уолчанию:

Для того, чтобы посмотреть конфигурационный, выполните:

Для получения полной информации, можно заюзать:

Получить инфо и много другой полезной информации:

Получить список всех ваших билибл аккаунтов:

Сетапаем SSH доступ для аккаунта:

Можно просмотреть IAM политики\роли следующим образом:

  • terraform-2018 — Это название моего проекта.

Или, вот еще полезная команда:

Или, jтображение в ‘сплющенном формате’:

Смотрим какой используется проект:

Проверяем созданный ключ:

Смотрим пермишены по проекту:

Создаем виртуальную машину:

Чтобы получить помощь, используйте:

Помощь понятная и простая. Можно использовать ее вот так:

Чтоы посмотреть пермишены:

Создаем сервис аккаунт, следующим образом:

  • terraform — Название юзера.
  • /Users/captain/.config/gcloud/creds/terraform_creds.json — Путь куда сохранится файл.
  • terraform-2018 — название проекта.

Предоставьте разрешение учетной записи службы для просмотра проекта Admin и управления облачным хранилищем:

Читайте также:  Как узнать свою файловую систему линукс

Любые действия, которые выполняються через Terraform, требуют, чтобы API был включен, например:

Вот и все, статья «Установка Google Cloud SDK/gcloud в Unix/Linux» завершена.

Источник

Install & Configure gcloud CLI on Mac

Aug 22, 2019 · 3 min read

gcloud CLI is a very powerful CLI tool to interact directly with the GCP API. From their definition page:

What is the gcloud command-line tool?

The gcloud command-line interface is a tool that provides the primary CLI to Google Cloud Platform. You can use this tool to perform many common platform tasks either from the command-line or in scripts and other automations.

For example, you can use the gcloud CLI to create and manage:

  • Google Compute Engine virtual machine instances and other resources
  • Google Cloud SQL instances
  • Google Kubernetes Engine clusters
  • Google Cloud Dataproc clusters and jobs
  • Google Cloud DNS managed zones and record sets
  • Google Cloud Deployment manager deployments

You can also use the gcloud CLI to deploy App Engine applications and perform other tasks.

Prerequisites

  1. A configured GCP Project
  2. Python installed on your Mac

Install and Initialize

gcloud CLI comes in a zip file (tar.gz), if you are running 32 bit OS then download it from here or for 64 bit OS download it from here. Extract it somewhere from where you need to start the installation.

After you extract the binary, run the install script.

Now that you have gcloud cli installed, you need to initialize it.

By default, it will use browser mode to get your authentication token. Provide that during the installation. You will be asked to pick your current project, default compute zone. Once you provide all these inputs, it will show you the output like this:

Test the CLI

Check whether you can list your accounts, see the configuration that you have specified during initialization etc. to see if everything is configured correctly.

Источник

What is gcloud and How to install on Windows, macOS and Linux?

Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.

gcloud is the primary CLI tool to work with Google Cloud resources.

Using CLI tools offers automation options with easy-to-build scripts, which otherwise is not possible if you rely exclusively on the cloud provider’s web interface only.

With gcloud CLI, you can create, modify and delete various types of Google Cloud resources like Google Compute Engine virtual machines, Google Cloud SQL instances, Google Kubernetes Engine clusters, Google Cloud DNS, and Google Cloud Deployment Manager.

Further, it can be used to deploy App Engine applications, manage authentication to cloud resources, customize resource configuration, and various such administrative tasks.

Google Cloud gives you the option to open a shell with gcloud CLI already available and configured to use with your cloud account.

Click on the shell icon on the top right telling Activate Cloud Shell to access gcloud CLI from a web browser. This will open a shell window at the bottom.

Читайте также:  Curl windows post json

But if you want to use gcloud to manage your Google Cloud account directly from your system, you must install it first. In this article, we’ll be covering the installation of gcloud CLI on Windows, macOS, and Linux as part of the Google Cloud SDK setup.

Windows

Windows installation binaries are available to set up gcloud SDK, which includes gcloud CLI. You can download the latest package of Cloud SDK installer here. Or else you can open a PowerShell terminal and input the below commands to download the installer and launch it.

Once launched, follow the on-screen wizard to finish the installation.

Cloud SDK requires Python, and the dependencies are bundled with the installer. So you can use default options at every step of the installation wizard unless you have a specific requirement to change installation components or location etc.

You’ll be finally prompted with options to create useful shortcuts and initialize gcloud to configure it to use it with your Google Cloud account. Simply follow on-screen instructions, which will launch a login screen using the default browser. Once logged in, the shell will ask you to select the default project and region to use with gcloud CLI. Once ready, you can run gcloud commands from Windows Command Prompt.

Default SDK install doesn’t include some extra components like App Engine extensions, which you can separately install using Cloud SDK component manager. The components include by default with SDK are:

ID Name Description
gcloud Default gcloud CLI Commands Tool for interacting with Google Cloud. Only commands at the General Availability and Preview release levels are installed with this component. You must separately install the gcloud alpha Commands and/or gcloud beta Commands components if you want to use commands at other release levels.
bq BigQuery Command-Line Tool Tool for working with data in Google BigQuery
gsutil Cloud Storage Command-Line Tool Tool for performing tasks related to Google Cloud Storage.
core Cloud SDK Core Libraries Libraries are used internally by the SDK tools.

macOS

gcloud SDK requires Python to work and should be installed on your macOS for gcloud CLI to function.

Modern macOS should include the required version of Python by default. There’s an option to use Cloud SDK bundled with Python 3 to install the required dependencies along with gcloud CLI. You can check the version of python on your macOS by opening a terminal and running python -V

Then run uname -m and determine the machine hardware of your system.

Based on your machine architecture, choose the right package to download. At the time of writing this article, gcloud 346.x version is available.

Platform Package Size SHA256 Checksum
macOS 64-bit(x86_64) google-cloud-sdk-346.0.0-darwin-x86_64.tar.gz 86.5 MB 632164280208c050f015c9d04fa805c05478e80518a0fe667b413df55ab926ee
macOS 64-bit(arm64) google-cloud-sdk-346.0.0-darwin-arm.tar.gz 86.4 MB 707948f45c8cc01012a92e3aff8af3701a89777bccdeec905310f70951c75bdb
macOS 64-bit with bundled Python(x86_64) google-cloud-sdk-346.0.0-darwin-x86_64-bundled-python.tar.gz 128.4 MB a31d67193ca21bf6943c275c633f3f5bf11c8526f47808f13a3c516df2e7aae3
macOS 32-bit(x86) google-cloud-sdk-346.0.0-darwin-x86.tar.gz 90.3 MB 85493c0c5aba8fce9f8e7d1886bc0916db44bd0847cbf862cf87435fc8d729ff

You can then simply extract the compressed TAR archive to your preferred location, likely somewhere inside your home directory. To add the cloud SDK tools to your PATH and command completion for your shell, run the below script from the root of the extracted directory:

Proceed to initialize the SDK using:

Additional components can be installed for your cloud SDK using component manager.

RHEL/CentOS

On an RHEL/Fedora/CentOS-based system, you can install from the Google Cloud SDK’s yum repositories.

It is available in package format for installation on Red Hat Enterprise Linux 7, Red Hat Enterprise Linux 8, Fedora 33, and CentOS 7 and 8 systems. This package contains the gcloud , gcloud alpha , gcloud beta , gsutil , and bq commands only. It does not include kubectl or the App Engine extensions required to deploy an application using gcloud commands, which can be installed separately.

To install using dnf utility, first, add the Cloud SDK repo by running below in a terminal:

Then install the Cloud SDK using:

Below are the additional components of Cloud SDK that can be optionally installed based on need:

  • google-cloud-sdk-app-engine-python
  • google-cloud-sdk-app-engine-python-extras
  • google-cloud-sdk-app-engine-java
  • google-cloud-sdk-app-engine-go
  • google-cloud-sdk-bigtable-emulator
  • google-cloud-sdk-cbt
  • google-cloud-sdk-cloud-build-local
  • google-cloud-sdk-datalab
  • google-cloud-sdk-datastore-emulator
  • google-cloud-sdk-firestore-emulator
  • google-cloud-sdk-pubsub-emulator
  • kubectl

As an example, to install google — cloud — sdk — app — engine — java , use:

To initialize and configure gcloud with your Google Cloud account, run the below command and follow the instructions:

Debian/Ubuntu

Similarly, for Debian and Ubuntu-based systems, Cloud SDK is available in package format as well. Again, this package contains the gcloud , gcloud alpha , gcloud beta , gsutil , and bq commands only. It does not include kubectl or the App Engine extensions required to deploy an application using gcloud commands. If you want these components, you must install them separately.

As a prerequisite for Debian/Ubuntu installations, ensure that the Ubuntu release you’re on has not reached end-of-life. If you’re on Debian, make sure you’re on Debian’s stable release from Wheezy forward.

To proceed with Cloud SDK installation, first, add the distribution URI as a package source:

Make sure you’ve the below packages installed:

Import the Google Cloud public key:

Finally, update and install the Cloud SDK:

Any of the below components can be optionally installed over and above the base Cloud SDK setup:

  • google-cloud-sdk-app-engine-python
  • google-cloud-sdk-app-engine-python-extras
  • google-cloud-sdk-app-engine-java
  • google-cloud-sdk-app-engine-go
  • google-cloud-sdk-bigtable-emulator
  • google-cloud-sdk-cbt
  • google-cloud-sdk-cloud-build-local
  • google-cloud-sdk-datalab
  • google-cloud-sdk-datastore-emulator
  • google-cloud-sdk-firestore-emulator
  • google-cloud-sdk-pubsub-emulator
  • kubectl

To do that, install the required component using below apt-get command:

Now you’re ready to initialize gcloud using:

Follow the on-screen instructions to connect your Google Cloud account and configure the default options.

Summary

Like AWS CLI, Google Cloud offers a CLI tool to manage the Google Cloud infrastructure. This helps in doing some repetitive tasks faster and offers an opportunity to write scripts and automation tools, paving the way towards Infrastructure-as-Code (IaC).

Источник

Читайте также:  Настройка работы windows server 2012
Оцените статью