参考萌鼠大佬博客文章

使用rclone挂载GD

DebianUbuntu系统

wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh

centos系统

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

初始化rclone配置

rclone config
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> Rats  #配置名称,随便填
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 / Dropbox
   \ "dropbox"
 9 / Encrypt/Decrypt a remote
   \ "crypt"
10 / FTP Connection
   \ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
12 / Google Drive
   \ "drive"
13 / Google Photos
   \ "google photos"
14 / Hubic
   \ "hubic"
15 / JottaCloud
   \ "jottacloud"
16 / Koofr
   \ "koofr"
17 / Local Disk
   \ "local"
18 / Mega
   \ "mega"
19 / Microsoft Azure Blob Storage
   \ "azureblob"
20 / Microsoft OneDrive
   \ "onedrive"
21 / OpenDrive
   \ "opendrive"
22 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
23 / Pcloud
   \ "pcloud"
24 / Put.io
   \ "putio"
25 / QingCloud Object Storage
   \ "qingstor"
26 / SSH/SFTP Connection
   \ "sftp"
27 / Union merges the contents of several remotes
   \ "union"
28 / Webdav
   \ "webdav"
29 / Yandex Disk
   \ "yandex"
30 / http Connection
   \ "http"
31 / premiumize.me
   \ "premiumizeme"
Storage> 12  #选择12,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>  #留空
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> 1 
ID of the root folder
Leave blank normally.
Fill in to access "Computers" folders. (see docs).
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> 
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n  #输入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
n) No
y/n> n  #输入n
If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/  #打开该地址获取code
Log in and authorize rclone for access
Enter verification code>hjdd  #输入你获取到的code
Configure this as a team drive?
y) Yes
n) No
y/n> n  #输入n
--------------------
[Rats]
type = drive
client_id = 85042871
client_secret = D72gPc
scope = drive
token = {"access_token":"y902Z"}
--------------------
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保存退出

挂载到本地目录

/usr/bin/rclone mount DriveName:Folder LocalFolder
DriveName为Rclone的配置名称,比如你配置rclone的时候,Name填的Rats
Folder为网盘里的文件夹路径,如果你要挂载整个网盘,直接填/挂载整个根目录
LocalFolder为本地服务器上的挂载文件夹,如果你需要将网盘的文件夹挂载到服务器上的/Drive文件夹,那就填/Drive
#记得修改DriveName:Folder和LocalFolder的值
/usr/bin/rclone mount DriveName:Folder LocalFolder \
 --umask 0000 \
 --default-permissions \
 --allow-non-empty \
 --allow-other \
 --buffer-size 32M \
 --dir-cache-time 12h \
 --vfs-read-chunk-size 64M \
 --vfs-read-chunk-size-limit 1G

测试是否挂载成功

df -h

开机自启

使用Systemctl守护进程,也只适用于CentOS 7Debian 8+Ubuntu 16+

#以下是一整条命令,先修改DriveName:Folder和LocalFolder的值,再一起复制到SSH客户端运行
cat > /etc/systemd/system/rclone.service <<EOF
[Unit]
Description=Rclone
AssertPathIsDirectory=LocalFolder
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/rclone mount DriveName:Folder LocalFolder \
 --umask 0000 \
 --default-permissions \
 --allow-non-empty \
 --allow-other \
 --buffer-size 32M \
 --dir-cache-time 12h \
 --vfs-read-chunk-size 64M \
 --vfs-read-chunk-size-limit 1G
ExecStop=/bin/fusermount -u LocalFolder
Restart=on-abort
User=root

[Install]
WantedBy=default.target
EOF

命令

systemctl enable rclone开机自启
systemctl start rclone 启动
systemctl restart rclone 重启
systemctl stop rclone 停止
systemctl status rclone 查看状态

安装Plex

#CentOS系统
yum -y update && yum -y install wget
wget https://downloads.plex.tv/plex-media-server/1.12.1.4885-1046ba85f/plexmediaserver-1.12.1.4885-1046ba85f.x86_64.rpm
yum install plexmediaserver*.rpm

#Debian/Ubuntu系统
apt-get -y update && apt-get -y upgrade
wget https://downloads.plex.tv/plex-media-server/1.5.5.3634-995f1dead/plexmediaserver_1.5.5.3634-995f1dead_amd64.deb
dpkg -i plexmediaserver*.deb

Docker安装方法请参考官方GitHub的说明:https://github.com/plexinc/pms-docker

设置Plex开机启动

systemctl enable plexmediaserver.service
systemctl start plexmediaserver.service

安装完成后进入http://IP:32400/就行了。如果无法访问,先检查运行状态,后查看防火墙和端口。

systemctl status plexmediaserver 查看plex状态

第一次进入应用界面,会显示“找不到服务器。 下载并安装Plex Media Server,它会显示在这里”。因为初次使用是不允许远程访问Plex的,这里我们可以使用SSH转发端口来解决这个问题。

本地运行命令  ssh root@服务器IP -L 8888:localhost:32400

第一次链接成功后,下次就不需要用SSH转发进入了,直接通过http://IP:32400/访问就可以了。

运行成功后, 再去浏览器里打开localhost:8888/web进入即可。

安装完成后说说使用感受

自动根据电影名字查找IMDB信息,对于国外电影很有用,国内电影识别率不高,且有个严重问题,也可能是我配置问题,按文件展示时无法识别电视剧。按文件夹展示时国产电视剧基本瞎识别。

web端是完全体,使用无障碍。

因为我的垃圾PR登不上去,所以图片放不了。

Android客户端及IOS客户端都是个残废,要使用完整功能需购买APP否则只能播放10分钟视频。

同步播放确实好用,就我体验的三个平台来说,没有问题。

终上所述,如果你有闲钱,能折腾,并且对影音方面有很高的需求,否则不建议安装。

VPS建议配置

  • 2H2G
  • 最少1T流量
  • 网络要好,因为走得基本是VPS流量。(垃圾PR是我见过哦网络最差的了,不要买)

情深不壽,強極則辱。謙謙君子,溫潤如玉。