当前位置:首页 > PHP文摘 > 列表

2022年谷歌无限网盘申请和VPS挂载谷歌网盘的方法

发布:smiling 来源: PHP粉丝网  添加日期:2022-10-01 20:21:58 浏览: 评论:0 

虽然谷歌盘盘对网盘进行了捕捉的搬运限制,但还有足够的谷歌能力对个人还是有很大的作用,只要不饲养还是可以长期使用的,今天来说一下如何申请谷歌团队盘,不是把队伍盘挂到你的VPS上,挂载后可以安装离线下载,音影库,等等可以翻墙访问,注意:必须在vps上安装xray才能后续操作。

一、申请无限空间谷歌团队盘

2021年谷歌团队盘申请网址

中文  https://gdrive.zppcw.cn/

越南   https://team.gdrive.vip/

二、Rclone挂载谷歌团队盘

下面以centos系统为例

必要升级

yum update && yum upgrade

安装命令

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

配置rclone

rclone config

开始配置

  1. n) New remote 
  2.  s) Set configuration password 
  3.  q) Quit config 
  4.  n/s/q> n   #输入n回车,新建配置 
  5.  name> gd   #新建配置的名称,随意填写,后面会用到 
  6.  Type of storage to configure. 
  7.  Enter a string value. Press Enter for the default (""). 
  8.  Choose a number from below, or type in your own value 
  9.   1 / 1Fichier 
  10.      "fichier" 
  11.   2 / Alias for an existing remote 
  12.      "alias" 
  13.   3 / Amazon Drive 
  14.      "amazon cloud drive" 
  15.   4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc) 
  16.      "s3" 
  17.   5 / Backblaze B2 
  18.      "b2" 
  19.   6 / Box 
  20.      "box" 
  21.   7 / Cache a remote 
  22.      "cache" 
  23.   8 / Dropbox 
  24.      "dropbox" 
  25.   9 / Encrypt/Decrypt a remote 
  26.      "crypt" 
  27.  10 / FTP Connection 
  28.      "ftp" 
  29.  11 / Google Cloud Storage (this is not Google Drive) 
  30.      "google cloud storage" 
  31.  12 / Google Drive 
  32.      "drive" 
  33.  13 / Google Photos 
  34.      "google photos" 
  35.  14 / Hubic 
  36.      "hubic" 
  37.  15 / JottaCloud 
  38.      "jottacloud" 
  39.  16 / Koofr 
  40.      "koofr" 
  41.  17 / Local Disk 
  42.      "local" 
  43.  18 / Mega 
  44.      "mega" 
  45.  19 / Microsoft Azure Blob Storage 
  46.      "azureblob" 
  47.  20 / Microsoft OneDrive 
  48.      "onedrive" 
  49.  21 / OpenDrive 
  50.      "opendrive" 
  51.  22 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH) 
  52.      "swift" 
  53.  23 / Pcloud 
  54.      "pcloud" 
  55.  24 / Put.io 
  56.      "putio" 
  57.  25 / QingCloud Object Storage 
  58.      "qingstor" 
  59.  26 / SSH/SFTP Connection 
  60.      "sftp" 
  61.  27 / Union merges the contents of several remotes 
  62.      "union" 
  63.  28 / Webdav 
  64.      "webdav" 
  65.  29 / Yandex Disk 
  66.      "yandex" 
  67.  30 / http Connection 
  68.      "http" 
  69.  31 / premiumize.me 
  70.      "premiumizeme" 
  71.  Storage> 12       #选择需要挂载的网盘 
  72.  ** See help for drive backend at: https://rclone.org/drive/ ** 
  73.   
  74.  Google Application Client Id 
  75.  Setting your own is recommended. 
  76.  See https://rclone.org/drive/#making-your-own-client-id for how to create your own. 
  77.  If you leave this blank, it will use an internal key which is low performance. 
  78.  Enter a string value. Press Enter for the default (""). 
  79.  client_id>       #默认直接回车,或者输入自己的OAuth ID 
  80.  Google Application Client Secret 
  81.  Setting your own is recommended. 
  82.  Enter a string value. Press Enter for the default (""). 
  83.  client_secret>   #默认直接回车,或者输入自己的OAuth秘锁 
  84.  Scope that rclone should use when requesting access from drive. 
  85.  Enter a string value. Press Enter for the default (""). 
  86.  Choose a number from below, or type in your own value 
  87.   1 / Full access all files, excluding Application Data Folder. 
  88.      "drive" 
  89.   2 / Read-only access to file metadata and file contents. 
  90.      "drive.readonly" 
  91.     / Access to files created by rclone only. 
  92.   3 | These are visible in the drive website. 
  93.     | File authorization is revoked when the user deauthorizes the app. 
  94.      "drive.file" 
  95.     / Allows read and write access to the Application Data folder. 
  96.   4 | This is not visible in the drive website. 
  97.      "drive.appfolder" 
  98.     / Allows read-only access to file metadata but 
  99.   5 | does not allow any access to read or download file content. 
  100.      "drive.metadata.readonly" 
  101.  scope> 1         #默认输入1回车 
  102.  ID of the root folder 
  103.  Leave blank normally. 
  104.  Fill in to access "Computers" folders. (see docs). 
  105.  Enter a string value. Press Enter for the default (""). 
  106.  root_folder_id> #默认直接回车 
  107.  Service Account Credentials JSON file path 
  108.  Leave blank normally. 
  109.  Needed only if you want use SA instead of interactive login. 
  110.  Enter a string value. Press Enter for the default (""). 
  111.  service_account_file> 
  112.  Edit advanced config? (y/n) 
  113.  y) Yes 
  114.  n) No 
  115.  y/n> n           #是否编辑高级配置,输入n回车 
  116.  Remote config 
  117.  Use auto config? 
  118.   * Say Y if not sure 
  119.   * Say N if you are working on a remote or headless machine 
  120.  y) Yes 
  121.  n) No 
  122.  y/n> n         #是否使用自动配置,输入n回车 
  123.  If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/XXX 
  124.  Log in and authorize rclone for access 
  125.  Enter verification code> XXXX #复制上面的链接在浏览器中打开,将得到的授权码复制到这里后回车 
  126.  Configure this as a team drive? 
  127.  y) Yes 
  128.  n) No 
  129.  y/n> y         #是否挂载团队网盘,如果没有输入n回车,需要挂载团队版输入y回车 
  130.  Fetching team drive list... 
  131.  Choose a number from below, or type in your own value 
  132.   1 / SunPma 
  133.      "0ADYACmKjlU3JUk9PVA" 
  134.  Enter a Team Drive ID> 1     #选择你需要挂载的团队盘然后回车 
  135.  -------------------- 
  136.  [SUNPMAGD] 
  137.  type = drive 
  138.  scope = drive 
  139.  token = {"access_token":"XXX","expiry":"2019-10-23T14:32:06.481207275+08:00"
  140.  team_drive = 0ADYACmKjlU3JUk9PVA 
  141.  -------------------- 
  142.  y) Yes this is OK 
  143.  e) Edit this remote 
  144.  d) Delete this remote 
  145.  y/e/d> y       #默认输入y回车 
  146.  Current remotes: 
  147.   
  148.  Name                 Type 
  149.  ====                 ==== 
  150.  SUNPMAGD             drive 
  151.   
  152.  e) Edit existing remote 
  153.  n) New remote 
  154.  d) Delete remote 
  155.  r) Rename remote 
  156.  c) Copy remote 
  157.  s) Set configuration password 
  158.  q) Quit config 
  159.  e/n/d/r/c/s/q> q   #输入q回车,保存配置退出 
  160. 新建本地挂载文件夹 
  161.  
  162. 复制 
  163.  mkdir /home/gd 

挂载磁盘命令说明

  1. #/usr/bin/rclone mount DriveName:Folder LocalFolder  
  2.  下面整体代码中最上面的这条需要自己修改,不要直接复制,注意代码中有空格 
  3.  DriveName       #配置时填写的name 
  4.  Folder         #网盘里要挂载的文件夹名 
  5.  LocalFolder     #本地要挂载的文件夹绝对路径 
  6.  例:/usr/bin/rclone mount gd: /home/gd 

挂载

  1. #下面代码是一个整体,全部复制后粘贴运行 
  2.  /usr/bin/rclone mount gd: /home/gd  
  3.   --umask 0000  
  4.   --default-permissions  
  5.   --allow-non-emptyempty  
  6.   --allow-other  
  7.   --transfers 1  
  8.   --buffer-size 64M  
  9.   --low-level-retries 200  
  10.   --dir-cache-time 12h  
  11.   --vfs-read-chunk-size 32M  
  12.   --vfs-read-chunk-size-limit 1G 
  13.   #如果你还涉及到读取使用,比如使用H5ai等在线播放,就在后面多加上最后三条参数 

参数说明:

--transfers:该参数是最大同时传输任务数量,如果经常传输大文件,或CPU性能不佳,建议设置为单线程,也就是设置为“1”

--buffer-size:该参数为读取每个文件时的内存缓冲区大小,控制rclone上传和挂载的时候的内存占用

--low-level-retries:该参数为传输文件没速度的时候重试次数,没速度的时候,单个会自动睡眠10ms起,然后再重试

如果挂载时候出错如下图:

2022年谷歌无限网盘申请和VPS挂载谷歌网盘的方法

如果出错安装fuse

yum install fuse

查看是否成功

df -h

如下图显示gd 挂载成功

2022年谷歌无限网盘申请和VPS挂载谷歌网盘的方法

三、开机启动

找到/etc/systemd/system ,在里面新建一个名为 rclone.service 的文件,文件的完整路径为 /etc/systemd/system/rclone.service 然后在文件中填入以下代码。

  1. [Unit] 
  2. Description=Rclone 
  3. AssertPathIsDirectory=/home/gd 
  4. After=network-online.target 
  5.  
  6. [Service] 
  7. Type=simple 
  8. ExecStart=/usr/bin/rclone mount gd: /home/gd  
  9.  --umask 0000  
  10.  --default-permissions  
  11.  --allow-non-emptyempty  
  12.  --allow-other  
  13.  --transfers 1  
  14.  --buffer-size 64M  
  15.  --low-level-retries 200  
  16.  --dir-cache-time 12h  
  17.  --vfs-read-chunk-size 32M  
  18.  --vfs-read-chunk-size-limit 1G 
  19. ExecStop=/bin/fusermount -u /home/gd 
  20. Restart=on-abort 
  21. User=root 
  22.  
  23. [Install] 
  24. WantedBy=default.target 

启动rclone

systemctl start rclone

开机启动rclone

systemctl enable rclone

rclone常用命令

重启:systemctl restart rclone

停止:systemctl stop rclone

状态:systemctl status rclone

另外备注:如果你想要用宝塔面板安装可道云网盘的web管理界面,那就把谷歌盘挂载在可道云下面!只需要修改开机配置文件如下:

  1. [Unit] 
  2. Description=Rclone 
  3. AssertPathIsDirectory=/www/wwwroot/你的域名/data/User/admin/home/gd 
  4. After=network-online.target 
  5.  
  6. [Service] 
  7. Type=simple 
  8. ExecStart=/usr/bin/rclone mount gd: /www/wwwroot/你的域名/data/User/admin/home/gd  
  9.  --umask 0000  
  10.  --default-permissions  
  11.  --allow-non-emptyempty  
  12.  --allow-other  
  13.  --transfers 1  
  14.  --buffer-size 64M  
  15.  --low-level-retries 200  
  16.  --dir-cache-time 12h  
  17.  --vfs-read-chunk-size 32M  
  18.  --vfs-read-chunk-size-limit 1G 
  19. ExecStop=/bin/fusermount -u /www/wwwroot/你的域名/data/User/admin/home/gd 
  20. Restart=on-abort 
  21. User=root 
  22.  
  23. [Install] 
  24. WantedBy=default.target

Tags: 谷歌无限网盘申请 VPS挂载谷歌网盘

分享到: