Backing up is crucial to the success of any website. However, backing up to cloud services such as Amazon S3, Google Drive, Google Bucket Storage, Yandex.Disk, and Backblaze B2 can be difficult and or time consuming to set up. However, Rclone makes that task so much easier. Today we are going to install Rclone on Ubuntu 14.04.
First you are going to want to go to their download page:
You are going to want to download the appropriate version based on your system and whether it is 32 bit or 64 bit and whether or not it is running on ARM architecture.
We are going to use the 64 bit version which can be downloaded here:
http://downloads.rclone.org/rclone-v1.30-linux-amd64.zip
Once it is downloaded you are going to want to issue the following commands that are published on the Rclone website. Below I have copied and pasted the commands from their webpage, which is available here: http://rclone.org/install/
unzip rclone-v1.17-linux-amd64.zip
cd rclone-v1.17-linux-amd64
#copy binary file
sudo cp rclone /usr/sbin/
sudo chown root:root /usr/sbin/rclone
sudo chmod 755 /usr/sbin/rclone
#install manpage
sudo mkdir -p /usr/local/share/man/man1
sudo cp rclone.1 /usr/local/share/man/man1/
sudo mandb
If you want a complete install script I have composed one below that will download the file using wget and then implement the commands from Rclone’s website. It will also install the unzip package. The script is available below:
sudo apt-get install unzip -y
cd ~
wget http://downloads.rclone.org/rclone-v1.30-linux-amd64.zip
unzip rclone-v1.30-linux-amd64.zip
cd rclone-v1.30-linux-amd64
#copy binary file
sudo cp rclone /usr/sbin/
sudo chown root:root /usr/sbin/rclone
sudo chmod 755 /usr/sbin/rclone
#install manpage
sudo mkdir -p /usr/local/share/man/man1
sudo cp rclone.1 /usr/local/share/man/man1/
sudo mandb
Once it is installed you need to configure to work with your cloud storage host. The official configuration page is available here:
To setup Rclone for use with Google Drive you are going to want to type:
rclone config
n
#name of google drive remote host ex: googledrive-backup
googledrive-backup
6
#client_id leave blank
#client_secret leave blank
#If installing on a headless server type N
n
#you will be given a link to enter into your browser. The link will ask for your permission for Rclone to access your Google Drive account. Once permission is granted it will give you a verification code which you will copy and paste back into your ssh terminal.
#It will then ask you if the current setup is ok or if you want to edit it or delete it. If you are happy with the result press y which will set the remote host.
y
#If there are no more remote hosts that you want to add then you can type q to quit the configuration
q
Once you have your host set you can start copying files to it. For instance if we wanted to copy a file named test.txt into a folder on Google Drive named test (it doesn’t matter if the folder exists or not) we would enter the following:
rclone copy test.txt googledrive-backup:test
Note: If you are running rclone as an automated cron task you are going to need to include the full path to rclone or else it will not copy.
sudo /usr/sbin/rclone copy test.txt googledrive-backup:test
Congratulations! Now you are able to copy files from your server or computer to Google Drive with a few simple commands.
If you would like an offline version of this guide I have attached a pdf of it below: