How to install gsutil on Centos/ubuntu?

How to Install gsutil on Centos ?

In this article we will explain how to install gsutil on Centos.

Google Cloud storage

Google Cloud Storage is unified object storage for developers and enterprises, from live data serving to data analytics/ML to data archiving.
Let us see how to Upload data to google cloud storage using “gsutil”

1. Install “gsutil”

Type following command in your shell prompt

The output of this command 

 

By default it will be installed inside folder “/root/google-cloud-sdk/bin/”

You can add the folder “/root/google-cloud-sdk/bin/” to your PATH variable to avoid using full path every time.

Simply installing “gsutil” gives you immediate read and/or write access to public data. But if you want to access your own private repos, you need to configure “gsutil” with your own
auth details.

Configuring gsutil

Run the following command to configure “gsutil”

Output would be like below

If you press Y , it will show following

Copy the URL and paste it in your browser. It will force you to login to your google cloud console. Once you login you will be redirected to a page which has the ¬†“verification code” . Please copy it and enter in the console , where it asked the verification code.

This will complete your configuration. Now you can navigate throgh your repos using gsutil

Few examples are below

List the repos in your project, use “gsutil ls”

To upload a file to your repo, use “gsutil cp”

To delete an object, use “gsutil rm”

To create a new bucket, use “gsutil mb”

You can find more details at official documentation

SUMMARY

In this article we explained how to install and configure gsutil on Centos/Linux. Please try it out. 

As always, feel free to drop us a note if you have any questions or feedback using our comment form below. Always Happy to help

Leave a Reply

Your email address will not be published. Required fields are marked *