Loading... --- 注:最新版rclone需要进行本地隧道连接vps并配置获取授权。 MacOS系统下使用SSH Tunnel隧道连接vps,将53682端口重定向到本地机器,使用以下命令: ssh username@remote_server -L 53682:localhost:53682 > username : vps登录用户名 > remote_server : vps主机IP --- ***演示操作系统为:macOS*** ***网络环境:可访问Google*** **终端隧道连接vps:** ssh username@remote_server -L 53682:localhost:53682 > username : vps登录用户名 > remote_server : vps主机IP ## 安装Rclone: curl https://rclone.org/install.sh | sudo bash ### Rclone配置: rclone config Current remotes: Name Type ==== ==== plex 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> n #创建新配置,选n,回车 Enter name for new remote. name> plex #名字随意起,回车 Option Storage. Type of storage to configure. Choose a number from below, or type in your own value. 1 / 1Fichier \ (fichier) 2 / Akamai NetStorage \ (netstorage) 3 / Alias for an existing remote \ (alias) 4 / Amazon Drive \ (amazon cloud drive) 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, Digital Ocean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS and Wasabi \ (s3) 6 / Backblaze B2 \ (b2) 7 / Better checksums for other remotes \ (hasher) 8 / Box \ (box) 9 / Cache a remote \ (cache) 10 / Citrix Sharefile \ (sharefile) 11 / Combine several remotes into one \ (combine) 12 / Compress a remote \ (compress) 13 / Dropbox \ (dropbox) 14 / Encrypt/Decrypt a remote \ (crypt) 15 / Enterprise File Fabric \ (filefabric) 16 / FTP \ (ftp) 17 / Google Cloud Storage (this is not Google Drive) \ (google cloud storage) 18 / Google Drive \ (drive) 19 / Google Photos \ (google photos) 20 / HTTP \ (http) 21 / Hadoop distributed file system \ (hdfs) 22 / HiDrive \ (hidrive) 23 / Hubic \ (hubic) 24 / In memory object storage system. \ (memory) 25 / Internet Archive \ (internetarchive) 26 / Jottacloud \ (jottacloud) 27 / Koofr, Digi Storage and other Koofr-compatible storage providers \ (koofr) 28 / Local Disk \ (local) 29 / Mail.ru Cloud \ (mailru) 30 / Mega \ (mega) 31 / Microsoft Azure Blob Storage \ (azureblob) 32 / Microsoft OneDrive \ (onedrive) 33 / OpenDrive \ (opendrive) 34 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH) \ (swift) 35 / Pcloud \ (pcloud) 36 / Put.io \ (putio) 37 / QingCloud Object Storage \ (qingstor) 38 / SSH/SFTP \ (sftp) 39 / Sia Decentralized Cloud \ (sia) 40 / Storj Decentralized Cloud Storage \ (storj) 41 / Sugarsync \ (sugarsync) 42 / Transparently chunk/split large files \ (chunker) 43 / Union merges the contents of several upstream fs \ (union) 44 / Uptobox \ (uptobox) 45 / WebDAV \ (webdav) 46 / Yandex Disk \ (yandex) 47 / Zoho \ (zoho) 48 / premiumize.me \ (premiumizeme) 49 / seafile \ (seafile) Storage> #选择相应的网盘序号,回车 Option client_id. Google Application Client Id Setting your own is recommended. See https://rclone.org/drive/#making-your-own-client-id for how to create your own. If you leave this blank, it will use an internal key which is low performance. Enter a value. Press Enter to leave empty. client_id> #自己创建的最好,没有直接回车 Option client_secret. OAuth Client Secret. Leave blank normally. Enter a value. Press Enter to leave empty. client_secret> #同上一步,没有直接回车 Option scope. Scope that rclone should use when requesting access from drive. Choose a number from below, or type in your own value. Press Enter to leave empty. 1 / Full access all files, excluding Application Data Folder. \ (drive) 2 / Read-only access to file metadata and file contents. \ (drive.readonly) / Access to files created by rclone only. 3 | These are visible in the drive website. | File authorization is revoked when the user deauthorizes the app. \ (drive.file) / Allows read and write access to the Application Data folder. 4 | This is not visible in the drive website. \ (drive.appfolder) / Allows read-only access to file metadata but 5 | does not allow any access to read or download file content. \ (drive.metadata.readonly) scope> 1 #选1,赋予全部权限 Option service_account_file. Service Account Credentials JSON file path. Leave blank normally. Needed only if you want use SA instead of interactive login. Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`. Enter a value. Press Enter to leave empty. service_account_file> #默认直接回车 Edit advanced config? y) Yes n) No (default) y/n> #默认直接回车 Use auto config? * Say Y if not sure * Say N if you are working on a remote or headless machine y) Yes (default) n) No y/n> y #选y,本地主机自动跳转 2022/11/07 21:03:43 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=jPMjvLo8hWORLgz6TALw8A 2022/11/07 21:03:43 NOTICE: Log in and authorize rclone for access 2022/11/07 21:03:43 NOTICE: Waiting for code... > 最后这步如果没有自动跳转,手动复制上面链接:http://127.0.0.1:53682/auth?state=jPMjvLo8hWORLgz6TALw8A浏览器访问进行授权 > 网页授权成功会显示success,然后返回终端,会提示error,不管直接回车 Configure this as a team drive? y) Yes n) No (default) y/n> y #同意装配团队盘 Choose a number from below, or type in your own value: 1 / 影音云端盘\ "0AGfwXXXXXXXXXXXX" 2 / homenet6精英nas盘\ "0AXXXXXXXXXXXXXXX" Enter a Team Drive ID> #键入指定团队盘id y) Yes this is OK (default) e) Edit this remote d) Delete this remote y/e/d> y #确定保存配置 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 #退出配置 #### 至此,Rclone配置成功 ## 挂载 接下来回到vps操作 #### 安装fuse apt install fuse -y #### 创建本地Google drive缓存文件夹 mkdir -p /root/plex > 创建位置随意,记住就好 #### 挂载到/root/plex文件夹 /usr/bin/rclone mount plex: /root/plex \ --no-gzip-encoding \ --no-check-certificate \ --umask 0000 \ --allow-non-empty \ --allow-other & > 我演示的配置名为plex,文件夹路径为/root/plex,根据自己的配置自行调整。 > 格式为:mount rclone配置名: /本地文件夹路径 #### 查看是否成功挂载 df -h > 如显示有/root/plex容量为1P,即代表挂载成功 #### 设置随系统启动自动挂载 cat > /etc/systemd/system/rclone_plex.service <<EOF [Unit] Description=Rclone AssertPathIsDirectory=LocalFolder After=network-online.target [Service] Type=simple ExecStart=/usr/bin/rclone mount plex: /root/plex n \ --no-gzip-encoding \ --no-check-certificate \ --umask 0000 \ --allow-non-empty \ --allow-other ExecStop=/bin/fusermount -u LocalFolder Restart=on-abort User=root [Install] WantedBy=default.target EOF > 以上这段代码按自己的配置调整,只需调整.service前面的名字,还有挂载到本地的路径,然后整体复制到vps回车 #### 重新载入daemon,让新的服务文件生效: systemctl daemon-reload #### 查看rclone_plex.service运行状态: service rclone_plex status > 状态为active (running)代表正确运行 #### 设置开机启动: systemctl enable rclone_plex #### 卸载挂载: fusermount -qzu gdrive 最后修改:2022 年 12 月 03 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 1 文章如果帮到了你,那我可不得了了哇,哈哈哈!