简言：因为家用NAS可能面临断电，或是出差环境下无法使用的问题，研究了一下使用低配vps搭建plex家用流媒体，Rclone挂载，目前使用效果优秀。使用Centos7 64位系统，开启BBRPlus，配置如下：Processor : Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHzCPU cores : 2 @ 1999.999 MHzAES-NI : ? EnabledVM-x/AMD-V : ? DisabledRAM : 984.5 MiBSwap : 0.0 KiBDisk : 19.6 GiB教程开始：一、下载plex并安装：https://www.plex.tv/media-server-downloads/1、rpm命令安装PLEX：wget https://downloads.plex.tv/plex-media-server-new/1.25.1.5286-34f965be8/redhat/plexmediaserver-1.25.1.5286-34f965be8.x86_64.rpm rpm -ivh plexmediaserver-1.25.1.5286-34f965be8.x86_64.rpm2、安装完成后使用xshell做本地端口转发登录网页端plex继续安装，参考下图。注意！必须先本地转发登录才能完成安装，否则是无法发现plex服务器的！3、设置完成后使用xshell重新登录vps，打开浏览器并输入下面地址，登录账号并继续安装http://127.0.0.1:32400/web二、安装Rclone并挂载OneDrive：https://rclone.org/install/1、官网安装命令：curl https://rclone.org/install.sh | sudo bash2、安装fuse（挂载位本地硬盘必须有fuse支持，否则运行挂载命令会报错）：yum -y install fuse3、安装完成后在任意目录可使用下列命令进行管理（如果是手动新建挂载的话相关管理方式和之前一样，参考这篇文章）：rclone config4、获取授权，并将OD添加进Rclone方式一、获取授权参考下列地址：[post cid="64" /]方式二、如果有配置好的授权和rclone.conf文件，像我一样直接创建配置文件即可：vi /root/.config/rclone/rclone.conf粘贴备份好的rclone配置并保存（做好access_token的备份，后续重新挂载直接新建配置文件保存就行啦）：#Onedrive家庭版 [od] type = onedrive region = global token = {"access_token":"[binary]:"2021-11-08T11:36:07.9934596+08:00"} drive_id = 982asdasdasdasdasd drive_type = personal5、Rclone挂载命令：#新建本地文件夹，路径自己定，即下面的LocalFolder，自行替换 mkdir /LocalFolder #挂载为磁盘，下面的DriveName、Folder、LocalFolder参数根据说明自行替换 rclone mount DriveName:Folder LocalFolder --allow-non-empty --no-gzip-encoding --umask 000 --allow-other --attr-timeout 10m --vfs-cache-mode full --vfs-cache-max-age 1m --vfs-read-chunk-size-limit 100M --buffer-size 100M --vfs-cache-max-size 10G这里可以参考我的挂载命令（挂载od配置，挂载od根目录，映射本地地址为/OneDrive）：rclone mount od: /OneDrive --allow-non-empty --no-gzip-encoding --umask 000 --allow-other --attr-timeout 10m --vfs-cache-mode full --vfs-cache-max-age 1m --vfs-read-chunk-size-limit 100M --buffer-size 100M --vfs-cache-max-size 10G三、注意事项：1、小鸡配置较低，不可以在服务器上转码，对vps到本地网络要求较高，直接设置原画播放，plex设置参考下图：2、新建本地挂载文件夹时必须在根目录下新建，在root目录下新建可能导致plex服务端无法读取挂载好的文件3、部分挂载参数解析--vfs-cache-mode full #开启vfs缓存，此缓存占用本地存储空间 --vfs-cache-max-age 1m #缓存时间，建议设置小一点，要不切视频可能导致我的20g被占满 --vfs-read-chunk-size-limit 100M #缓存块大小，每次块达到100M都会重新调用OD的API，设置大些可以减少调用，按需设置 --vfs-cache-max-size 10G #最大缓存大小，我设置10G，不会占满我的20g小盘4、如果本地磁盘被缓存占满了会导致plex那边无法放视频，手动删除如下路径缓存文件即可：5、网页端放视频有的打的视频只能转码播放，注意下OD里存储的视频源格式，或者直接使用客户端播放，实测我用电视盒子安装plex安装客户端串流mp4格式4k视频稳定的一比。6、刮削器建议使用默认的plex tv即可，刮削的不对就用“修正匹配”功能手动刮削一下。7、两个文件夹内的剧集被识别成一个怎么办?手动分离并手动选择剧集信息即可。下图红圈位置有两个文件就是不对的，注意不要删除文件！！！在剧集选项里选择分离即可！！8、如何退出后重新挂载？退出rclone后挂载目录权限还在，是无法删除和使用的，先使用Ctrl+c退出挂载，然后使用下面命令取消挂载目录即可。（下面命令的路径是我在用的，按需修改）fusermount -qzu /OneDrive成品效果[scode type="green"]本文转载自：LBLOG[/scode]
说明：Linux服务器上下载了好多资源。但是Linux没有onedrive和google drive的客户端。那么如何把vps上的文件传到onedrive呢。这里我们可以用rclone这个工具。安装Rclone第一步：下载windows对应位数的压缩包解压到D:\rclone[button color="dark" icon="fontello fontello-sign-in" url="https://rclone.org/downloads"]点击下载Rclone[/button]管理员命令提示符（cmd）输入下面的命令，回车cd /d d:\rclone rclone authorize "onedrive"会自动打开浏览器让你登录你的onedrive账户点击授权后浏览器显示如图回到cmd，发现多了一大串字符。复制花括号里的所有字符，新建一个文档保存，一会要用。第二步：开始配置Linux端打开你的SHH工具连接vps，我的是debian系统，输入：apt-get update apt-get install -y unzip 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-* 然后输入： rclone config 即可调出配置信息第三步：新建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 显示如下 name> 这里我们起个名字第四步：出现一堆网盘序号Type of storage to configure. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / 1Fichier \ "fichier" 2 / Alias for an existing remote \ "alias" 3 / Amazon Drive \ "amazon cloud drive" 4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc) \ "s3" 5 / Backblaze B2 \ "b2" 6 / Box \ "box" 7 / Cache a remote \ "cache" 8 / Citrix Sharefile \ "sharefile" 9 / Dropbox \ "dropbox" 10 / Encrypt/Decrypt a remote \ "crypt" 11 / FTP Connection \ "ftp" 12 / Google Cloud Storage (this is not Google Drive) \ "google cloud storage" 13 / Google Drive \ "drive" 14 / Google Photos \ "google photos" 15 / Hubic \ "hubic" 16 / In memory object storage system. \ "memory" 17 / JottaCloud \ "jottacloud" 18 / Koofr \ "koofr" 19 / Local Disk \ "local" 20 / Mail.ru Cloud \ "mailru" 21 / Mega \ "mega" 22 / Microsoft Azure Blob Storage \ "azureblob" 23 / Microsoft OneDrive \ "onedrive" 24 / OpenDrive \ "opendrive" 25 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH) \ "swift" 26 / Pcloud \ "pcloud" 27 / Put.io \ "putio" 28 / QingCloud Object Storage \ "qingstor" 29 / SSH/SFTP Connection \ "sftp" 30 / Sugarsync \ "sugarsync" 31 / Transparently chunk/split large files \ "chunker" 32 / Union merges the contents of several remotes \ "union" 33 / Webdav \ "webdav" 34 / Yandex Disk \ "yandex" 35 / http Connection \ "http" 36 / premiumize.me \ "premiumizeme" Storage> 找到对应的序号，我这里onedrive是23号。 输入23回车第五步：接下来** See help for onedrive backend at: https://rclone.org/onedrive/ ** Microsoft App Client Id Leave blank normally. Enter a string value. Press Enter for the default (""). client_id> 默认空着，直接回车 Microsoft App Client Secret Leave blank normally. Enter a string value. Press Enter for the default (""). client_secret> 默认空着，直接回车Microsoft App Client Secret Leave blank normally. Enter a string value. Press Enter for the default (""). client_secret> Edit advanced config? (y/n) y) Yes n) No (default) y/n> 这里选择nRemote config 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> 选择nFor this to work, you will need rclone available on a machine that has a web browser available. Execute the following on your machine (same rclone version recommended) : rclone authorize "onedrive" Then paste the result below: result> 这里我们输入刚才复制的一大堆字符串Choose a number from below, or type in an existing value 1 / OneDrive Personal or Business \ "onedrive" 2 / Root Sharepoint site \ "sharepoint" 3 / Type in driveID \ "driveid" 4 / Type in SiteID \ "siteid" 5 / Search a Sharepoint site \ "search" Your choice> 这里输入1 Found 1 drives, please select the one you want to use: 0: OneDrive (business) id=b!5aaxzEKnQ0moUdSJN5FFiz18jOg3bKJDpnlLne7FeEjh0fnzsP3TSIpazFa4zHn9 Chose drive to use:> 这里显示出来了网盘序号，输入0Found drive 'root' of type 'business', URL: https://ememe-my.sharepoint.com/personal/admin_ememe_onmicrosoft_com/Documents Is that okay? y) Yes (default) n) No y/n> 配置好了。输入y drive_id = b!5aaxzEKnQ0moUdSJN5FFiz18jOg3bKJDpnlLne7FeEjh0fnzsP3TSIpazFa4zHn9 drive_type = business -------------------- y) Yes this is OK (default) e) Edit this remote d) Delete this remote y/e/d 到这里我就就已经配置完成，输入y 然后就没事了。输入q退出rclone就行第六步：别忘了还需要安装个screenapt-get install -y screen //这是debian系 centos系安装screen需要使用yum install screen上传命令rclone move source:path dest:path //别急看完下面的 screen rclone move /root/download onedrive1:/upload --transfers 32 -P //完整的命令参数详解：source:path是本地目录，dest:path是云端目录 其中dest是网盘名称，就你刚才随便取的那个path就是目录 你可以指定上传到哪一个文件夹 比如说， 我要把本地的/root/download目录下所有的文件移动到onedrive里面的/upload文件夹里面 命令应该是rclone move /root/download onedrive1:/upload 但是这样上传的话，他一直在前台上传,占用你的ssh。 想让他变成后台，在前面加上screen 命令就是：screen rclone move /root/download onedrive1:/upload 这样你就可以关掉ssh，他就可以在后台上传 如果文件目录比较复杂，而且文件数量庞大 可以提高线程，他默认是4线程，测试后发现100M带宽32线程效果最好。（根据你的vps而定线程。） 可以在后面再加一个参数 -P（大写）显示上传详情 screen rclone move /root/download onedrive1:/upload –transfers 32 -P screen 等你想看看传完了没有的时候, screen -ls就可以看到后台screen进程。配置Google Drive盘google drive盘有区分个人盘和团队盘1.配置这里我们先配置个人盘，团队盘也同理。输入 rclone config输入 n提示如下：给本次配置的网盘起个名字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 name> 这网盘起个名字12 / Google Cloud Storage (this is not Google Drive) \ "google cloud storage" 13 / Google Drive \ "drive" 14 / Google Photos \ "google photos" 选择13** See help for drive backend at: https://rclone.org/drive/ ** 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 string value. Press Enter for the default (""). client_id> 空着就行，回车 建议：会搞得，强烈建议用自己的私有API，效率会大大增加Google Application Client Secret Setting your own is recommended. Enter a string value. Press Enter for the default (""). client_secret> 空着，就行Scope that rclone should use when requesting access from drive. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 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> 输入1ID of the root folder Leave blank normally. Fill in to access "Computers" folders (see docs), or for rclone to use a non root folder as its starting point. Note that if this is blank, the first time rclone runs it will fill it in with the ID of the root folder. Enter a string value. Press Enter for the default (""). root_folder_id> 空着，回车Service Account Credentials JSON file path Leave blank normally. Needed only if you want use SA instead of interactive login. Enter a string value. Press Enter for the default (""). service_account_file> 空着，回车Service Account Credentials JSON file path Leave blank normally. Needed only if you want use SA instead of interactive login. Enter a string value. Press Enter for the default (""). service_account_file> Edit advanced config? (y/n) y) Yes n) No (default) y/n> 空着，回车Remote config 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> 输入nPlease go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id20264815644.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awgoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=kXGnW8AtxDZinUY7auTP9w Log in and authorize rclone for access Enter verification code> 把提示的这个连接放到浏览器打开授权允许，出现这个代码，复制粘贴到SSH工具，回车Configure this as a team drive? y) Yes n) No (default) y/n> 注意注意注意,配置个人盘就输入n，配置团队盘输入y[google_hy] type = drive scope = drive token = {"access_token":"ya29.Il-9B-x15fy1sfTMSML-MkqVgTq2W0W_VVqluwoWXuioeglrF-LnjinhMGDyqa0HDk0SYTvXkAMZviYx2yM40AnMl4IK-3QhAf1FE54X2hVOiIuDpiRsU3oClksw","token_type":"Bearer","refresh_token":"1//03ztJYkqbqDnuCgYIARAAGAMSNwF-L9IrKCRqVpsgKMqWSa0an_uMblaHiJS-FPCB9T6lGj2taVQ0U7og5m3z1FOuC-UlNDJL204","expiry":"2020-02-07T14:13:26.261934522Z"} team_drive = 0ANzkcvxKCBWaUk9PVA -------------------- y) Yes this is OK (default) e) Edit this remote d) Delete this remote y/e/d> 到这里就完成个人盘的配置了。2.上传还需要安装个screenapt-get install -y screen上传命令screen rclone move /1/aria2/ onedrive_rive:/upload --transfers 32 -P