一、先按照官方脚本安装adguardhome,但不登入配置
curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v
二、停止系统自带DNS服务
- 首先停止系统自带dns服务
systemctl stop systemd-resolved
BashCopy
- 创建文件夹(如果不存在)
mkdir /etc/systemd/resolved.conf.d/
BashCopy
- 创建配置文件(vim会自动新建)
vim /etc/systemd/resolved.conf.d/adguardhome.conf
BashCopy
- 贴入以下内容
[Resolve]
DNS=127.0.0.1
DNSStubListener=no
BashCopy
- 移除原来的配置文件(创建备份)
mv /etc/resolv.conf /etc/resolv.conf.backup
BashCopy
- 将 /etc/resolv.conf 链接至 /run/systemd/resolve/resolv.conf
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
BashCopy
- 重启 DNSStubListener
systemctl restart systemd-resolved
BashCopy
此时53端口应该已经不占用了,接着按照官方教程进行安装
netstat -tunlp | grep 53
三、登入adguardhome进行配置