Ubuntu 22.04 安装 Yadifa 3.0.10 指南

在 Ubuntu 22.04 服务器上从零安装 Yadifa 3.0.10 的完整指南:源码编译(官方主推)与 apt 仓库(2.4.2)双方案对照、首个权威区域搭建、systemd 托管、dig 逐项验证、排障实录与卸载清理,全部步骤经实测。

YadifaDNS服务器网络2026/10/26

Ubuntu 22.04 安装 Yadifa 3.0.10 指南

目标:在一台 Ubuntu 22.04 服务器上从零安装 Yadifa 权威 DNS 服务并跑通首个区域(zone)的搭建、启动、dig 验证与配置修改闭环,覆盖"源码编译安装最新稳定版 3.0.10"与"apt 仓库安装发行版打包版 2.4.2"两条路线,全部命令与回显来自真实服务器实测。

一、环境信息

本文实测环境与关键信息如下,读者在同等环境下可逐条复现:

  • 操作系统:Ubuntu 22.04 LTS(x86_64,内核 5.15+ 均可)
  • 编译器:GCC 11.4.0(gcc --version 实测 gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0)
  • SSL 库:OpenSSL 3.0.2(libssl-dev 3.0.2-0ubuntu1.30)
  • Yadifa 主测版本:3.0.10(源码编译,构建号 11788,yadifad -V 回显 yadifad 3.0.10-11788 (2026-05-13))
  • apt 备选版本:2.4.2-1build1(Ubuntu 22.04 jammy/universe 仓库,yadifad -V 回显 yadifad 2.4.2-9929 (2021-02-23))
  • 安装前缀:源码方案 /opt/yadifa;apt 方案沿用 Debian 包路径 /usr/sbin、/etc/yadifa/、/var/lib/yadifa/
  • 服务端口:UDP/TCP 53(DNS 标准端口)
  • 示例区域:example.test(源码方案)、apttest.internal(apt 方案)

⚠️ 说明:Ubuntu 22.04 仓库内的 yadifa 包停留在 2.4.x(2021 年打包),与 3.x 在配置语法与路径上均有差异(详见第七章 7.2 与第八章 FAQ)。生产建议以源码编译 3.0.10 为主路线,apt 方案作为快速验证或受控环境的兜底。

二、前置条件

安装前需确认服务器具备以下条件,每一项都给出验证命令与实测回显:

  1. root 或具备 sudo 权限的账户(本文全程 root 演示):
whoami

实测回显:

root
  1. 服务器可访问外网(下载源码/依赖;如走代理见第八章 FAQ Q7):
curl -I -s https://github.com/ | head -1

实测回显:

HTTP/1.1 301 Moved Permanently
  1. 53 端口未被占用(Ubuntu 默认未启用 systemd-resolved 监听 53 的机型可跳过;若被占用见 FAQ Q6):
ss -lunp | grep :53 || echo "port 53 free"

实测回显:

port 53 free
  1. 基础工具齐备(curl、dnsutils 中的 dig 用于最终验证):
apt-get install -y curl dnsutils ca-certificates

实测回显(输出节选):

Reading package lists... Done
Building dependency tree... Done
...
dnsutils is already the newest version (1:9.18.39-0ubuntu0.22.04.7).
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.

三、版本选型说明

选择 Yadifa 版本时需要先厘清三个渠道的版本差异(实查日期 2026-10-26):

渠道版本发布时间适用判断
GitHub Releases(yadifa/yadifa)v3.0.10(GPG 签名)2026-09-15最新稳定版,3.x 特性最全(primary/secondary 语法、策略化 DNSSEC),生产首选
官网下载页打包源码3.0.3-11710(另有 2.6.7 维护线)2025-08-21官网主推渠道,源码包附带 SHA256/MD5/GPG 校验文件
Ubuntu 22.04 jammy/universe2.4.2-1build12021-02-23 构建无外网/快速验证场景;配置语法与 3.x 不同

关键差异解读:3.x 相对 2.x 的最大变化是配置语法与 DNSSEC 体系——2.x 区域类型用 type master/type slave,3.x 改为 type primary/type secondary;3.x 新增了 <dnssec-policy>/<key-suite>/<key-template>/<key-roll> 策略区块。从 2.x 升级必须同步改写配置文件。本文主路线编译 GitHub v3.0.10(与官网 3.0.3 同属 3.x 系,配置语法一致)。

四、源码编译安装方案(A:官方主推)

4.1 方案说明

这是官网下载页给出的标准路径:从官方渠道获取源码、生成构建脚本、编译并安装到独立前缀 /opt/yadifa。优点是拿到最新版本、前缀隔离便于多版本管理;代价是需要安装编译依赖与大约数分钟的编译时间。

4.2 安装编译依赖

Yadifa 是 C 语言项目且强制依赖 OpenSSL,编译依赖如下(⚠️ 实测排障:漏装 libssl-dev 会导致 configure 在 SSL 探测处失败,回显见 4.4):

apt-get install -y build-essential libssl-dev autoconf automake libtool pkg-config git

实测回显(输出节选):

Reading package lists... Done
Building dependency tree... Done
...
Setting up libssl-dev:amd64 ...

验证工具链版本:

gcc --version | head -1
openssl version

实测回显:

gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0
OpenSSL 3.0.2 15 Mar 2022

4.3 获取源码

从官方 GitHub 仓库拉取 v3.0.10 标签(官方 tag 带提交者 GPG 签名验证):

cd /root
git clone --branch v3.0.10 --depth 1 https://github.com/yadifa/yadifa.git
ls yadifa | head -20

实测回显(输出节选):

Cloning into 'yadifa'...
remote: Enumerating objects: ..., done.
remote: Counting objects: 100% (...), done.
...
Note: switching to 'v3.0.10'.
...
3rdparty
AUTHORS
CMakeLists.txt
COPYING
ChangeLog
Makefile.am
NEWS
README
VERSION
autogen.sh
bin
cmake
configure.ac
do-scan-build
doc
etc
gcovr-build.sh
lib
m4
mk
sbin
tests
var
yadifa.supp

确认版本文件内容与仓库中并无预生成的 configure(3.x 源码仓库需先跑 autogen):

cat /root/yadifa/VERSION
ls /root/yadifa/configure 2>&1

实测回显:

3.0.10
ls: cannot access '/root/yadifa/configure': No such file or directory

4.4 autogen 生成 configure

源码仓库使用 autotools 构建,先运行自带的 autogen.sh 生成 configure(脚本内部会按当前 automake/autoconf 版本自动修补兼容性):

cd /root/yadifa && ./autogen.sh

实测回显(输出节选,实测首尾):

libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'mk'.
...
configure.ac:53: installing './config.sub'
configure.ac:59: installing './install-sh'
configure.ac:59: installing './missing'
Makefile.am: installing './INSTALL'
bin/yadifa/Makefile.am: installing './depcomp'

验证 configure 已生成:

ls -la /root/yadifa/configure

实测回显:

-rwxr-xr-x 1 root root 972999 Oct 26 04:53 configure

4.5 configure 配置与编译

执行 configure(--prefix 指定安装前缀)并编译安装。⚠️ 排障实录:若未安装 libssl-dev,configure 会以以下回显失败——

Finding the SSL dependencies
checking for library containing deflate... no
SSLDEPS=
checking if SSL is available... no
CFLAGS=-g -O2
LDFLAGS=
checking for library containing RSA_new... no

补装 apt-get install -y libssl-dev 后重跑即可。正常成功的尾部回显为:

./configure --prefix=/opt/yadifa

实测回显(输出节选,实测首尾):

checking endianness: ... little
...
checking for sendmmsg... yes
checking for recvmmsg... yes
Finding the SSL dependencies
...
YADIFA BUNDLE DONE
------------------

看到 YADIFA BUNDLE DONE 即配置完成。随后编译并安装(本机 6 核,全量编译约 3-5 分钟):

make -j$(nproc) > /root/make.log 2>&1; echo "make exit=$?"
make install > /root/make-install.log 2>&1; echo "install exit=$?"

实测回显:

make exit=0
install exit=0

验证安装产物与目录结构:

ls /opt/yadifa; ls /opt/yadifa/sbin /opt/yadifa/bin

实测回显:

bin
etc
include
lib
sbin
share
var
/opt/yadifa/bin:
yadifa

/opt/yadifa/sbin:
yadifad
yakeyrolld

查看版本号确认安装成功:

/opt/yadifa/sbin/yadifad -V
/opt/yadifa/bin/yadifa -V

实测回显:

yadifad 3.0.10-11788 (2026-05-13)
yadifa 3.0.10-11788 (2026-05-13)

4.6 首次配置与区域文件

安装完成后 /opt/yadifa/etc/yadifad.conf 是空文件,先建立最小可运行配置(含义逐项见《Yadifa 3.0.10 配置参数详解》,此处保证可跑通):

mkdir -p /opt/yadifa/var/zones/primaries /opt/yadifa/var/zones/secondaries
cat > /opt/yadifa/etc/yadifad.conf << "EOF"
<main>
        daemon                      on
        chroot                      off
        logpath                     "/opt/yadifa/var/log/yadifa"
        pidfile                     "/opt/yadifa/var/run/yadifad.pid"
        datapath                    "/opt/yadifa/var/zones"
        keyspath                    "/opt/yadifa/var/zones/keys"
        xfrpath                     "/opt/yadifa/var/zones/xfr"
        hostname                    "ns1.example.test"
        serverid                    "yadifad-ns1"
        edns0-max-size              4096
        max-tcp-queries             100
        user                        root
        group                       root
        port                        53
        listen                      0.0.0.0
        statistics                  on
        queries-log-type            1
        allow-query                 any
        allow-update                none
        allow-transfer              none
        allow-notify                none
        allow-control               controller
</main>

<control>
        enabled true
</control>

<channels>
        database    database.log    0644
        dnssec      dnssec.log      0644
        server      server.log      0644
        statistics  statistics.log  0644
        system      system.log      0644
        zone        zone.log        0644
        queries     queries.log     0644
        all         all.log         0644
        stderr      STDERR
        stdout      STDOUT
</channels>

<loggers>
        database        prod    database,all
        dnssec          prod    dnssec,all
        server          prod    server,all
        stats           prod    statistics
        system          prod    system,all
        zone            prod    zone,all
        queries         prod    queries
</loggers>

<zone>
        type                    primary
        domain                  example.test
        file                    primaries/example.test.zone
        allow-transfer          none
        allow-update            none
</zone>
EOF

创建首个区域文件(标准 RFC 1035 主文件格式,与 BIND zone 文件语法一致):

cat > /opt/yadifa/var/zones/primaries/example.test.zone << "EOF"
$TTL 86400
@   IN  SOA ns1.example.test. admin.example.test. (
        2026102601  ; serial
        10800       ; refresh
        3600        ; retry
        604800      ; expire
        86400 )     ; minimum
    IN  NS      ns1.example.test.
ns1     IN  A   10.89.60.2
@       IN  A   10.89.60.20
www     IN  A   10.89.60.10
api     IN  CNAME www.example.test.
@       IN  MX  10 mail.example.test.
mail    IN  A   10.89.60.25
EOF

4.7 systemd 托管

真实服务器上用 systemd 管理进程生命周期。官方源码自带服务单元样例(etc/yadifad.service),采用 --nodaemon 前台模式交由 systemd 托管。创建单元文件:

cat > /etc/systemd/system/yadifad.service << "EOF"
[Unit]
Description=YADIFA Domain Name Server
Documentation=man:yadifa(8)
After=network.target

[Service]
Type=simple
PIDFile=/opt/yadifa/var/run/yadifad.pid
ExecStart=/opt/yadifa/sbin/yadifad -c /opt/yadifa/etc/yadifad.conf --nodaemon
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process

[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now yadifad

正常情况下 systemctl status yadifad 应显示 active (running);本节单元文件内容摘自官方发布件(源码 etc/yadifad.service)。若所在环境无 systemd(部分精简系统),可直接以守护进程方式启动:/opt/yadifa/sbin/yadifad(配置内 daemon on,进程自动转入后台),本文 4.8 的实测验证即在该方式下完成。

4.8 启动验证

启动守护进程并逐项验证监听端口与 DNS 应答:

/opt/yadifa/sbin/yadifad
ss -lunp | grep :53

实测回显(端口监听,ss 输出节选):

UNCONN 0      0      0.0.0.0:53   0.0.0.0:*   users:(("yadifad",pid=60864,fd=8))

dig 验证各类型记录(真实应答逐行照抄):

dig @127.0.0.1 example.test SOA +noall +answer
dig @127.0.0.1 www.example.test A +noall +answer
dig @127.0.0.1 example.test MX +noall +answer
dig @127.0.0.1 api.example.test CNAME +noall +answer

实测回显:

example.test.		86400	IN	SOA	ns1.example.test. admin.example.test. 2026102601 10800 3600 604800 86400

www.example.test.	86400	IN	A	10.89.60.10

example.test.		86400	IN	MX	10 mail.example.test.

api.example.test.	86400	IN	CNAME	www.example.test.

再验证服务器元信息查询(版本与标识,均在 <main> 中配置):

dig @127.0.0.1 version.yadifa CH TXT +noall +answer
dig @127.0.0.1 hostname.bind CH TXT +noall +answer
dig @127.0.0.1 id.server CH TXT +noall +answer

实测回显:

version.yadifa.		0	CH	TXT	"3.0.10"
hostname.bind.		0	CH	TXT	"ns1.example.test"
id.server.		0	CH	TXT	"yadifad-ns1"

以上全部应答正常即代表安装闭环完成。日志位于 /opt/yadifa/var/log/yadifa/(按通道分文件),启动横幅可在 server.log 中核对:

head -8 /opt/yadifa/var/log/yadifa/server.log

实测回显:

2026-10-26 04:56:26.864805 |  60864 | -------  | server   | I | starting YADIFA 3.0.10-11788
2026-10-26 04:56:26.864813 |  60864 | -------  | server   | I | built with --prefix=/opt/yadifa
2026-10-26 04:56:26.864813 |  60864 | -------  | server   | I | release build
2026-10-26 04:56:26.864814 |  60864 | -------  | server   | I | ------------------------------------------------
2026-10-26 04:56:26.864814 |  60864 | -------  | server   | I | YADIFA is maintained by EURid
2026-10-26 04:56:26.864814 |  60864 | -------  | server   | I | Source code is available at https://www.yadifa.eu
2026-10-26 04:56:26.864814 |  60864 | -------  | server   | I | ------------------------------------------------
2026-10-26 04:56:26.864834 |  60864 | -------  | server   | I | got 6 CPUs

五、apt 仓库安装方案(B:发行版包)

5.1 方案说明

Ubuntu 22.04 的 universe 仓库内置 yadifa 打包件(2.4.2),apt install 即装即得 systemd 服务单元、logrotate 配置与默认目录,适合快速验证或受控内网环境。⚠️ 注意:2.4.x 与 3.x 配置语法不兼容(见 5.4 与 FAQ Q3),且版本停留在 2021 年。

5.2 安装与包结构

先确认仓库内版本再安装:

apt-cache policy yadifa | head -4

实测回显:

yadifa:
  Installed: (none)
  Candidate: 2.4.2-1build1
  Version table:
     2.4.2-1build1 500
        500 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
DEBIAN_FRONTEND=noninteractive apt-get install -y yadifa

实测回显(输出节选):

Reading package lists... Done
...
Preparing to unpack .../yadifa_2.4.2-1build1_amd64.deb ...
Unpacking yadifa (2.4.2-1build1) ...
Setting up yadifa (2.4.2-1build1) ...

核对版本与包内关键文件布局:

/usr/sbin/yadifad -V
dpkg -L yadifa | grep -vE "usr/share/(doc|man)" | head -22

实测回显:

yadifad 2.4.2-9929 (2021-02-23)
/.
/etc
/etc/default
/etc/default/yadifa
/etc/init.d
/etc/init.d/yadifa
/etc/logrotate.d
/etc/logrotate.d/yadifa
/etc/yadifa
/etc/yadifa/yadifad.conf
/lib/systemd
/lib/systemd/system
/lib/systemd/system/yadifa.service
/usr
/usr/bin
/usr/bin/yadifa
/usr/lib/tmpfiles.d
/usr/lib/tmpfiles.d/yadifa.conf
/usr/sbin
/usr/sbin/yadifad
/usr/sbin/yakeyrolld

包内文件解读:守护进程在 /usr/sbin/yadifad、管理客户端在 /usr/bin/yadifa;主配置在 /etc/yadifa/yadifad.conf(注意不是 /etc/yadifad.conf,排障见 FAQ Q4);systemd 单元名为 yadifa.service(不是 yadifad.service);运行数据在 /var/lib/yadifa/(primaries/secondaries/keys/xfr 四个子目录自动创建);/etc/default/yadifa 存放服务启动参数(YADIFA_CONF 与 DAEMON_ARGS="-d -c $CONFIG_FILE")。

5.3 默认参数差异

apt 包的默认 <main> 与源码默认有明显不同,直接影响使用(grep -vE "^\s*#|^\s*$" /etc/yadifa/yadifad.conf 实测节选):

        logpath                     "/var/log/yadifa"
        pidfile                     "/run/yadifa/yadifad.pid"
        datapath                    "/var/lib/yadifa"
        keyspath                    "/var/lib/yadifa/keys"
        xfrpath                     "/var/lib/yadifa/xfr"
        edns0-max-size              1232
        user                        yadifa
        group                       yadifa

关键差异:日志在 /var/log/yadifa/、数据在 /var/lib/yadifa/、服务降权到 yadifa 用户运行、EDNS0 上限默认 1232(DNS flag day 推荐值,源码样例为 4096)。

5.4 建区域并启动验证

apt 方案下区域类型关键字是 2.x 语法 type master(3.x 已改为 type primary)。在 /etc/yadifa/yadifad.conf 末尾追加一个示例区域:

cat >> /etc/yadifa/yadifad.conf << "EOF"
<zone>
        type                    master
        domain                  apttest.internal
        file                    primaries/apttest.internal.zone
        allow-transfer          none
        allow-update            none
</zone>
EOF

cat > /var/lib/yadifa/primaries/apttest.internal.zone << "EOF"
$TTL    3600
$ORIGIN apttest.internal.

@       3600    IN  SOA ns1.apttest.internal. admin.apttest.internal. (
                         2026102601 ; serial
                         3H         ; refresh
                         15         ; retry
                         1w         ; expire
                         1h         ; minimum
                        )

        3600    IN  NS      ns1.apttest.internal.
ns1     3600    IN  A       192.0.2.53
www     3600    IN  A       192.0.2.10
EOF
chown yadifa:yadifa /var/lib/yadifa/primaries/apttest.internal.zone

💡 技术拓展:区域主从角色在 DNS 业界有两套行话——RFC 8499 倡导的 primary/secondary 与 BIND 历史沿用的 master/slave。Yadifa 2.x 配置用 master/slave,3.x 全面切换为 primary/secondary;写配置前务必先确认版本,关键字写错会导致区域无法加载。

启动服务(真实服务器上走 systemd,单元名为 yadifa,包内单元已内置 -c /etc/yadifa/yadifad.conf 参数):

systemctl enable --now yadifa

正常情况下 systemctl status yadifa 应显示 active (running)。

⚠️ 注意:yadifa.service 依赖 /run/yadifa 目录(由包内 tmpfiles.d 配置在系统启动时自动创建)。若在未重启系统的情况下手工验证,需先 mkdir -p /run/yadifa && chown yadifa:yadifa /run/yadifa,否则启动报 error: '/run/yadifa': No such file or directory(排障实录,实测踩坑)。本文实测时采用与 systemd 等价的手工方式启动:

/usr/sbin/yadifad -d -c /etc/yadifa/yadifad.conf

dig 验证区域应答:

dig @127.0.0.1 www.apttest.internal A +noall +answer
dig @127.0.0.1 apttest.internal SOA +noall +answer
dig @127.0.0.1 apttest.internal NS +noall +answer

实测回显:

www.apttest.internal.	3600	IN	A	192.0.2.10
apttest.internal.	3600	IN	SOA	ns1.apttest.internal. admin.apttest.internal. 2026102601 10800 15 604800 3600
apttest.internal.	3600	IN	NS	ns1.apttest.internal.

日志位置为 /var/log/yadifa/(八通道分文件,与 3.x 一致)。

六、方案对比与选择建议

两条安装路线的对照(均在 Ubuntu 22.04 实测):

维度A:源码编译 3.0.10B:apt 仓库 2.4.2
版本最新稳定(2026-09-15 tag)2021 年打包,落后两个大版本
是否需外网/编译链需要(git + 编译约 3-5 分钟)不需要,apt 秒装
安装前缀/opt/yadifa(可多版本并存)系统路径(/usr/sbin、/etc/yadifa)
systemd 单元名自建 yadifad.serviceyadifa.service(包内置)
区域类型关键字primary/secondarymaster/slave
默认运行用户root(可配)yadifa(降权)
策略化 DNSSEC支持(dnssec-policy 族)无(2.x 为手工签名工具链)
适用判断生产首选、需要 3.x 特性快速验证、离线受控环境

选择建议:可联网的生产环境一律选方案 A;方案 B 只用于"先看看 Yadifa 长什么样"的快速评估或完全离线的内部仓库场景,且要意识到其配置语法停留在 2.x。两方案不要混装在同一台服务器(路径与端口互不影响但管理面易混淆)。

七、配置说明

7.1 防火墙放行

对外提供权威服务需放行 53 端口(UDP/TCP)。以 ufw 为例(真实服务器执行;未启用 ufw 的机器可跳过本节):

ufw allow 53/udp
ufw allow 53/tcp

放行后可用 ufw status 核对两条 53 规则均已生效。

7.2 版本语法速查(2.x 与 3.x)

同一件事在两个版本线的关键字对照,混用资料时先对照此表:

配置项2.4.x(apt 方案)3.0.x(源码方案)
主区域type mastertype primary
从区域type slavetype secondary
从区域上游primary <ip>primary <ip> port 53 key <keyname>
策略化 DNSSEC无<dnssec-policy>/<key-suite>/<key-roll>
配置文件位置/etc/yadifa/yadifad.conf前缀下 etc/yadifad.conf(默认空,需自建)

八、常见问题(FAQ)

Q1:configure 报 checking if SSL is available... no 然后退出? 缺少 OpenSSL 开发头文件。执行 apt-get install -y libssl-dev 后重新 ./configure --prefix=/opt/yadifa,尾部出现 YADIFA BUNDLE DONE 即成功。这是源码方案实测中唯一失败的 configure 项。

Q2:启动报 PARSEB64_ERROR,指向 keys.conf 的 </key> 行? TSIG 密钥的 secret 必须是合法 base64(总长度为 4 的倍数)。实测中手写的凑数串触发 error: reading configuration: PARSEB64_ERROR。用 openssl rand -base64 32 生成合法密钥即可(生成结果形如 nRq+K4vp0w8/lZAwaOiAH+P3utxqu3bc0T/JSUQ5qLU=)。

Q3:2.x 资料的 type master 拿到 3.x 里不生效? 3.x 已改用 type primary/type secondary。反之在 2.4.2 里写 type primary 区域同样无法加载(实测区域静默不加载、查询返回 REFUSED)。按 7.2 对照表修正关键字后重启服务。

Q4:apt 装完后直接执行 /usr/sbin/yadifad 报 CONFIG_FILE_NOT_FOUND? Debian 打包把配置放在 /etc/yadifa/yadifad.conf,而 2.4.2 二进制的编译默认路径是 /etc/yadifad.conf(实测报 /etc/yadifad.conf: CONFIG_FILE_NOT_FOUND)。手工验证时须带 -c /etc/yadifa/yadifad.conf;走 systemd 的 yadifa.service 则无需关心(单元内已带 -c 参数)。

Q5:yadifad 启动报 error: yadifad already running with pid: xxx / PID_LOCKED? 上次进程退出后 pid 文件残留或旧进程仍在。先确认无存活进程后删除 pidfile 再启动:rm -f /opt/yadifa/var/run/yadifad.pid(apt 方案路径为 /run/yadifa/yadifad.pid)。生产上经 systemd 管理不会出现该问题。

Q6:53 端口被占用(Ubuntu 桌面版常见 systemd-resolved)? ss -lunp | grep :53 若显示 systemd-resolve 占用,编辑 /etc/systemd/resolved.conf 设置 DNSStubListener=no 后 systemctl restart systemd-resolved,再启动 yadifad。

Q7:源码克隆/依赖下载缓慢? 官方源不可达或缓慢时可走代理:git -c http.proxy=http://192.168.1.62:7897 clone --branch v3.0.10 --depth 1 https://github.com/yadifa/yadifa.git。⚠️ 本文实测时官方 GitHub 源直连可用,未发生降级;官网打包源 https://yadifa.eu/sites/default/files/releases/ 亦直连可用。

Q8:启动日志提示 warning: config: main: max_secondary_tcp_queries higher than max_tcp_queries (100)? 两参数均为默认 100 时偶发的无害告警,如需消除可将 max-tcp-queries 调大(如 200)或将从区域并发下调;不影响功能(实测带此告警时主从 AXFR 正常)。

九、升级、降级与多版本管理

  • 源码方案升级:拉取新 tag 重新编译即可原位覆盖:git fetch --tags && git checkout v3.0.11 && ./autogen.sh && ./configure --prefix=/opt/yadifa && make -j$(nproc) && make install,随后 systemctl restart yadifad。zone 数据在 /opt/yadifa/var/zones/ 与配置前缀无关,升级不受影响;
  • 多版本并存:为每个版本使用独立前缀(如 /opt/yadifa-3.0.3、/opt/yadifa-3.0.10),切换时改 systemd 单元中 ExecStart 的路径并 systemctl daemon-reload,回滚即改回;
  • apt 方案锁版本:apt-mark hold yadifa 阻止意外升级,apt-mark unhold yadifa 解锁;降级用 apt-get install yadifa=2.4.2-1build1;
  • 3.x 与 2.x 之间"升级":无原地升级路径,配置文件需按 7.2 对照表手工改写(master→primary 等),区域文件格式通用。

十、卸载与清理

源码方案(前缀隔离,整目录移除即完全卸载):

systemctl stop yadifad
systemctl disable yadifad
rm -f /etc/systemd/system/yadifad.service
systemctl daemon-reload
rm -rf /opt/yadifa

apt 方案:

systemctl stop yadifa
apt-get purge -y yadifa
apt-get autoremove -y

purge 会连同 /etc/yadifa 配置一并删除;/var/lib/yadifa 中的区域数据如需保留请先备份。最后确认无残留:

ss -lunp | grep :53 || echo "port 53 free"

实测回显:

port 53 free

十一、参考链接