CentOS 8 安装 Apache Yetus 指南

在 CentOS 8 服务器从零安装 Apache Yetus 0.15.1 的完整指南,涵盖依赖准备、官方 tarball 下载与 SHA512 校验、解压部署、环境变量配置、releasedocmaker 最小实测与常见报错排查。

Apache YetusApache Yetus2026/10/12

CentOS 8 安装 Apache Yetus 指南

一、环境信息

本文所有步骤均在 CentOS 8 服务器上实际执行验证,关键软件版本如下:

项目值
操作系统CentOS Linux 8(x86_64)
内核6.8.0(实际以服务器为准,无特殊内核要求)
Apache Yetus0.15.1(官方二进制包)
Python3.6.8(AppStream 默认版本,实测可正常运行 Yetus 0.15.1)
Git2.27.0
curl7.61.1
ShellCheck0.6.0(EPEL 源,包名为 ShellCheck)
安装目录/opt/yetus
下载目录/opt/yetus-dl
执行账号root

二、前置条件

  1. 服务器可访问公网(需访问 downloads.apache.org 与软件源)。
  2. 以 root 身份操作,或使用具备 sudo 权限的账号。
  3. 基础命令行工具 dnf、curl 可用。

CentOS 8 已停止维护,如服务器仍指向已下线的 mirrorlist 软件源,需先将软件源切换到 vault.centos.org 归档源,否则 dnf 安装会报源站 404 错误。

安装基础依赖(python3、git、curl):

dnf install -y python3 git curl

实测安装完成后版本确认:

python3 --version
git --version
curl --version | head -1

实测回显:

Python 3.6.8
git version 2.27.0
curl 7.61.1 (x86_64-redhat-linux-gnu) libcurl/7.61.1 OpenSSL/1.1.1g zlib/1.2.11 nghttp2/1.33.0

说明:CentOS 8 默认源中的 Python 3.6.8 已实测可正常运行 Apache Yetus 0.15.1 的全部命令行工具(releasedocmaker、test-patch、shelldocs 均验证通过),无需额外编译高版本 Python。

三、版本选型

Apache Yetus 官方下载页(https://yetus.apache.org/downloads/)当前提供的最新稳定版本为 0.15.1,同时提供 0.14.1 与 0.13.0。本文统一选用 0.15.1。

每个版本提供两类包:

  • Source:apache-yetus-0.15.1-src.tar.gz(源码,需自行构建);
  • Binaries:apache-yetus-0.15.1-bin.tar.gz(官方构建的即用二进制,脚本与库齐全,推荐)。

本文使用 Binaries 包。0.15.1 的发布日期为 2025-02-16(可从生成的 CHANGELOG 中确认)。

四、部署步骤

4.1 下载与校验

创建下载目录并下载官方二进制包与官方校验文件:

mkdir -p /opt/yetus-dl
cd /opt/yetus-dl
curl -sSLO https://downloads.apache.org/yetus/0.15.1/apache-yetus-0.15.1-bin.tar.gz
curl -sSLO https://downloads.apache.org/yetus/0.15.1/apache-yetus-0.15.1-bin.tar.gz.mds

确认文件完整:

ls -la /opt/yetus-dl/apache-yetus-0.15.1-bin.tar.gz

实测回显:

-rw-r--r-- 1 root root 165232 Oct 12 14:37 apache-yetus-0.15.1-bin.tar.gz

使用官方 .mds 文件中的 SHA512 值进行校验:

cd /opt/yetus-dl
EXPECTED=$(grep 'SHA512' apache-yetus-0.15.1-bin.tar.gz.mds | tr -d ' \n' | cut -d= -f2)
LOCAL=$(sha512sum apache-yetus-0.15.1-bin.tar.gz | awk '{print toupper($1)}')
if [ "$EXPECTED" = "$LOCAL" ]; then echo "SHA512 校验通过"; else echo "SHA512 校验失败"; fi

实测回显:

SHA512 校验通过

本地计算所得 SHA512 值(小写)为:

6a26e30063f72ac407d4bc37e76a3bc036f5cb2353495218b59a67c1fddf7a8bc57250350c16ea70b3c108143e7c27e5631acb16d448db88bc3a647e6fd6d58a

4.2 解压安装

解压到 /opt/yetus(--strip-components=1 去掉包名层目录):

mkdir -p /opt/yetus
tar -xzf /opt/yetus-dl/apache-yetus-0.15.1-bin.tar.gz -C /opt/yetus --strip-components=1
ls -la /opt/yetus/

实测回显:

total 52
drwxr-xr-x  4 root root   4096 Oct 12 14:37 .
drwxr-xr-x  8 root root   4096 Oct 12 14:37 ..
-rw-r--r--  1 root dialout 20994 Dec  3  2021 LICENSE
-rw-r--r--  1 root dialout   258 May 21  2023 NOTICE
-rw-r--r--  1 root dialout  4245 Feb 12  2025 README.md
drwxr-xr-x  2 root dialout  4096 Oct 12 14:37 bin
drwxr-xr-x  6 root dialout  4096 Oct 12 14:37 lib

目录说明:

  • bin/:可执行命令入口,含 releasedocmaker、test-patch、shelldocs、smart-apply-patch、qbt 等;
  • lib/:脚本库与插件,lib/VERSION 文件记录版本号(实测内容为 0.15.1);
  • lib/precommit/plugins.d/:预提交审计插件(实测共 50 个插件脚本)。

4.3 配置环境变量

写入 profile 片段,对所有登录会话生效:

echo 'export YETUS_HOME=/opt/yetus' > /etc/profile.d/yetus.sh
echo 'export PATH=$YETUS_HOME/bin:$PATH' >> /etc/profile.d/yetus.sh

使当前会话生效:

source /etc/profile.d/yetus.sh

4.4 验证安装

确认命令可用并输出版本:

which releasedocmaker
releasedocmaker -V
test-patch --version
shelldocs -V

实测回显:

/opt/yetus/bin/releasedocmaker
0.15.1
0.15.1
0.15.1

4.5 releasedocmaker 最小实测

releasedocmaker 的数据来源是 JIRA 问题跟踪系统,首次运行会暴露缺少 Python 依赖的问题,正好用于验证安装完整性。

第一次直接运行:

releasedocmaker -V

若缺少依赖,实测报错:

ERROR:root:This script requires python-dateutil module to be installed. You can install it using:
         pip install python-dateutil

安装缺失的 Python 模块:

pip3 install python-dateutil

实测回显(版本号以实际安装为准):

Successfully installed python-dateutil-2.9.0.post0 six-1.17.0

再次运行,对 Apache JIRA 上真实存在的 YETUS 项目生成 0.15.1 的发布说明(需要外网访问 issues.apache.org):

releasedocmaker --project YETUS --version 0.15.1 --outputdir /tmp/rdm-yetus --projecttitle 'Apache Yetus' --index
echo "exit=$?"

实测回显:

exit=0

查看生成结果:

ls -la /tmp/rdm-yetus/

实测回显:

total 16
-rw-r--r-- 1 root root 1424 Oct 12 14:38 CHANGELOG.md
-rw-r--r-- 1 root root    0 Oct 12 14:38 README.md
-rw-r--r-- 1 root root 1227 Oct 12 14:38 RELEASENOTES.md
-rw-r--r-- 1 root root    0 Oct 12 14:38 index.md

CHANGELOG.md 开头内容:

# Apache Yetus Changelog

  ## Release 0.15.1 - 2025-02-16



### BUG FIXES:

| JIRA | Summary | Priority | Component | Reporter | Contributor |
|:---- |:---- | :--- |:---- |:---- |:---- |
| [YETUS-1249](https://issues.apache.org/jira/browse/YETUS-1249) | fix macos tests in yetus-homebrew |  Major | homebrew | Allen Wittenauer | Allen Wittenauer |

以上即安装验证完成:releasedocmaker 已能从 JIRA 拉取数据并生成发布文档。

五、配置说明

  1. 环境变量:YETUS_HOME 指向安装目录,PATH 中加入 $YETUS_HOME/bin。Yetus 官方二进制内部通过相对路径定位 lib 目录,无需其他强制环境变量。
  2. Python 依赖:releasedocmaker 依赖 python-dateutil,可通过 pip3 install python-dateutil 安装;pip3 随 python3 一起安装(dnf install -y python3-pip,CentOS 8 实测 python3 包已附带 pip3 9.0.3)。
  3. 可选外部工具:test-patch 的插件按需调用外部工具,例如 shellcheck 插件需要 ShellCheck(见下),pylint 插件需要 pylint,markdownlint 插件需要 markdownlint 等。未安装对应工具时,相应插件自动跳过,不影响其他插件。
  4. ShellCheck 安装:CentOS 8 默认源不提供 shellcheck,且 extras 源中的 epel-release 包不可用。实测可行方法是从 Fedora 归档直接安装 EPEL 配置包,再安装大写包名的 ShellCheck:
curl -sSL -o /tmp/epel.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install -y /tmp/epel.rpm
dnf install -y ShellCheck
shellcheck --version | head -2

实测回显:

ShellCheck - shell script analysis tool
version: 0.6.0

注意:EPEL 8 中的包名是 ShellCheck(首字母大写),执行 dnf install -y shellcheck 会报 "Error: Unable to find a match: shellcheck"。

  1. 插件与 personality:test-patch 支持在项目仓库的 .yetus/personality.sh 中做项目级定制(构建工具选择、参数微调等),详见《Apache Yetus 配置参数详解》。

六、升级与多版本

  1. 升级到新版本:下载新版 tarball,解压到新目录(如 /opt/yetus-0.16.0),验证后切换软链接:
ln -sfn /opt/yetus-0.16.0 /opt/yetus
  1. 多版本共存:不同项目可各自使用不同版本,直接调用绝对路径即可,例如 /opt/yetus-0.15.1/bin/test-patch。官方提醒:不同版本间不保证兼容,建议每个项目固定使用同一版本。
  2. 版本确认:cat /opt/yetus/lib/VERSION 可查看当前解压目录的版本号。

七、注意事项

  1. releasedocmaker 只支持 JIRA 作为数据源,不能直接从 git 提交记录生成 CHANGELOG;本地 git 仓库仅作为输出目录使用。若 JIRA 中的项目名不存在,会报 HTTP 400 错误(详见常见问题)。
  2. test-patch 默认不启用任何审计插件,必须通过 --plugins 显式启用(或 --plugins=all),否则只执行环境检查、不产出任何测试投票。
  3. test-patch 对工作区有洁癖:仓库存在未提交修改或未跟踪文件时会拒绝运行,报错并提示 --dirty-workspace 选项;运行结束后补丁默认仍应用在工作区(nobuild 构建工具的清理动作为空操作),需要手动还原或使用 --resetrepo。
  4. CentOS 8 的 git 2.27 不支持 init.defaultBranch 配置(2.28 引入),git init 后默认分支为 master,编写脚本时注意分支名。
  5. ShellCheck 0.6.0(EPEL 8)比 Ubuntu 22.04 的 0.8.0 旧,同一脚本两端检出结果可能略有差异。
  6. 防火墙如启用,需放行到 issues.apache.org(releasedocmaker)及各类代码托管平台的出站访问。

八、常见问题

Q1: 执行 releasedocmaker 报 "This script requires python-dateutil module"?

现象:任何 releasedocmaker 命令均报 ERROR:root:This script requires python-dateutil module to be installed。定位:系统缺少 Python 模块 python-dateutil。解决:pip3 install python-dateutil,安装后重试即可。

Q2: releasedocmaker 报 "JIRA returns HTTP error 400"?

现象实测回显:

JIRA returns HTTP error 400: . Aborting.
- Please ensure that specified authentication, projects, fixVersions etc. are correct.
- The value 'DEMOSHELL' does not exist for the field 'project'.

定位:--project 指定的项目在目标 JIRA 上不存在(或无权限访问),末行引号内为具体项目名。解决:改用 JIRA 上真实存在的项目名(如 YETUS),并确认版本号(--version)在该项目的 fixVersions 中存在。

Q3: releasedocmaker 多版本执行报 "Multiple versions require either --fileversions or --dirversions"?

现象:--version 传两个及以上版本时直接报错退出。定位:多版本输出必须指定文件命名方式。解决:追加 --fileversions(文件名嵌版本,如 CHANGELOG.0.15.1.md)或 --dirversions(按版本建子目录)。

Q4: dnf 安装报 "Unable to find a match: shellcheck"?

定位:CentOS 8 默认源不含 shellcheck,且 extras 源的 epel-release 包不可用。解决:按第五章第 4 条从 Fedora 归档安装 epel-release-latest-8 后,安装包名 ShellCheck。

Q5: test-patch 报 "can't run in a workspace that contains the following modifications"?

现象实测回显:

ERROR: --dirty-workspace option not provided.
ERROR: can't run in a workspace that contains the following modifications
 M build.sh

定位:仓库工作区存在未提交修改。解决:先还原或提交修改(git checkout -- 文件 或 git commit),确认 git status 干净后重跑;CI 场景可追加 --dirty-workspace 跳过该检查。

Q6: test-patch 跑完没有任何测试投票、Optional Tests 为空?

定位:0.15.1 默认不启用任何插件,仅传 --build-tool 不传 --plugins 时不会执行任何测试。解决:显式指定 --plugins,例如 --plugins=shellcheck,shelldocs,blanks。

九、卸载方式

  1. 删除安装与下载目录:
rm -rf /opt/yetus /opt/yetus-dl
  1. 删除环境变量配置:
rm -f /etc/profile.d/yetus.sh
  1. 清理输出与工作目录(如不再需要):
rm -rf /tmp/rdm-yetus /tmp/tp-out
  1. 可选:卸载随装的依赖(不影响系统其他组件可跳过):
dnf remove -y ShellCheck epel-release
  1. 重新登录使 PATH 变更生效,确认 which releasedocmaker 无输出即卸载完成。

十、参考链接

  1. Apache Yetus 官方下载页:https://yetus.apache.org/downloads/
  2. Apache Yetus 官方文档首页:https://yetus.apache.org/
  3. releasedocmaker 官方文档:https://yetus.apache.org/documentation/in-progress/releasedocmaker
  4. test-patch(precommit)官方文档:https://yetus.apache.org/documentation/in-progress/precommit/
  5. GitHub 仓库:https://github.com/apache/yetus
  6. ASF 校验流程说明:https://www.apache.org/info/verification.html