说明:现在很多人撸了无限空间的Google Drive
后,都不知道咋玩,这里可以利用小硬盘VPS
挂载Google Drive
后进行一系列老司机操作,这里说下方法,过程不需要使用面板、LNMP
等一键包,博主认为有点花时间,所以这里都使用一键脚本来完成,基本10
分钟就搭建好了,且自带免费的SSL
证书,可长期使用。
挂载安装
本教程只适用Debian
/Ubuntu
系统,如果你是CentOS
,请参考:https://rclone.org/install/,安装rclone
。挂载方法和下面差不多。
1、安装rclone
wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh第一种方法使用rclone
另外一种安装rclone的方法
apt-get install fuse wget https://downloads.rclone.org/rclone-current-linux-amd64.zip unzip rclone-current-linux-amd64.zip chmod 0777 ./rclone-*/rclone cp ./rclone-*/rclone /usr/bin/ rm -rf ./rclone-*
2、初始化配置
rclone config
会出现以下信息:
n) New remote s) Set configuration passwordq) Quit config n/s/q> nname> 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 configUse 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 accessEnter verification code> #填入上面获取到的验证码 Configure this as a team drive? y) Yes n) Noy/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 #选择yCurrent remotes:Name Type==== ==== Rats drive e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration passwordq) Quit config e/n/d/r/c/s/q> q #选择q退出
3、挂载为磁盘
#新建本地文件夹,路径自己定,即下面的LocalFolder mkdir /root/GoogleDrive #挂载为磁盘 然后挂载(这里的ore 是上面的昵称,xx.xx是你的域名) rclone mount ore: /data/wwwroot/xx.xx --allow-other --vfs-cache-mode writes --allow-non-empty &
fusermount -qzu LocalFolder
自启动
1、下载并编辑脚本
使用命令:
wget https://www.moerats.com/usr/shell/rcloned && nano rcloned
修改一下内容:
NAME="" #rclone name名,及配置时输入的NameREMOTE='' #远程文件夹,Google Drive网盘里的挂载的一个文件夹LOCAL='' #挂载地址,VPS本地挂载目录
2、设置自启
使用命令:
mv rcloned /etc/init.d/rcloned chmod +x /etc/init.d/rcloned update-rc.d -f rcloned defaults bash /etc/init.d/rcloned start
3、挂载Google Drive
教程参考:在Debian/Ubuntu上使用rclone挂载Google Drive网盘,注意挂载为磁盘的目录需要在H5ai
目录里,且为子目录,比如/home/wwwroot/domain.com/GoogleDrive
。
4、安装宝塔BT面板+创建域名+H5ai+逗比aria2脚本实现在线文件管理
安装aria2:建议使用逗比大佬的脚本:https://doub.bid/shell-jc4/
1 wget -N --no-check-certificate https://softs.fun/Bash/aria2.sh && chmod +x aria2.sh && bash aria2.sh
安装完后 修改配置文件:/root/.aria2/aria2.conf 修改下载目录和密码。 然后重启
/etc/init.d/aria2 restart
5、装备AriaNg与H5ai
H5ai下载地址:https://github.com/mayswind/AriaNg/releases/download/0.2.0/aria-ng-0.2.0.zip
建议解压后直接上传至网盘2、AriaNg逗比大佬的东西,具体安装使用方式见这里 https://doub.bid/wlzy-30/
6、配置上传Google Drive
直接通过Aria2
下载文件到Google Drive
挂载盘可能会有问题,所以需要简单操作下。
使用命令:
wget https://www.moerats.com/usr/shell/GDupload.sh
再编辑GDupload.sh
文件
nano GDupload.sh
修改以下参数:
downloadpath='/usr/local/caddy/www/aria2/Download' #Aria2下载目录,这里默认逗比脚本目录,不变即可。rclone='/home/wwwroot/xx.com/GoogleDrive' #rclone挂载的目录
再授权chmod +x GDupload.sh
,然后再到Aria2
配置文件中加上一行on-download-complete=/root/GDupload.sh
即可,后面为脚本的路径。
最后就可以愉快的去下电影和音乐了。
如果想一次性完成的,参考:Aria2+Rclone+DirectoryLister+Aria2Ng一键安装脚本 for Debian。
转载至:https://www.moerats.com/archives/509/
https://www.cokemine.com/aria2-guazai.html
整理自以上两位大佬的教程分享,感谢~