LINUX, FOSS AND LIBRARY TECHNOLOGY ENTHUSIAST

Monday, July 27, 2020

Using Google Drive on Debian/Ubuntu with Rclone

1 comments
Rclone is an open-source command-line tool that enables you to synchronize a local Linux directory with various cloud storage services. With Rclone to schedule automated backups of your MySQL/MariaDB server to Google Drive, Dropbox, and many other cloud storage providers. In this blog post, we look at how to install and setup Rclone. We also cover how you can schedule automated backups of your MySQL/MariaDB server to your cloud provider such as Google Drive.

Install Rclone on Debian/Ubuntu

as usual, update & upgrade server

sudo apt update && sudo apt upgrade

sudo apt install rclone -y

To install latest rclone on Linux, MacOS, or BSD systems, run:

curl https://rclone.org/install.sh | sudo bash

OR

sudo su

apt install zip unzip curl ; curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip ; unzip rclone-current-linux-amd64.zip ; cd rclone-*-linux-amd64 ; sudo cp rclone /usr/bin/ ; sudo chown root:root /usr/bin/rclone ; sudo chmod 755 /usr/bin/rclone ; rclone version

Adding new remote

Once you have installed rclone successfully, you need to configure rclone. Enter the following command in the terminal:

rclone config

If it’s your first time using rclone, you have to add a new remote to rclone. Select ‘n‘ to add a new remote.


Now you have to enter the name of the remote. You can enter any name here that matches the cloud service so that it is easy to identify. I am using ‘Gdrive‘.


Select cloud service you want to sync with rclone

After entering the name and hitting enter, you will see a list of cloud services like Google cloud storage, Box, One Drive, and others.

You have to enter the number of the service you want to use. In this case, it’s ‘Drive’. Make sure you enter the correct number. the number may change in new versions



As you don’t need to enter client ID or secret ID hit Enter twice.

Choose the permission type and number


It will ask root folder ID and Credentials JSON file path just hit enter twice

Next enter ‘N’ for selecting no for advanced configuration. Of course, if you want to configure something very specific, you can go ahead with Y.


When you’re asked for ‘Use auto config’, press Y.

Login to Google Drive account

When you enter ‘y’ and hit enter, you will get a link, open it in a browser and here you have to log into your Google account. And if it asks for permission click on ‘yes’. and copy the code and paste it on the terminal.


After version 1.60.1, the configuration process underwent changes. once you type n in the last step, you will get a code instead of link. Run the code in a terminal window on your desktop, where the same version of rclone must be installed. This will launch your browser and prompt you to log into your Google account and grant rclone permission. After you click Allow Permission, your remote machine will connect to your Google Drive, and you can then move on to the final step of rclone remote creation.


Authorisation generation ( from the remote machine)


Auth key generation ( from desktop machine)

If you want to configure this as a team drive you can hit enter Y and proceed or just hit N. next confirmation will be asked hit Y and quite from rclone typing Q

To sync a file 
 
rclone sync source:path dest:path
 
rclone sync /home/mahesh/mahesh.txt Gdrive:UPLOADS
 

1 comment:

  1. Sir please make a video for koha auto backup in Google drive

    ReplyDelete