Last update at :2024-07-10,Edit by888u
Rclone, under Linux, can mount Google Drive, OneDrive, WebDAV, FTP, etc. It is a magical tool. Below is an installation and usage tutorial.
1. Install Rclone The following operations are based on Centos system
1. Install necessary applications
yum -y install wget unzip screen fuse fuse-devel2. Install Rclone
curl https://rclone.org/install.sh | sudo bashor
wget https://downloads.rclone.org/rclone-current-linux-amd64.zip unzip rclone-current-linux-amd64.zip mv rclone-v* rclone cdrclone2. Mount Google Drive
1. Mount GDrive
rcloneconfigChoose 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 into the browser, obtain 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 the server. To facilitate future web access, you can mount it to /www/wwwroot/ (the following demonstration is /www/wwwroot/gdrive.xxx.com, 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 writes2. Set up rclone to start at boot
First copy the rclone executable file to /usr/bin:
cp /root/rclone/rclone /usr/bin/rcloneCreate a new rclone.service file:
vi /usr/lib/systemd/system/rclone.servicePaste:
[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.targetReload the daemon to make the new service file take effect:
systemctl daemon-reloadStart rclone:
systemctl start rcloneSet up startup:
systemctl enable rclone3. Operation of Rclone
1. List the remote directory (gdrive was created before)
rclone lsd gdrive2. Copy files
rclone copy source file/directory target directoryThe source file/directory and target directory must have absolute paths, which can be servers, network disks, etc. If you want to save the Gdrive shared by others, you can save it to your own network drive first, and then copy these files to your own network drive to prevent the person who shared it from deleting the files.
rclone copy gdrive:gongxiang/japan gdrive:gongxiang/self3. Synchronize files
rclone sync source file/directory target directoryThis only synchronizes files that are not available. Suitable for files with large changes.
Recommended site search: What is needed for website registration, domain name resolution IP address query, IP detailed address query, host server rental, instant solution server, mainland China agent IP, yellow pages, top ten free servers abroad, mainland China registration-free CDN, Korea cheap server,
发表评论