Koha Backup in the Google Drive

In this article, I explain an easy way to take backup in Google drive. In this way, we can take benefit from 15 GB of free cloud space on Google Drive (Dropbox offers 2 GB of cloud space only)

Backup in Google drive

Install Rclone on the Linux Machine

(Rclone is a command-line program to manage the files on cloud storage. With the help of the Rclone tool, we can synchronize or mount the directory, files, and databases with various cloud  storage e.g. Dropbox, Google Drive, Onedrive, Megasync, Amazon Cloud, etc.)

update & upgrade the server

sudo apt update 

sudo apt upgrade

Install the Rclone

sudo apt install rclone 

After installing the Rclone we need to configure it. Enter the following command in order to configure.

rclone config

Enter ‘n‘ to add a new remote.


Enter the name of the new remote. Here I put the name 'Googledrive' as we are going to configure it to back up in Google drive so it will be easy to remember and identify.


Select cloud service as google drive from the list to send Backup. We need to enter the number of the cloud service. So enter the correct number of the Google drive. In my case, it is 13 for google drive.


Hit Enter Twice  (to leave blank for client id and Client secret id)


Select the permission type and enter the '1' number to give full access.


Hit enter twice (to leave blank Root Folder id and service account file)


Enter 'N' as we don't need advanced configuration.

Enter 'Y' to use auto-config.

When you put ‘Y’ and hit enter, A popup window will appear, where you need to log in with your Google account. It will ask permission. Click on the 'Allow' button. If the popup window does not appear automatically then copy the link which appeared in the terminal, locate it in the browser and allow permission.


After allowing permission you have configured the rclone successfully.


Now Enter 'Y" to  configure this as a team drive


Enter 'Y' to confirm ok


Enter 'Q' to get out from the configuration and enter in the sudo or root user.


Now create a backup folder in the home directory named kohabackup 

mkdir ~/kohabackup

Apply the following command to send backup from the "kohabackup" folder to Google drive

rclone mount Googledrive: ~/kohabackup

Close the terminal and open it again

Now create a crontab to schedule backup in "kohabackup" folder 

Apply the following command to open crontab in the terminal

crontab -e

Add the below lines at the bottom of the file (for more detail see also )

30 13 * * * mysqldump -ukoha_library -ppassword koha_library | xz > /home/kohabackup/koha_library.sql.xz

Change username, password, and location path as per your koha LMS. It will happen backup in the backup folder daily at 1.30 PM. and automatically store in google drive at the same time.

Reference:- Rclone

Post a Comment

1 Comments