Ubuntu安装oneDrive

该文章指导如何在Ubuntu20.04上安装OneDrive客户端,包括添加源、安装软件、修改配置、设置同步路径和时间间隔,以及通过systemctl进行服务管理,实现后台自动同步。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Ubuntu安装oneDrive

安装oneDrive

wget -qO - https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_20.04/Release.key | sudo apt-key add -
echo 'deb https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_20.04/ ./' | sudo tee /etc/apt/sources.list.d/onedrive.list
sudo apt-get update
sudo apt install onedrive

修改配置

文件同步路径可以修改config文件中的sync_dir参数
更新间隔时间可以修改config文件中的monitor_interval参数

// 生成配置目录
mkdir -p ~/.config/onedrive
// 下载配置
wget https://raw.githubusercontent.com/abraunegg/onedrive/master/config -O ~/.config/onedrive/config
// 修改配置
vi ~/.config/onedrive/config

创建log文件

sudo mkdir /var/log/onedrive
sudo chmod 777 /var/log/onedrive
sudo usermod -a -G users <your-user-name>

配置云端账户

命令行输入onedrive,会弹出认证网站,复制网址在浏览器中打开,并登陆,登录成功后再将最后的网址粘贴回来,显示成功即可

开始同步

// 在正式运行前,可以先输入下列命令看看运行结果而不对系统产生变化,即dry run.
onedrive --dry-run --synchronize

// 如果dry run符合你的预期,那么便可以正式运行啦,输入下列命令.
onedrive --synchronize --verbose --resync --local-first

启动后台服务

将文件下载好,初始化完毕后,执行以下命令开启自动同步功能

普通用户

systemctl --user enable onedrive
systemctl --user start onedrive
# 查看日志
journalctl --user-unit=onedrive -f

root用户

systemctl enable onedrive
systemctl start onedrive
# 查看日志
journalctl --unit=onedrive -f
//开启后台服务
systemctl --user enable onedrive
// 开启
systemctl --user start onedrive

// 停止
systemctl --user stop onedrive

//查看日志
journalctl --user-unit=onedrive -f
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值