我们很多人喜欢用VPS做离线下载,不过由于有的服务器硬盘太小了,装不了太多电影资源啥的,我们就需要想办法了,之前说过可以通过挂载FTP来增大空间,参考:Linux VPS通过安装CurlFtpFS来挂载FTP,这里再说个挂载Google Drive网盘的方法,毕竟Google Drive有15G免费的空间,有的也有无限空间,都可以利用上去。
安装
本教程只适用Debian/Ubuntu系统,如果你是CentOS,请参考:https://rclone.org/install/,安装rclone。挂载方法和下面差不多。
1、安装rclone
wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh
2、初始化配置
rclone config
会出现以下信息:
n) New remote s) Set configuration password q) Quit config n/s/q> n name> Rats #随便填,后面要用到 Type of storage to configure. Choose a number from below, or type in your own value 1 / Amazon Drive "amazon cloud drive" 2 / Amazon S3 (also Dreamhost, Ceph, Minio) "s3" 3 / Backblaze B2 "b2" 4 / Box "box" 5 / Cache a remote "cache" 6 / Dropbox "dropbox" 7 / Encrypt/Decrypt a remote "crypt" 8 / FTP Connection "ftp" 9 / Google Cloud Storage (this is not Google Drive) "google cloud storage" 10 / Google Drive "drive" 11 / Hubic "hubic" 12 / Local Disk "local" 13 / Microsoft Azure Blob Storage "azureblob" 14 / Microsoft OneDrive "onedrive" 15 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH) "swift" 16 / Pcloud "pcloud" 17 / QingCloud Object Storage "qingstor" 18 / SSH/SFTP Connection "sftp" 19 / Webdav "webdav" 20 / Yandex Disk "yandex" 21 / http Connection "http" Storage> 10 #选择10,Google Drive Google Application Client Id - leave blank normally. client_id> #留空 Google Application Client Secret - leave blank normally. client_secret> #留空 Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login. service_account_file> Remote config Use auto config? * Say Y if not sure * Say N if you are working on a remote or headless machine or Y didn't work y) Yes n) No y/n> n #选择n If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth.... #复制到浏览器打开,获取验证码 Log in and authorize rclone for access Enter verification code> #填入上面获取到的验证码 Configure this as a team drive? y) Yes n) No y/n> y #选择y Fetching team drive list... No team drives found in your account-------------------- [Rats] client_id = client_secret = service_account_file = token = {"access_token":"ya29.GltFBd7UJN2qrxdG8FnG_rMuB18ogb8QlujdL7glvXtfV"} team_drive = -------------------- y) Yes this is OK e) Edit this remote d) Delete this remote y/e/d> y #选择y Current remotes: Name Type ==== ==== Rats drive e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config e/n/d/r/c/s/q> q #选择q退出
3、挂载为磁盘
#新建本地文件夹,路径自己定,即下面的LocalFolder mkdir /root/GoogleDrive #挂载为磁盘 rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
DriveName为初始化配置填的name,Folder为Google Drive里的文件夹,LocalFolder为VPS上的本地文件夹。
fusermount -qzu LocalFolder
自启动
1、下载并编辑脚本
使用命令:
wget https://www.moerats.com/usr/shell/rcloned && nano rcloned
修改一下内容:
NAME="" #rclone name名,及配置时输入的Name REMOTE='' #远程文件夹,Google Drive网盘里的挂载的一个文件夹 LOCAL='' #挂载地址,VPS本地挂载目录
2、设置自启
使用命令:
#Debian系统 apt-get install sudo -y #设置自启 mv rcloned /etc/init.d/rcloned chmod +x /etc/init.d/rcloned update-rc.d -f rcloned defaults bash /etc/init.d/rcloned start
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。