Install Rclone under Linux, mount Google Drive, OneDrive, WebDAV, FTP, etc.; copy each other, back up files, etc.

Install Rclone under Linux, mount Google Drive, OneDrive, WebDAV, FTP, etc.; copy each other, back up files, etc.

Rclone, under Linux, can mount Google Drive, OneDrive, WebDAV, FTP, etc., which is a magical tool. Below are the installation and usage instructions.

1. Install Rclone
The following operations are based on the Centos system

1. Install necessary applications

 yum -y install wget unzip screen fuse fuse-devel

2. Install Rclone

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

or

 wget https://downloads.rclone.org/rclone-current-linux-amd64.zip 
unzip rclone-current-linux-amd64.zip
mv rclone-v* rclone
cd rclone

2. Mount Google Drive

1. Mount GDrive

 rclone config

Select n to create a new link and name it gdrive . Then select Google Drive

Leave client_id and client_secret blank and press Enter, select 1 for SCOPE, leave root_folder_id and service_account_file blank and press Enter, select n for Edit advanced config and Use auto config

At this time, a link will appear, copy it to the browser, get the authorization code, and paste the authorization code into the terminal.
Select according to the prompts, usually n, y, q

Mount Google Drive to a directory on your server. To facilitate future web access, you can mount it to /www/wwwroot/ (the following demonstration is /www/wwwroot/gdrive.xxx.com, and gdrive.xxx.com is changed to your own domain name)

 ./rclone mount gdrive: /www/wwwroot/gdrive.xxx.com --allow-other --allow-non-empty --vfs-cache-mode writes

2. Set up rclone to start at boot

First copy the rclone executable file to /usr/bin:

 cp /root/rclone/rclone /usr/bin/rclone

Create a new rclone.service file:

 vi /usr/lib/systemd/system/rclone.service

Paste:

 [Unit]
Description=rclone
 
   [Service]
User=root
ExecStart=/usr/bin/rclone mount gdrive: /www/wwwroot/gdrive.xxx.com --allow-other --allow-non-empty --vfs-cache-mode writes
Restart=on-abort
 
   [Install]
WantedBy=multi-user.target

Reload daemon to make the new service file take effect:

 systemctl daemon-reload

Start rclone:

 systemctl start rclone

Set the startup:

 systemctl enable rclone

3. Rclone Operation

1. List the remote directory (gdrive is created previously)

 rclone lsd gdrive

2. Copy files

 rclone copy source file/directory target directory

The source file/directory and the target directory must be absolute paths, which can be servers, network disks, etc. If you want to save Gdrive shared by others, you can save it to your own network disk first, and then copy these files to your own network disk to prevent the shared person from deleting the files.

 rclone copy gdrive:gongxiang/japan gdrive:gongxiang/self

3. Synchronize files

 rclone sync source file/directory target directory

This only syncs the files that are not there. Suitable for files with large changes.

<<:  ReliableSite: New York dedicated server, i5-4570, 16GB memory, 2TB hard drive, 150TB monthly traffic, $41 per month; upgrade to 10Gbps bandwidth, $19 per month; free 20Gbps DDOS protection

>>:  CombCloud: 58 yuan/month/1GB memory/20GB SSD hard disk/500GB traffic/15Mbps/KVM/Hong Kong CN2

Recommend

ZXhost: $47/year/1 core/1GB memory/100GB space/2TB traffic/1 IP/KVM

ZXhost is a British hosting company, founded in 2...

How to optimize ads to increase click-through rate

3.1 Advertising Format: Beautify Your Advertiseme...

Cube Cloud: 49 yuan/month/512MB memory/10GB SSD space/1TB traffic/KVM/KT Korea

CubeCloud, a Chinese hosting company, was founded...

eBesucher Hang Up Guide

eBesucher is the most famous automatic surfing mo...

VPS.Net: $5/month/512MB/20GB SSD/1TB traffic/XEN/Los Angeles

VPS.Net's VPS has launched four new data cent...

HostQala: $4.95/month/1 core/512M/10G/100G/1 IP/OpenVZ

HostQala is a Singaporean hosting company founded...