How to install CLI Google Drive client on Ubuntu 14.04

All new GDrive clients require new version of Google programming language (golang) installed on Ubuntu 14.04. I’ve found that the version that is available on the Ubuntu repository (1.2.1) is simply not high enough, and therefore I recommend installing golang from the source, Google. To install golang, first, we need to install some additional software:

# aptitude install -y gcc git mercurial

Once installation is complete, download and unpack golang binaries from Google.

# wget https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz
# tar -xzvf go1.3.3.linux-amd64.tar.gz

Please note that in the above example I am downloading x64 version of the golang, for i386 use https://storage.googleapis.com/golang/go1.3.3.linux-386.tar.gz

Once unpacked, move the go folder to /opt/

# mv go /opt/

Now we need to add some variables to the environment path:

# mkdir /opt/gopkg
# vim ~/.profile

and paste the following three lines at the end of the file:

export GOPATH=/opt/gopkg
export GOROOT=/opt/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Refresh your profile by running the following command

# source ~/.profile

Verify go installation by using go version command

# go version

Create a file sefnet.go and place the following strings inside

package main
import "fmt"
func main(){
        fmt.Printf("SefNET");
}

Execute the file using the following command:

# go run sefnet.go

You should see SefNET displayed on your screen.

Now we will install the Google drive client.

# go get -u github.com/odeke-em/drive/cmd/drive

Once the installation is complete, make folder gdrive on the desired location. Now run the following command to initialize gdrive.

# drive init ~/gdrive
Visit this URL to get an authorization code
https://accounts.google.com/o/oauth2/auth......
Paste the authorization code:

Note that above example points to gdrive folder within root folder (home directory). You need to authorize gdrive to access your Google drive. Make sure to copy the authorization code and paste it into the prompt.\r\n\r\nNow go to gdrive folder and create the file sefnet.txt

# cd gdrive
# touch sefnet.txt
# drive push

The above command will place file sefnet.txt over to your Google drive.

To study drive commands, run the following command:

# drive -h

To study particular command, run the following command:

# drive command -h

To display account info and quota, run the following command:

# drive quota

You should get output similar to this one:

Name: SefNET
Account type:    LIMITED
Bytes Used:    2148076704           (2.00GB)
Bytes Free:    13958050656         (13.00GB)
Bytes InTrash:    0                  (0.00B)
Total Bytes:    16106127360        (15.00GB)
* Space used by Google Services 
* Service                              Bytes
DRIVE                                2.00GB
GMAIL                                0.00B
PHOTOS                               0.00B
Space used by all Google Apps        2.00GB
Leave a Reply 0

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