Artigos‎ > ‎Cloud‎ > ‎Google Compute Engine‎ > ‎

Installing gcutil and gsutil


Primeiramente gostaria de salientar que não sou o autor principal do conteúdo deste artigo. A minha intenção é de mostrar o que outros autores tem realizado (referenciando links para o conteúdo original) neste blog até como um guia pessoal para uso próprio e ainda compartilhar minhas anotações e pequenas modificações que realizo no conteúdo, desejando que possa ajudar mais alguém em algum lugar.
First and foremost, I take no credit for any of this post’s content. I am really just taking what others have done (which I have links to bellow) and am putting it on my blog for a personal reference and hopefully the small changes that I made to their guides will help someone somewhere.


Install GCUTIL

link: https://developers.google.com/compute/docs/gcutil/#install

Using cygwin:
wget https://google-compute-engine-tools.googlecode.com/files/gcutil-1.9.1.tar.gz
tar xzvpf gcutil-1.9.1.tar.gz -C /opt/
rm gcutil-1.9.1.tar.gz
rm -rf /opt/gcutil
mv -Tf /opt/gcutil-1.9.1/. /opt/gcutil

Using ubuntu:

wget https://google-compute-engine-tools.googlecode.com/files/gcutil-1.9.1.tar.gz
sudo mkdir -p /usr/local/share/google
sudo tar xzvpf gcutil-1.9.1.tar.gz -C /usr/local/share/google/
sudo rm gcutil-1.9.1.tar.gz 
sudo rm -rf /usr/local/share/google/gcutil 
sudo mv /usr/local/share/google/gcutil-1.9.1 /usr/local/share/google/gcutil
sudo rm -f /usr/local/bin/gcutil
sudo ln -s /usr/local/share/google/gcutil/gcutil /usr/local/bin/gcutil


Install GSUTIL


Using cygwin

wget http://storage.googleapis.com/pub/gsutil.tar.gz
rm -rf /opt/gsutil
tar xfz gsutil.tar.gz -C /opt/
rm gsutil.tar.gz
gsutil update


Using ubuntu

wget http://storage.googleapis.com/pub/gsutil.tar.gz
sudo mkdir -p /usr/local/share/google
sudo rm -rf /usr/local/share/google/gsutil
sudo tar xfz gsutil.tar.gz -C /usr/local/share/google/
sudo rm gsutil.tar.gz
sudo rm -f /usr/local/bin/gsutil
sudo ln -s /usr/local/share/google/gsutil/gsutil /usr/local/bin/gsutil
sudo gsutil update

Add to system path when using Cygwin

nano $HOME/.bashrc

export JAVA_HOME=/cygdrive/c/Program\ Files\ \(x86\)/Java/jre6
export PATH=$PATH:/opt/gcutil:/opt/gsutil:/opt/google_sql_tool:$JAVA_HOME/bin
export PYTHONPATH=$PYTHONPATH:/opt/gsutil/third_party/boto:/opt/gsutil

source $HOME/.bashrc

Installing Google Cloud SDK

using cygwin:


TODO: install java ....

wget http://dl.google.com/cloudsql/tools/google_sql_tool.zip
unzip google_sql_tool.zip -d /opt/google_sql_tool/
rm google_sql_tool.zip
chmod u+x /opt/google_sql_tool/google_sql.sh

Adjust script to run inside cygwin:
chmod 777 /opt/google_sql_tool/google_sql.sh
nano /opt/google_sql_tool/google_sql.sh

#!/bin/sh
#
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Google SQL Service command line tool.
# Examples:
#   $0 instance [database]

SQL_SH_DIR="$(cd $(dirname $0); pwd)"
#JAR="${SQL_SH_DIR}/./google_sql.jar"
JAR="C:\cygwin\opt\google_sql_tool\google_sql.jar"
JAVA="${JAVA_HOME}/bin/java"

die() {
  echo $1
  exit 2
}

main() {
  if [ ! -x "${JAVA}" ]; then
    JAVA=$(command -v "java")
  fi
  [ -x "${JAVA}" ] || die "Unable to find JVM. Please set JAVA_HOME"
  "${JAVA}" -jar "${JAR}" "$@"
  exit
}

main "$@"

google_sql.sh instance
Inside Google Compute Engine they are installed at:
ls -l /usr/local/share/google

To Install SQL command tool run this script:
apt-get install default-jdk unzip
wget http://dl.google.com/cloudsql/tools/google_sql_tool.zip
sudo mkdir -p /usr/local/share/google
unzip google_sql_tool.zip -d /usr/local/share/google/google_sql_tool/
rm google_sql_tool.zip
chmod u+x /usr/local/share/google/google_sql_tool/google_sql.sh
ln /usr/local/share/google/google_sql_tool/google_sql.sh /usr/local/bin/google_sql



Installing Google Cloud SDK on UBUNTU




O URL específico do gadget não foi encontrado



Comments