512内存vps安装amh面板,速度起飞,比起宝塔面板现在的臃肿,好的不是一点二点,amh面板实际操作下来,并不难用,但他给人的第一印象是很难入手,你说这是为什么呢?我想是大家习惯了使用宝塔吧,不多废话,直接进入主题。
优点:vps上挂载gd,不占用vps空间
最终实现:因为amh面板网站备份后只能ftp、ssh上传到其他vps备份,也没用这方面插件,此方法,挂载gd后,可以当做vps的本地盘,amh面板操作直接备份到gd云盘,当然你也可以做其他用途
期间有很多坑,自己一步一步填完了,不适合跳着看
一、获取google drive客户端ID和密钥
打开网址:
[ol]https://console.developers.google.com/[/ol]复制代码
点击左上角三个点那里,选择新建项目,随便起个名字,我这里是transfer
在“已启用的API 和服务”下,点击+号启用API和服务,然后搜索drive,然后启用Google Drive API。
返回左侧的OAuth 同意屏幕,单击“配置同意屏幕”按钮(靠近右侧面板的右上角),然后选择“外部”并单击“创建”;在下一个屏幕上,输入“应用程序名称”(“rclone”是OK的);输入“用户支持电子邮件”(您自己的电子邮件是可以的);输入“开发人员联系电子邮件”(您自己的电子邮件正常);然后点击“保存”(所有其他数据都是可选的)。
再次单击左侧面板上的“凭据”以返回到“凭据”屏幕。返回左侧的 凭据 ,点击凭据,然后创建凭据,选择“OAuth 客户端 ID”。
选择“桌面应用程序”的应用程序类型,然后单击“创建”。将显示客户端 ID 和客户端密码。记下来。
转到“Oauth同意屏幕”,然后按“发布应用程序”
二、安装rclone
一键安装(https://rclone.org/downloads/)
[ol]sudo -v ; curl https://rclone.org/install.sh | sudo bash[/ol]复制代码
完成之后,我们输入下面命令进行配置
[ol]rclone config[/ol]复制代码
[ol]No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n #选择n,新建目录
Enter name for new remote.
name> gdrive #随意的名称,回车后出现下列选项,选Google Drive对应的序号
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, IONOS Cloud, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu 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 / In memory object storage system.
\ (memory)
24 / Internet Archive
\ (internetarchive)
25 / Jottacloud
\ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
27 / Local Disk
\ (local)
28 / Mail.ru Cloud
\ (mailru)
29 / Mega
\ (mega)
30 / Microsoft Azure Blob Storage
\ (azureblob)
31 / Microsoft OneDrive
\ (onedrive)
32 / OpenDrive
\ (opendrive)
33 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ (swift)
34 / Oracle Cloud Infrastructure Object Storage
\ (oracleobjectstorage)
35 / Pcloud
\ (pcloud)
36 / Put.io
\ (putio)
37 / QingCloud Object Storage
\ (qingstor)
38 / SMB / CIFS
\ (smb)
39 / SSH/SFTP
\ (sftp)
40 / Sia Decentralized Cloud
\ (sia)
41 / Storj Decentralized Cloud Storage
\ (storj)
42 / Sugarsync
\ (sugarsync)
43 / Transparently chunk/split large files
\ (chunker)
44 / Union merges the contents of several upstream fs
\ (union)
45 / Uptobox
\ (uptobox)
46 / WebDAV
\ (webdav)
47 / Yandex Disk
\ (yandex)
48 / Zoho
\ (zoho)
49 / premiumize.me
\ (premiumizeme)
50 / seafile
\ (seafile)
Storage> 18 #我们这里选18 是google drive,序号会变动
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> #填写你申请OAuth client ID的client_id
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> #填写你申请OAuth client ID的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> n #选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> n #选n,y是官方获取,n是自己windows cmd.exe relone获取
Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
rclone authorize "drive" "eyJjbGllbnRfaffiOiI3NzA5OTIwNzAyNDItczFqMGMzMGdiOGJyNDQ0bjAyMmo0cmNnaTFnb2FyaTUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJjbGllbnRfc2VjcmV0IjoiR09DU1BYLXBjSzZnUGt1UDF5cEYtNlYtemdPYmduaG1HWkciLCJzY29wZSI6ImRyaXZlIn0"
Then paste the result.
Enter a value.
config_token> #填写windows cmd获取的{}的内容(包括大括号)[/ol]复制代码
到这了,没出现网址,那我们直接把用windows cmd.exe获取,授权过的token复制过来就是大括号{}的内容(包括大括号),然后点击回车
windows获取token
这里我准备好了rclone windows版,地址https://rclone.org/downloads/
下载完后,解压rclone windows版,到d:\rclone
把下面这段复制到cmd里回车
[ol]rclone authorize "drive" "eyJjbGllbnRfaffiOiI3NzA5OTIwNzAyNDItczFqMGMzMGdiOGJyNDQ0bjAyMmo0cmNnaTFnb2FyaTUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJjbGllbnRfc2VjcmV0IjoiR09DU1BYLXBjSzZnUGt1UDF5cEYtNlYtemdPYmduaG1HWkciLCJzY29wZSI6ImRyaXZlIn0" //修改为你的代码[/ol]复制代码
就会弹到浏览器去验证你得谷歌号,看到如下的界面,“此应用未经google验证”,不用去管,直接点继续
最后生成token code填到我们配置的config_token,如果这里电脑端的cmd一直卡在Waiting for code… Got
code就不动了的话,然后最后报错个超时,不生成token code,就看下面的这一篇有解决方法
解决Rclone生成不了token code的问题
写这一篇又是费了很多脑细胞,配置Rclone的配置环节又出了问题,新版的和老版本的还不一样,没法URL直接到 浏览器来然后返回个verification_code,这就引来了下文如果让Rclone可以正常的生成token code方法。
默认情况下,使用rclone的windows版本来生成那绝对生成不出来,报错信息
[ol]Error: failed to get token: Post "https://oauth2.googleapis.com/token": dial tcp 172.217.163.42:443: i/o timeout[/ol]复制代码
具体可以看下图
即使开着v2ray也是无济于事,cmd没走代理。这里我v2ray的端口是2333,如果和我一样,那就复制了往里敲
[ol]# 使用sock5代理
set http_proxy=socks5://127.0.0.1:2333
set https_proxy=socks5://127.0.0.1:2333[/ol]复制代码
配置完之后,我们再跑一边就显示出来了
取消sock5代理
[ol]set http_proxy=
set https_proxy=[/ol]复制代码