┌─────────────┐ ┌─────────────┐ ┌──────────────┐
│ iCloud │ ◄═══► │ vdirsyncer │ ◄═══► │ Radicale │
│ CalDAV │ │ (同步引擎) │ │ (本地CalDAV) │
└─────────────┘ └─────────────┘ └──────────────┘
▲ ▲
│ iPhone 自动同步 │
└──────────────────── ◄────────────────────────────┘
| 文件 | 说明 |
|---|---|
setup.sh |
一键部署脚本(安装+配置+首次同步+定时任务) |
radicale.conf |
Radicale 配置模板,部署到 /etc/radicale/config |
vdirsyncer.conf |
vdirsyncer 配置模板,部署到 ~/.config/vdirsyncer/config |
vdirsyncer-sync.service |
systemd service 单元,部署到 /etc/systemd/system/ |
vdirsyncer-sync.timer |
systemd timer 单元,部署到 /etc/systemd/system/ |
- 编辑
setup.sh顶部的配置变量(Radicale 用户名/密码、Apple ID、App 专用密码) - 运行
chmod +x setup.sh && ./setup.sh - 如需同步多个日历,修改
vdirsyncer.conf添加[pair]段
# 安装
sudo dnf install -y radicale vdirsyncer
# Radicale 用户(必须用 -B 生成 bcrypt)
sudo htpasswd -Bbc /etc/radicale/users <USERNAME> <PASSWORD>
# iCloud App 专用密码
echo '<APP_SPECIFIC_PASSWORD>' > ~/.config/vdirsyncer/icloud_pass
chmod 600 ~/.config/vdirsyncer/icloud_pass
# 发现 + 首次同步
yes | vdirsyncer discover
vdirsyncer sync
# 日常命令
vdirsyncer sync # 手动同步
journalctl -u vdirsyncer-sync -f # 查看同步日志
systemctl list-timers # 查看定时器- 登录 appleid.apple.com
- 进入「登录与安全」→「App 专用密码」
- 点击「创建 App 专用密码」,输入标签名(如
vdirsyncer) - 复制生成的密码(格式为
xxxx-xxxx-xxxx-xxxx),填入配置
注意:需要先开启双重认证(Two-Factor Authentication)才能看到 App 专用密码选项。
- iCloud CalDAV 必须使用 App 专用密码,不能用 Apple ID 主密码
- htpasswd 必须用
-B(bcrypt),Radicale 不认 apr1 (MD5) - vdirsyncer collections 三元组格式:
[["配置名", "A端collection", "B端collection"]] item_types设为["VEVENT", "VJOURNAL"]可过滤掉 iCloud 的 Reminders (VTODO)- 冲突解决策略:
["command", "vimdiff"](手动)/"a wins"/"b wins"(自动)