How to install Grive2 in Ubuntu

Posted on Saturday January 09, 2016 / by Eric Potvin

Do you backup your files manually? or do you even backup your files?

If you say yes to at least one of the question above, it's time to setup your backup.

Google Drive provides functionality to backup your files on the Google Cloud. This can be done manually by opening Firefox or Chrome and manually uploading files.

Now, if you do not want to manually, you need to install Grive2.

Grive2 is a tool that will allow you to backup your files to Google Drive without login via an Internet browser.

Install Grive2

First, let's add the Grive2 repository

sudo add-apt-repository ppa:nilarimogard/webupd8

Now, let's install it

sudo apt-get update
sudo apt-get install grive

Setup your backup folder

You can either use an existing folder or create a new one, for example:

mkdir -p ~/backup
cd ~/backup

Now, before you can start backup, you need to grant it permission to access your Google Drive:

grive -a

This will give you a Google URL that generates a unique token. This token is use to sync data between your computer and Google Drive.

You should see something like (on the Internet browser) and you’ll be asked to give Grive permission to access your Google Drive and after clicking Allow access. One you allowed the access, you will see a private key or token:

Please copy this code, switch to your application and paste it there:
[ MY_VERY_LONG_PRIVATE_KEY ]

Copy and paste the private key to the shell.

Backup

Every time you need to backup files, simply run:

grive

Automated backup

If you want to automatically backup files, you can setup a cronjob. This will allow to automatically run your backup.

The important thing you have to make sure is you need to make sure you get the full path of the grive tool by running:

which grive