- This article will walk you through the process of installing Rclone and connecting a remote to a cloud service such as Backblaze or Google Drive. This will allow you to move files to these cloud services.
- CentOS or Ubuntu 20.04LTS Server. (See here for instructions on how to install Ubuntu20.04LTS)
- Google Drive, Backblaze, etc, account set up with a bucket/drive created.
- Terminal access to the server through SSH.
root@ubuntu-45d:~# curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
root@ubuntu-45d:~# unzip rclone-current-linux-amd64.zip
root@ubuntu-45d:~# cd rclone-*-linux-amd64
root@ubuntu-45d:~# sudo su
root@ubuntu-45d:~# cp rclone /usr/bin
root@ubuntu-45d:~# chown root:root /usr/bin/rclone
root@ubuntu-45d:~# chmod 755 /usr/bin/rclone
yum install rclone
- Create an application key for the bucket.
- Copy this down. It will only appear here once.
- Create a new remote for rclone by running “rclone config” and you will be prompted for a name and which type of remote. Enter “5” for Backblaze B2.
- Enter the keyID and applicationKey from the backblaze webpage. Enter true or false on hard_delete option as you need.
- You should now be able to push or pull files from a Backblaze bucket. You can have multiple remotes at a time and have multiple buckets. The files can be moved in either direction based on the syntax of the Rclone commands. A list of Rclone commands is available here.
- We can then test that the authentication works. Here I have uploaded two random files.
- I will copy them to a folder I have created on the server using “rclone copy”
While it is free to connect to Google Drive, you will be limited to a personal drive. This can be shared to others but if the owner deletes the folder it will be removed for everyone. In order to use a Shared Drive (Team Drive) you need a G Suite Business account. Here we cover connecting to a personal drive, the Shared Drive setup is similar.
- Visit console.cloud.google.com/projectselector2/ and click “create project”
- Choose a name for the project and click “create”.
- Go to the navigation menu at the top left of the webpage > APIs & Services > OAuth consent screen. Select External and click “create”.
- Fill in the App name, User support email, and scroll down and enter an email under Developer contact information. Click “save and continue”. Click “save and continue” on the following page.
- On Test users, click “add users” and enter the email of the gmail account you are using to create the project. Then click “save and continue”.
- Navigate to Credentials page and click “create credentials” at the top, then click “OAuth client ID”.
- Set the application type to Desktop app. The name can be left the same. Click “create”. You will be presented with the client ID and secret you need for the Rclone remote.
- Go to the Houston terminal on your Storinator, or SSH into it.
- Run through the Rclone configurator by typing “rclone config” and create a new remote. On our version of Rclone, Google Drive is #15 so enter 15.
- Enter the ID and secret from the previous steps and select a scope for rclone’s access. For simplicity I chose option 1 here.
- Continue through the config leaving everything default until it asks us to use auto config. Say no, as we are on a headless machine without a desktop and internet browser.
- Copy the URL from the terminal into a browser on your pc. Choose the google account you gave access to, and allow your “project” to access your google drive.
- Continue through the config leaving the rest as default and then review and confirm the config.
- Go back to the Google Cloud Platform webpage. Go to the API Library and scroll down to Google Drive API. Click on that and enable it. You should now be able to send files to your drive.
- You can send/retrieve files from your google drive. Here I have created an empty file named “testfile” and a few folders. They can be sent to your drive by running an rclone command like copy.
- Here I ran a command to copy the entire contents of my current folder to a folder on my drive named “StorinatorBackupFiles”. This folder didn’t previously exist so it is automatically created. I also had to add “–create-empty-src-dirs” flag as my test folder was empty and rclone skips empty folders by default.