AdGuard Home是一款类似于pi-hole的DNS服务器程序。可以通过UDP、TCP、DOT、DOH等多种方式向上游DNS查询,拦截与广告、跟踪、病毒、成人等相关的域名。

下载安装

由于AdGuard Home是使用go语言编写的程序,因此使用整个程序只需要下载一个执行文件(比起在各处建文件的pi-hole,管理起来确实方便了很多)

1
2
3
wget https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.91/AdGuardHome_v0.91_linux_arm.tar.gz
tar xvf AdGuardHome_v0.91_linux_arm.tar.gz
mv /AdGuardHome/AdGuardHome /etc/adguard

添加AdGuard Home的系统服务

新建并编辑adguard.service

1
vim /etc/systemd/system/adguard.service

内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[Unit]
Description=AdGuard Home
After=syslog.target
After=network.target

[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/etc/adguard
ExecStart=/etc/adguard/AdGuardHome --host 0.0.0.0
Restart=always

[Install]
WantedBy=multi-user.target

自启动和启动

1
2
systemctl enable adguard
systemctl start adguard

附:卸载Pi-hole

貌似安装Pi-hole时安装的依赖如果被其他程序使用了,卸载就基本没用了。
我用pihole uninstall执行了卸载程序,卸载程序只是删除了web interface/etc/.pihole卸载完成后pihole还在运行。
查了查资料,虽然不知道下面的方法能不能彻底卸载,至少是没办法运行pihole了。

  • 全盘搜索pihole

    1
    2
    cd /
    find -name "*pihole*"
  • 得到的输出如下

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    ./run/pihole
    ./run/pihole-FTL.port
    ./run/pihole-FTL.pid
    ./run/resolvconf/interface/lo.piholeFTL
    ./run/systemd/generator.late/pihole-FTL.service
    ./opt/pihole
    ./opt/pihole/piholeLogFlush.sh
    ./opt/pihole/piholeDebug.sh
    ./opt/pihole/piholeCheckout.sh
    ./etc/init.d/pihole-FTL
    ./etc/bash_completion.d/pihole
    ./etc/.pihole
    ./etc/.pihole/advanced/bash-completion/pihole
    ./etc/.pihole/advanced/Templates/pihole.cron
    ./etc/.pihole/advanced/Templates/pihole-FTL.service
    ./etc/.pihole/advanced/Templates/pihole.sudo
    ./etc/.pihole/advanced/01-pihole.conf
    ./etc/.pihole/advanced/Scripts/piholeLogFlush.sh
    ./etc/.pihole/advanced/Scripts/piholeDebug.sh
    ./etc/.pihole/advanced/Scripts/piholeCheckout.sh
    ./etc/.pihole/pihole
    ./etc/.pihole/manpages/pihole-FTL.conf.5
    ./etc/.pihole/manpages/pihole-FTL.8
    ./etc/.pihole/manpages/pihole.8
    ./etc/pihole
    ./etc/pihole/pihole-FTL.db
    ./etc/pihole/pihole-FTL.conf
    ./etc/rc0.d/K01pihole-FTL
    ./var/log/pihole
    ./var/log/pihole.log.1
    ./var/log/pihole-FTL.log
    ./var/log/pihole.log
    ./root/pihole
    ./usr/bin/pihole-FTL
    ./usr/local/bin/pihole
    ./usr/local/share/man/man8/pihole-FTL.8
    ./usr/local/share/man/man8/pihole.8
    ./usr/local/share/man/man5/pihole-FTL.conf.5
  • 把输出复制到记事本,批量替换./rm -rf / (我真是个天才😂),存为uninstall.sh

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    rm -rf /run/pihole
    rm -rf /run/pihole-FTL.port
    rm -rf /run/pihole-FTL.pid
    rm -rf /run/resolvconf/interface/lo.piholeFTL
    rm -rf /run/systemd/generator.late/pihole-FTL.service
    rm -rf /opt/pihole
    rm -rf /opt/pihole/piholeLogFlush.sh
    rm -rf /opt/pihole/piholeDebug.sh
    rm -rf /opt/pihole/piholeCheckout.sh
    rm -rf /etc/init.d/pihole-FTL
    rm -rf /etc/bash_completion.d/pihole
    rm -rf /etc/.pihole
    rm -rf /etc/.pihole/advanced/bash-completion/pihole
    rm -rf /etc/.pihole/advanced/Templates/pihole.cron
    rm -rf /etc/.pihole/advanced/Templates/pihole-FTL.service
    rm -rf /etc/.pihole/advanced/Templates/pihole.sudo
    rm -rf /etc/.pihole/advanced/01-pihole.conf
    rm -rf /etc/.pihole/advanced/Scripts/piholeLogFlush.sh
    rm -rf /etc/.pihole/advanced/Scripts/piholeDebug.sh
    rm -rf /etc/.pihole/advanced/Scripts/piholeCheckout.sh
    rm -rf /etc/.pihole/pihole
    rm -rf /etc/.pihole/manpages/pihole-FTL.conf.5
    rm -rf /etc/.pihole/manpages/pihole-FTL.8
    rm -rf /etc/.pihole/manpages/pihole.8
    rm -rf /etc/pihole
    rm -rf /etc/pihole/pihole-FTL.db
    rm -rf /etc/pihole/pihole-FTL.conf
    rm -rf /etc/rc0.d/K01pihole-FTL
    rm -rf /var/log/pihole
    rm -rf /var/log/pihole.log.1
    rm -rf /var/log/pihole-FTL.log
    rm -rf /var/log/pihole.log
    rm -rf /root/pihole
    rm -rf /usr/bin/pihole-FTL
    rm -rf /usr/local/bin/pihole
    rm -rf /usr/local/share/man/man8/pihole-FTL.8
    rm -rf /usr/local/share/man/man8/pihole.8
    rm -rf /usr/local/share/man/man5/pihole-FTL.conf.5