Ubuntu 安装 OneDrive
1. 安装
- 安装必要的依赖
sudo apt update sudo apt install build-essential libcurl4-openssl-dev libsqlite3-dev pkg-config git curl - 克隆仓库
git clone https://github.com/abraunegg/onedrive.git - 编译安装
cd onedrive ./configure make sudo make install - 配置账号
终端运行onedrive来启动配置过程,并按照提示进行。它将要求你在浏览器中登录到你的 OneDrive 帐户并获取授权代码。
复制浏览器中显示的代码,粘贴到终端中,以完成认证。
代码格式:https://login.microsoftonline.com/common/oauth2/nativeclient?code=xxxxxx将 ?及之后的复制。
2. 同步
- 创建配置文件,可以指定过滤哪些文件或文件夹
然后填入以下的内容:touch ~/.config/onedrive/config# Set the directory where your OneDrive files will be stored locally sync_dir = "~/OneDrive" # Skip all .mp3 and .tmp files # skip_file = ".*.mp3|.*.tmp" # Skip directories named temp or backup # skip_dir = "temp|Temp|backup|Backup" - 创建 sync_list 指定只同步某些文件夹
然后填入以下的内容touch ~/.config/onedrive/sync_list文档/MyTypora Code - 执行同步
onedrive --synchronize # 适合于需要偶尔进行同步的情况,如手动触发同步 # 或 onedrive --monitor # 适合于需要常驻后台,持续同步数据的情况

浙公网安备 33010602011771号