网站核验单 没有网站 怎么办,980网站,wordpress点击阅读全部,重庆网站建设搜外Created by Dave On 8Feb.2025
起因#xff1a;
想下载 StableDiffusion#xff0c;清理系统文件时把 i/o 搞到 100%#xff0c;已经删除到 apt 缓存#xff0c;还差 89MB#xff0c;只能另想办法。 在网上找能不能挂在 Google 网盘#xff0c;百度网盘#xff0c;或 …Created by Dave On 8Feb.2025
起因
想下载 StableDiffusion清理系统文件时把 i/o 搞到 100%已经删除到 apt 缓存还差 89MB只能另想办法。 在网上找能不能挂在 Google 网盘百度网盘或 One Driver 也行。看了看文档准备用 google-drive-ocamlfuse 工具实现在 Ubuntu 中加载谷歌网盘。 官方仓库: GitHub - astrada/google-drive-ocamlfuse: FUSE filesystem over Google Drive 在 Ubuntu 上使用 Google Drive 网盘
我不保证这个软件 google-drive-ocamlfuse 的安全性
1. 先添加源
sudo add-apt-repository ppa:alessandro-strada/ppa2. 安装 google-drive-ocamlfuseFUSE
sudo apt install google-drive-ocamlfuse
sudo apt install fuse 3. 授权访问 Google Drive
这个过程有些复杂需要在 Google 控制台上操作 访问https://console.cloud.google.com
本想介绍一下但可以写一篇文章不但照下面一步步做也能体会到。就不献丑了。
1创建一个项目看图中的箭头 2创建个项目ggdrive
名字随便起方便阅读我用 ggdrive 3创建可以操作网盘的 API
在控制台搜索 google drive 找到 Google Drive API 4创建 API
点 ENABLE 进入界面 点右上角的 CREATE CREDENTAILS (创建证书) 要访问自己的网盘选 Application data 描述一下 选个角儿 点“CONTINUE 继续操作 如果有分配自己定义 最后点 DONE 完成 5在哪儿找到 API 6Client ID
点击后展开高级设置可以找到 Client ID 这个是我们需要的。
7下载服务账号密钥 8创建 KEY 选 JSON 格式 成功后如图 9下载 .json 文件
在下载目录中找 10使用 json 文件登录
文件放到 Ubuntu:/root/scripts/ggdrive-key.json (发文时已经换位置)
google-drive-ocamlfuse -headless -serviceaccountpath /root/scripts/ggdrive-key.json /root/ggdrive
11验证
现在 Google Drive 已经加载到 /root/ggdrive 目录 4. 设置开机自动加载
1创建配置文件
vi /etc/systemd/system/google-drive.service
2文件内容
我的 JSON 文件名ggdrive-key.json 用实际的替换。
[Unit]
DescriptionGoogle Drive FUSE mount
Afternetwork-online.target
Wantsnetwork-online.target[Service]
Typesimple
Userroot
ExecStartPre/bin/mkdir -p /root/ggdrive
ExecStart/usr/bin/google-drive-ocamlfuse -d -o nonempty -serviceaccountpath /root/scripts/ggdrive-key.json /root/ggdrive
ExecStop/bin/bash -c umount -l /root/ggdrive || true
Restarton-failure
RestartSec30
TimeoutStopSec20[Install]
WantedBymulti-user.target 5. Google Drive 上配置文件权限
最好在网页登录比较直观。 在搜索框填入上一步下载的 ggdrive-key.json 文件中记录的 服务账号daven-jpn-srvggdrive-********t.com并给它 EDITOR 修改权限。 6. 获取目录 ID
最后几步。 在浏览器打开这个文件夹获得目录 ID 7. 更新配置文件
完成这两步目录ID添加权限后就可以更新配置文件并重启服务了
cat ~/.gdfuse/default/config EOF
service_account_credentials_path/root/scripts/ 下载的 JSON 文件
root_folder目录ID
umask0o022
EOF 8. 载入daemon、启用新服务、开启服务、查看服务
systemctl daemon-reload
systemctl enable google-drive
systemctl start google-drive
systemctl status google-drive 6. 验证 网盘的目录中已经有另一个帐号上传的文件。 缺点
比较慢太慢