changedetection.io 0.60.9 Ubuntu 22.04 安装指南
在 Ubuntu 22.04 上从零安装 changedetection.io 0.60.9 网页变更监控服务,覆盖 Python 3.11 venv 主线安装、systemd 托管、升级、备份与卸载全流程,全部命令实测通过。
changedetection.io 0.60.9 Ubuntu 22.04 安装指南
目标:在一台全新的 Ubuntu 22.04 服务器上,从零安装 changedetection.io 网页变更监控服务并完成 systemd 托管、验证、升级与卸载。全部命令已在 Ubuntu 22.04.5 LTS(x86_64)真实环境逐条实测通过,changedetection.io 版本为 0.60.9。
changedetection.io(GitHub 25k+ star)是一个 Python Flask 编写的网页变更监控服务:监控任意 URL 的内容变化,支持 CSS/JSON/XPath 过滤、基于 Chrome 的浏览器渲染监控、价格追踪,并通过 Apprise 向邮件/Telegram/Webhook 等近百种渠道发送差异告警,同时提供 REST API 与 RSS 输出。
一、环境信息
本篇所有命令在以下环境中实测通过,读者按相同版本操作可直接复现回显:
- 操作系统:Ubuntu 22.04.5 LTS(x86_64),
PRETTY_NAME="Ubuntu 22.04.5 LTS" - 系统自带 Python:3.10.12(
python3 --version实测) - 目标软件:changedetection.io 0.60.9(2026 年 10 月 PyPI 最新版)
- 安装方式:pip + venv(虚拟环境安装,官方推荐方式)
- 数据目录:
/opt/changedetection/data - 服务端口:5000(Flask 默认)
- 托管方式:systemd(服务名
changedetection.service)
💡 说明:changedetection.io 0.56.0 起要求 Python ≥ 3.11,而 Ubuntu 22.04 自带 Python 3.10,因此本篇主线先安装 Python 3.11 再装服务。这一版本要求是安装本组件最关键的坑,详见「三、版本选型说明」。
二、前置条件
安装前需要确认系统的基础工具与网络可用性。以下命令逐条执行并核对回显。
2.1 更新软件源索引
apt-get update -qq && echo EXIT=$?
实测回显(-qq 静默模式下无输出,退出码 0 即成功):
EXIT=0
2.2 安装基础工具与 Python 3.10 的 pip
Ubuntu 22.04 默认没有 pip,先装 python3-pip、python3-venv(步骤五的方案 B 会直接用到;venv 主线也需要它确保 venv 模块可用):
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq python3-pip python3-venv
实测回显(输出节选):
Setting up python3-dev (3.10.6-1~22.04.1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.15) ...
验证 pip 版本:
pip3 --version
实测回显:
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
2.3 确认系统默认 Python 版本
python3 --version
实测回显:
Python 3.10.12
⚠️ 注意:如果这一步输出不是 3.10.x 而是 3.11 及以上(例如 Ubuntu 24.04),可以跳过「四、方案 A」中的 Python 3.11 安装步骤,直接用系统 Python 创建 venv。
三、版本选型说明
changedetection.io 发版节奏很快(约每 1~2 周一个补丁版),版本选择前先明确两条硬约束。
3.1 Python 版本约束(关键)
changedetection.io 0.56.0 起在 PyPI 元数据中声明 requires_python >=3.11。在 Ubuntu 22.04 自带的 Python 3.10 环境里直接 pip3 install changedetection.io,pip 不会报错,而是静默降级安装最后一个支持 Python 3.10 的旧版本 0.55.8,实测回显(输出节选):
Installing collected packages: ... changedetection.io
Successfully installed Flask-Babel-4.0.0 ... changedetection.io-0.55.8 ...
这一行为没有任何报错提示,极易在不知情的情况下装到一年前的旧版本。选型结论:
- 想要最新版(0.60.x):必须用 Python 3.11+,走本篇方案 A;
- 明确接受旧版 0.55.8(功能可用但不再更新):可以直接用系统 Python 3.10,走方案 B。
3.2 查询 PyPI 最新版本
安装前先确认当前最新版本号:
pip index versions changedetection.io 2>/dev/null | head -2
实测回显(2026 年 10 月 17 日,输出节选,完整列表很长只保留首部):
changedetection.io (0.60.9)
Available versions: 0.60.9, 0.60.8, 0.60.7, 0.60.6, 0.60.5, 0.60.4, 0.60.3, 0.60.2, 0.55.8, 0.55.7, 0.55.6, 0.55.5, 0.55.4, 0.55.3, 0.55.2, 0.55.1, 0.54.10, ...
从版本列表可以看到清晰的分界:0.60.x 之后紧接 0.55.x,中间的 0.56~0.59 未发布到 PyPI(这些版本只发布了 Docker 镜像),所以 Python 3.10 环境最高只能装到 0.55.8。
3.3 版本与 Python 对应关系表
| changedetection.io 版本 | 要求 Python | Ubuntu 22.04 可用性 | 说明 |
|---|---|---|---|
| 0.60.9(最新) | ≥ 3.11 | 需先装 Python 3.11(方案 A) | 官方当前主线,Docker 镜像同版本 |
| 0.55.8 | ≥ 3.9 | 直接可用(方案 B) | PyPI 上最后一个支持 3.10 的版本 |
| 更早版本 | ≥ 3.9 | 直接可用 | 仅老系统兼容场景使用 |
💡 技术拓展:Python 多版本共存的常见方案对比——
方案 原理 适用场景 deadsnakes PPA Ubuntu 官方维护的旧版/新版 Python 软件源 本篇采用,apt 管理、升级干净 pyenv 用户态编译多版本 Python,按目录切换 需要频繁切换多版本开发环境 源码编译安装 make altinstall装到 /usr/local离线环境、需自定义编译参数 Conda/Miniconda 独立环境管理器 数据科学场景居多 本篇采用 deadsnakes PPA:它与 apt 生态一致、升级随系统走,且 PPA 由 Ubuntu 官方 Python 团队(python.dev 成员)维护,是 Ubuntu 服务器上补装新 Python 的标准做法。
四、方案 A:Python 3.11 venv 安装最新版(推荐)
本方案是官方推荐的安装形态:独立 Python 3.11 + 虚拟环境 + pip 安装 + systemd 托管。全程约 5~10 分钟(视网络下载速度)。
4.1 安装 Python 3.11(deadsnakes PPA)
先安装添加软件源所需的工具:
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq software-properties-common
实测回显(输出节选):
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
添加 deadsnakes PPA 软件源:
add-apt-repository -y ppa:deadsnakes/ppa
实测回显(输出节选):
Adding deb entry to /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa-jammy.list
Adding key to /etc/apt/trusted.gpg.d/deadsnakes-ubuntu-ppa.gpg with fingerprint F23C5A6CF475977595C89F51BA6932366A755776
刷新索引并安装 Python 3.11 及 venv/dev 模块(dev 头文件用于个别依赖的源码编译):
apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq python3.11 python3.11-venv python3.11-dev
实测回显(输出节选):
Setting up python3.11-dev (3.11.17-1+jammy1) ...
验证版本:
python3.11 --version
实测回显:
Python 3.11.17
4.2 创建安装目录与虚拟环境
把程序与数据集中放在 /opt/changedetection:
mkdir -p /opt/changedetection && python3.11 -m venv /opt/changedetection/venv
实测回显:无输出(成功)。
确认 venv 内的 pip 已指向 Python 3.11:
/opt/changedetection/venv/bin/pip --version
实测回显:
pip 24.0 from /opt/changedetection/venv/lib/python3.11/site-packages/pip (python 3.11)
升级 venv 内 pip 到最新(可选但建议):
/opt/changedetection/venv/bin/pip install --upgrade pip -q
实测回显:无输出(-q 静默,成功)。
4.3 安装 changedetection.io
/opt/changedetection/venv/bin/pip install changedetection.io
实测回显(依赖约 180 个包,输出节选):
Installing collected packages: timeago, sortedcontainers, pytz, pyppeteerstealth, puremagic, jstyleson, brotli, ... aenum, zope.interface, ... changedetection.io
Successfully installed Flask-Babel-4.0.0 PyYAML-6.0.3 aenum-2.2.6 aiohappyeyeballs-2.7.1 ... changedetection.io-0.60.9 chardet-7.6.0 ... werkzeug-3.1.9 ...
⚠️ 注意:安装依赖较多(含 litellm、tokenizers、numpy 等较大组件),国内服务器如下载缓慢,可临时走代理:
export http_proxy=http://192.168.1.62:7897 https_proxy=http://192.168.1.62:7897 /opt/changedetection/venv/bin/pip install changedetection.io或改用 PyPI 国内镜像源:
-i https://pypi.tuna.tsinghua.edu.cn/simple。
确认安装的版本:
/opt/changedetection/venv/bin/pip show changedetection.io | head -3
实测回显:
Name: changedetection.io
Version: 0.60.9
Summary: Website change detection and monitoring service, detect changes to web pages and send alerts/notifications.
4.4 认识启动命令参数
安装后 venv 的 bin/ 下会生成 changedetection.io 启动器。查看帮助:
/opt/changedetection/venv/bin/changedetection.io --help
实测回显(完整):
Usage: changedetection.py [options]
Standard options:
-s SSL enable
-h HOST Listen host (default: 0.0.0.0)
-p PORT Listen port (default: 5000)
-d PATH Datastore path
-l LEVEL Log level (TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL)
-c Cleanup unused snapshots
-C Create datastore directory if it doesn't exist
-P true/false Set all watches paused (true) or active (false)
Add URLs on startup:
-u URL Add URL to watch (can be used multiple times)
-u0 'JSON' Set options for first -u URL (e.g. '{"processor":"text_json_diff"}')
-u1 'JSON' Set options for second -u URL (0-indexed)
-u2 'JSON' Set options for third -u URL, etc.
Available options: processor, fetch_backend, headers, method, etc.
See model/Watch.py for all available options
Recheck on startup:
-r all Queue all watches for recheck on startup
-r UUID,... Queue specific watches (comma-separated UUIDs)
-r all N Queue all watches, wait for completion, repeat N times
-r UUID,... N Queue specific watches, wait for completion, repeat N times
Batch mode:
-b Run in batch mode (process queue then exit)
Useful for CI/CD, cron jobs, or one-time checks
NOTE: Batch mode checks if Flask is running and aborts if port is in use
Use -p PORT to specify a different port if needed
常用组合:-d 指定数据目录、-p 指定端口、-C 自动创建数据目录、-l INFO 降低日志噪音。
4.5 首次手动启动验证
先手动启动一次,确认能正常运行再交给 systemd 托管:
mkdir -p /opt/changedetection/data
timeout 25 /opt/changedetection/venv/bin/changedetection.io -d /opt/changedetection/data -p 5000 -C
实测回显(输出节选,25 秒后由 timeout 自动结束):
2026-10-17 02:16:50.425 | SUCCESS | changedetectionio:main:347 - changedetection.io version 0.60.9 starting.
2026-10-17 02:16:50.431 | INFO | changedetectionio.store:reload_state:205 - Datastore path is '/opt/changedetection/data'
2026-10-17 02:16:50.431 | WARNING | changedetectionio.store:init_fresh_install:265 - No datastore found, creating new datastore at /opt/changedetection/data
2026-10-17 02:16:50.431 | INFO | changedetectionio.store:init_fresh_install:269 - Marking fresh install to schema version 33
2026-10-17 02:16:50.527 | DEBUG | changedetectionio.store:add_watch:852 - Adding URL 'https://news.ycombinator.com/' - 39173cab-8b03-4d9a-8137-94610864cbed
2026-10-17 02:16:50.529 | DEBUG | changedetectionio.store:add_watch:881 - Added 'https://news.ycombinator.com/'
要点解读:
version 0.60.9 starting.:版本确认无误;Marking fresh install to schema version 33:初始化数据结构到 schema v33;- 首次启动会自动创建两个示例监控(news.ycombinator.com 与 changedetection.io 的 CHANGELOG),用于演示界面,可随时删除。
此时数据目录结构如下:
ls /opt/changedetection/data/
实测回显:
39173cab-8b03-4d9a-8137-94610864cbed
887dd27e-b973-46eb-8634-b82f31ae2c8e
aa927fec-85d5-481d-b736-ce1896d61de7
changedetection-0-60-9.json
changedetection.json
ed3d8844-e577-4f9e-ad48-bbe4e3f1bab9
secret.txt
说明:changedetection.json 是全局主配置;changedetection-0-60-9.json 是版本标记文件;secret.txt 存储实例密钥;每个 UUID 命名的目录对应一个监控任务(watch)。
4.6 配置 systemd 托管
创建服务单元文件 /etc/systemd/system/changedetection.service:
cat > /etc/systemd/system/changedetection.service <<EOF
[Unit]
Description=changedetection.io website change monitoring
After=network-online.target
Wants=network-online.target
[Service]
WorkingDirectory=/opt/changedetection
ExecStart=/opt/changedetection/venv/bin/changedetection.io -d /opt/changedetection/data -p 5000 -C
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
实测回显:无输出(写入成功)。
配置逐项说明:
After=network-online.target+Wants=network-online.target:等网络就绪再启动(监控服务需要联网抓取);ExecStart:venv 内的启动器绝对路径,-d指定数据目录、-p指定端口、-C保证数据目录存在;Restart=on-failure:异常退出 5 秒后自动拉起;- 如需监听 9000 端口,把
-p 5000改为-p 9000即可。
重载 systemd 并设置开机自启(每条命令只操作一个单元):
systemctl daemon-reload
systemctl enable changedetection
实测回显:
Created symlink /etc/systemd/system/multi-user.target.wants/changedetection.service → /etc/systemd/system/changedetection.service.
启动服务:
systemctl start changedetection
实测回显:无输出。
4.7 验证服务运行
确认服务状态:
systemctl status changedetection --no-pager -n 4
实测回显:
● changedetection.service - changedetection.io website change monitoring
Loaded: loaded (/etc/systemd/system/changedetection.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2026-10-17 02:17:11 UTC; 4s ago
Main PID: 3715 (changedetection)
Tasks: 14 (limit: 5753)
Memory: 63.5M
CPU: 461ms
CGroup: /system.slice/docker-9b04428664240418928eecd918b13d771dbc7d663a85d116916ee19ff2bf590a.scope/system.slice/changedetection.service
└─3715 /opt/changedetection/venv/bin/python3.11 /opt/changedetection/venv/bin/changedetection.io -d /opt/changedetection/data -p 5000 -C
Oct 17 02:17:12 9b0442866424 changedetection.io[3715]: * Running on all addresses (0.0.0.0)
Oct 17 02:17:12 9b0442866424 changedetection.io[3715]: * Running on http://127.0.0.1:5000
用 curl 验证 HTTP 服务:
curl -sI http://127.0.0.1:5000/ | head -5
实测回显:
HTTP/1.1 200 OK
Server: Werkzeug/3.1.9 Python/3.11.17
Date: Sat, 17 Oct 2026 02:17:21 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 63863
确认页面标题:
curl -s http://127.0.0.1:5000/ | grep -oE "<title>[^<]+</title>"
实测回显:
<title>Change Detection</title>
浏览器访问 http://<服务器IP>:5000 即可看到 changedetection.io 的 Web 界面。至此安装完成。
五、方案 B:系统 pip 安装(Python 3.10 兼容路径)
如果服务器不满足 Python 3.11 条件(例如受管控无法加 PPA),可以直接用系统 Python 3.10 安装。该方案装到的是旧版 0.55.8,适合短期使用或对版本无要求的场景。
安装命令:
pip3 install changedetection.io
实测回显(输出节选):
Installing collected packages: timeago, sortedcontainers, pytz, ... , changedetection.io
Successfully installed Flask-Babel-4.0.0 ... changedetection.io-0.55.8 ...
安装完成后启动器为 /usr/local/bin/changedetection.io,启动方式与方案 A 相同:
changedetection.io -d /opt/changedetection/data-b -p 5001 -C
💡 说明:方案 B 的数据目录建议与方案 A 分开(如上例
/opt/changedetection/data-b),两套实例不要共用数据目录,避免 schema 版本不同互相破坏。0.55.8 与 0.60.9 的数据 schema 不兼容,升级前务必备份(见 7.2 节)。
六、方案对比与选择建议
| 维度 | 方案 A:venv + Python 3.11 | 方案 B:系统 pip |
|---|---|---|
| 可装版本 | 0.60.9(最新) | 0.55.8(旧版,随 3.10 限制封顶) |
| 是否需联网加 PPA | 是(deadsnakes) | 否 |
| 依赖隔离 | venv 隔离,卸载干净 | 装进系统 site-packages,易与系统包冲突 |
| systemd 托管 | 官方 wiki 推荐形态 | 相同 |
| 后续升级 | 随最新版持续升级 | 停留在 0.55.8 |
| 适用场景 | 生产与长期使用(推荐) | 临时验证、受限环境 |
选择建议:可联网加 PPA 就选方案 A;只有完全无法安装 Python 3.11 时才用方案 B 过渡,并尽早迁移。
七、配置说明
7.1 服务参数与端口调整
所有运行参数集中在 systemd 单元的 ExecStart 行。常用改法:
- 改端口:
-p 5000→-p 9000; - 改监听地址:加
-h 127.0.0.1(只允许本机访问,配合反向代理使用); - 降日志级别:加
-l INFO(默认 DEBUG 日志量很大); - 指定数据目录:
-d /data/changedetection(建议放独立数据盘)。
修改后执行 systemctl daemon-reload && systemctl restart changedetection 生效。
7.2 环境变量注入方式
部分功能通过环境变量控制(完整清单见《changedetection.io 0.60.9 配置参数详解》)。systemd 托管时在 [Service] 段用 Environment= 注入,例如允许监控内网地址(默认出于安全禁止):
Environment=ALLOW_IANA_RESTRICTED_ADDRESSES=true
修改单元文件后需 systemctl daemon-reload 再重启服务,可用以下命令确认变量已生效:
systemctl show changedetection -p Environment
实测回显:
Environment=ALLOW_IANA_RESTRICTED_ADDRESSES=true
7.3 数据目录与备份
全部业务数据(配置、监控任务、历史快照)都在数据目录内,备份即打包目录(先停服务保证一致性):
systemctl stop changedetection
tar czf /opt/changedetection-backup-$(date +%Y%m%d).tar.gz -C /opt/changedetection data/
systemctl start changedetection
实测产物:
-rw-r--r-- 1 root root 19K Oct 17 02:39 /opt/changedetection-backup-20261017.tar.gz
完整备份与恢复演练见《changedetection.io 0.60.9 进阶实战与运维》。
八、升级与版本管理
8.1 升级到最新版
升级 = venv 内重新安装最新包 + 重启服务。以 0.55.8 升级 0.60.9 为例(实测全程):
/opt/changedetection/venv/bin/pip show changedetection.io | grep -E "^Version"
实测回显(升级前):
Version: 0.55.8
执行升级:
/opt/changedetection/venv/bin/pip install --upgrade changedetection.io
实测回显(输出节选):
Successfully installed ... changedetection.io-0.60.9 ...
确认升级结果:
/opt/changedetection/venv/bin/pip show changedetection.io | grep -E "^Version"
实测回显:
Version: 0.60.9
重启服务加载新代码,并验证:
systemctl restart changedetection
systemctl is-active changedetection && curl -s -o /dev/null -w "HTTP=%{http_code}\n" http://127.0.0.1:5000/
实测回显:
active
HTTP=200
8.2 锁定版本与回滚
- 锁定版本:
pip install changedetection.io==0.60.9; - 回滚:
pip install changedetection.io==0.55.8(注意数据 schema 向下不兼容,回滚前必须恢复升级前的数据目录备份)。
九、常见问题(FAQ)
Q1:pip install 没报错,但装出来的版本很旧?
Ubuntu 22.04 自带 Python 3.10,pip 会自动选择兼容 3.10 的最高版本(0.55.8)且不提示。排查方法:pip show changedetection.io | grep Version 看实际版本。解决:按方案 A 安装 Python 3.11 后在 venv 内重装。
Q2:监控内网地址(如 http://192.168.1.10、http://127.0.0.1:8000)时检查失败? 0.60.x 出于安全默认禁止抓取私有/保留网段,监控详情会显示错误(实测原文):
Exception: Fetch blocked: 'http://127.0.0.1:8000/monitor-test.html' resolves to a private/reserved IP address or contains a parser-differential payload. Set ALLOW_IANA_RESTRICTED_ADDRESSES=true to allow.
解决:在 systemd 单元 [Service] 段加 Environment=ALLOW_IANA_RESTRICTED_ADDRESSES=true,daemon-reload 后重启服务;或者在 Web 界面对单个监控勾选允许私有地址的选项。
Q3:启动报 locale 警告? 首次启动日志可能出现:
2026-10-17 02:16:50.425 | WARNING | changedetectionio.flask_app:<module>:252 - Unable to set locale ('en_US', 'UTF-8') for category 0, locale is not installed maybe?
这是系统未生成 en_US.UTF-8 locale 所致,不影响功能。如需消除:apt-get install -y locales && locale-gen en_US.UTF-8。
Q4:5000 端口被占用?
用 ss -tlnp | grep 5000 找到占用进程,或按 7.1 节改用其他端口。
Q5:访问界面提示需要密码?
changedetection.io 默认是匿名模式(无账号体系)。一旦在 Settings → General 设置了访问密码,所有请求都需要登录。忘记密码时:停止服务,编辑数据目录 changedetection.json,删除 "password" 字段后重启服务即可恢复匿名访问。
十、卸载与清理
按依赖反向顺序卸载:停服务 → 删服务单元 → 删程序目录 → 删数据备份。
停止并禁用服务(每条命令一个单元):
systemctl stop changedetection
systemctl disable changedetection
实测回显:
Removed "/etc/systemd/system/multi-user.target.wants/changedetection.service".
删除单元文件并重载:
rm /etc/systemd/system/changedetection.service
systemctl daemon-reload
卸载 pip 包(实测回显,与方案 A/B 一致):
/opt/changedetection/venv/bin/pip uninstall -y changedetection.io
实测回显(输出节选):
Successfully uninstalled changedetection.io-0.55.8
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
删除程序与数据目录(确认备份已完成后再执行):
rm -rf /opt/changedetection /opt/changedetection-backup-*.tar.gz
如不再需要 Python 3.11,一并清理:
apt-get purge -y python3.11 python3.11-venv python3.11-dev && add-apt-repository -y --remove ppa:deadsnakes/ppa
十一、参考链接
- 官方 GitHub 仓库:https://github.com/dgtlmoon/changedetection.io
- PyPI 项目页:https://pypi.org/project/changedetection.io/
- 官方 Wiki(含 systemd 安装说明):https://github.com/dgtlmoon/changedetection.io/wiki
- deadsnakes PPA:https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
- 配套文档:《changedetection.io 0.60.9 Docker Compose 部署指南》《changedetection.io 0.60.9 快速入门(添加监控到差异告警)》《changedetection.io 0.60.9 配置参数详解》《changedetection.io 0.60.9 进阶实战与运维》