Running Google Cloud SDK on Centos6

So you want to run the google cloud sdk on your centos6(rhel6) machine so you can use gsutil to copy a file, but google hates old versions of python, so you get yum errors trying to install the google cloud sdk. All you want is to copy a file, but noooo….. that’s to easy.

Here is a script that’ll install it for you

# get the gcloud utils
if [ ! -f /opt/gcloud.tar.gz ] ; then
wget -O /opt/gcloud.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-268.0.0-linux-x86_64.tar.gz
fi

## Install Conda
if [ ! -f /opt/mini.sh ] ; then
wget -O /opt/mini.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh  
chmod 755 /opt/mini.sh
cd /opt
./mini.sh -b -p /opt/conda -s
fi

## Install GCLOUD
if [ ! -d /opt/google-cloud-sdk ] ; then
export CLOUDSDK_PYTHON="/opt/conda/bin/python"
cd /opt
tar xvzf gcloud.tar.gz
cd google-cloud-sdk
./install.sh -q
fi

if [ ! -s /bin/gsutil ] ; then
ln -s /opt/google-cloud-sdk/bin/gsutil /bin/gsutil
fi

if [ ! -s /bin/gcloud ] ; then
ln -s /opt/google-cloud-sdk/bin/gcloud /bin/gcloud
fi

One note, after you install this, you’ll need to set the variables export CLOUDSDK_PYTHON="/opt/conda/bin/python" for this to work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s