Wednesday, May 11, 2016

Google Drive on CentOS


Today information's place is the Cloud. Every thing looks like to be sending to the Cloud. Although Cloud is just someone´s else computer, actually it is a great improvement in many sense.
  Recently my notebook´s HD just gone! I simply lost everything I had. I was working in a bunch of scripts and simply lost everything. I had no backup!.
 Well, based on this disaster, I decide to write this post. Here we are going to learn how integrade CentOS 2.6.32-279.el6.i686  with Google Drive and, from Command line interface, upload and/or download files. Google allows for 18 Gigabytes with no charge, which is a lot of space and we have no reason to do not use it.
 Considering you have a perfectly installed and configure CentOS CentOS-6.3-x86, we can keep going:
 The first thing to do is download the bynary from Google. Currently, the URL https://github.com/prasmussen/gdrive#downloads.
is ok. The option gdrive-linux-386 is the correct for this Operational System.
 You can right click and get the URL, then, use wget to donwload:

wget -O drive https://docs.google.com/uc?id=0B3X9GlR6EmbnLV92dHBpTkFhTEU&export=download


  The -O option permits you to change the downloaded file name, otherwise, the file names will look like a string. After that, copy file to /usr/sbin and give it permission:

mv drive /usr/sbin/drive  

chmod 755 /usr/sbin/drive 

 Now you have Google drive installed on you system and we have one more step to do:







 The command used here was "drive about". This command is for an Authentication step which is pretty simple. It gives you an URL and as bellow to enter a Code. As soon as you copy and paste that URL in a Browser, you´ll be asked to permit the operation:



By doing so, you´ll be presented to another page where a string of characters will be presented:



Copy that string and paste on the command line:



After that, the authentication process is finished:



You can now happily send your file to the Cloud and get those back according to your wishes.
 To upload a file just type "drive upload 'file name'" and it´s done. Simple like that.
 To download a file, one step more is necessary. You can´t just type "drive download 'file name'" because you are looking for something out there on the Internet. You need to pass out a reference.

The way I do that is:


























By clicking with the right button over the file you want do download, you can see the URL for that file. 









As we can see from the image above, the file´s URL have a string id and this string can be used as a parameter on the download command. Just type "drive download 'string'"and you are ready to download a file from Google drive to you machine.
 You can also use de command "drive list". This command will show you all files currently on your Google drive and the string for each file



This is it. Pretty simple but really helpful. Now you can backup your files into the Cloud.



No comments:

Post a Comment