<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Linux on 我的个人博客</title>
        <link>https://liangjinzhi.com/tags/linux/</link>
        <description>Recent content in Linux on 我的个人博客</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>zh-cn</language>
        <lastBuildDate>Sat, 30 May 2026 06:23:38 +0000</lastBuildDate><atom:link href="https://liangjinzhi.com/tags/linux/index.xml" rel="self" type="application/rss+xml" /><item>
            <title>AdguardHome容器化部署</title>
            <link>https://liangjinzhi.com/adguardhome-docker-setup/</link>
            <pubDate>Sat, 30 May 2026 06:23:38 +0000</pubDate>
            <guid>https://liangjinzhi.com/adguardhome-docker-setup/</guid>
            <description>&lt;p&gt;家里有linux主机，于是就想到了现在上网的时候经常有太多的网站会有广告，看看能不能通过自建规则减少广告。听说有AdguardHome可以实现这个功能。那么我们来看看如何部署和使用起来。&lt;/p&gt;&#xA;&lt;h2 id=&#34;概述&#34;&gt;概述&#xA;&lt;/h2&gt;&lt;p&gt;ADGUARDHOME是一款网络级广告和跟踪器拦截DNS服务器，作为一款开源的隐私保护工具，它能够在网络层面为所有设备提供广告过滤和隐私保护功能，无需在每个设备上单独安装客户端软件。通过Docker容器化部署ADGUARDHOME，可以实现快速部署、环境隔离和版本管理，适用于家庭网络、小型企业网络等多种场景。&lt;/p&gt;&#xA;&lt;h2 id=&#34;part1-服务端环境准备&#34;&gt;PART1 服务端环境准备&#xA;&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Debian,docker,AdguardHome镜像源&#xA;主机IP:192.168.5.200&lt;/p&gt;&#xA;&lt;p&gt;镜像源可以自行查找&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&#xA;&lt;p&gt;编写Docker-compose.yml&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;services:&#xA;adguardhome:&#xA;image: docker.1ms.run/adguard/adguardhome:v0.107.76&#xA;container_name: adguardhome&#xA;restart: unless-stopped&#xA;# 宿主机目录挂载，确保升级或重启时数据不丢失&#xA;volumes:&#xA;- ./ag_work:/opt/adguardhome/work&#xA;- ./ag_conf:/opt/adguardhome/conf&#xA;ports:&#xA;- &amp;ldquo;53:53/tcp&amp;rdquo;&#xA;- &amp;ldquo;53:53/udp&amp;rdquo;&#xA;- &amp;ldquo;8081:8081/tcp&amp;rdquo;&#xA;- &amp;ldquo;443:443/tcp&amp;rdquo;&#xA;- &amp;ldquo;443:443/udp&amp;rdquo;&#xA;- &amp;ldquo;3000:3000/tcp&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&#xA;&lt;p&gt;这里因为我本地环境80端口已经启用了，所以把adguardHome的默认80端口修改成8081了。请自行注意&lt;/p&gt;&#xA;&lt;p&gt;启用命令&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo docker compose up -d&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&#xA;&lt;p&gt;启动后&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;dog@debian:~/adguard$ docker ps  |grep adguard&#xA;98dd7f0db486   docker.1ms.run/adguard/adguardhome:v0.107.76                                         &amp;ldquo;/opt/adguardhome/Ad…&amp;rdquo;   24 hours ago   Up 16 hours             0.0.0.0:53-&amp;gt;53/tcp, 0.0.0.0:53-&amp;gt;53/udp, [::]:53-&amp;gt;53/tcp, [::]:53-&amp;gt;53/udp, 80/tcp, 67-68/udp, 0.0.0.0:443-&amp;gt;443/tcp, [::]:443-&amp;gt;443/tcp, 853/udp, 853/tcp, 3000/udp, 5443/tcp, 0.0.0.0:3000-&amp;gt;3000/tcp, [::]:3000-&amp;gt;3000/tcp, 0.0.0.0:8081-&amp;gt;8081/tcp, 0.0.0.0:443-&amp;gt;443/udp, [::]:8081-&amp;gt;8081/tcp, [::]:443-&amp;gt;443/udp, 5443/udp, 6060/tcp   adguardhome&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&#xA;&lt;p&gt;访问首页，并设置密码&lt;/p&gt;&#xA;&lt;figure class=&#34;wp-block-image size-large&#34;&gt;&#xA;&lt;p&gt;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; width=&#34;1024&#34; height=&#34;629&#34; src=&#34;https://liangjinzhi.com/wp-content/uploads/2026/05/image-1024x629.png&#34; alt=&#34;&#34; class=&#34;wp-image-40&#34; srcset=&#34;https://liangjinzhi.com/wp-content/uploads/2026/05/image-1024x629.png 1024w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-300x184.png 300w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-768x472.png 768w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-1536x943.png 1536w, https://liangjinzhi.com/wp-content/uploads/2026/05/image.png 1601w&#34; sizes=&#34;auto, (max-width: 1024px) 100vw, 1024px&#34; /&gt; &lt;/figure&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;回到首页-设置-dns设置&#34;&gt;回到首页-设置-DNS设置&#xA;&lt;/h2&gt;&lt;p&gt;设置上游DNS服务器，直接粘贴&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;https://dns.alidns.com/dns-query&#xA;&lt;a class=&#34;link&#34; href=&#34;https://doh.pub/dns-query&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;https://doh.pub/dns-query&lt;/a&gt;&#xA;&lt;a class=&#34;link&#34; href=&#34;https://doh.360.cn/dns-query&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;https://doh.360.cn/dns-query&lt;/a&gt;&#xA;114.114.114.114&#xA;223.5.5.5&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;bootstrap-dns-服务器&#34;&gt;Bootstrap DNS 服务器&#xA;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;223.5.5.5&#xA;119.29.29.29&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&#xA;&lt;p&gt;点击保存&lt;/p&gt;&#xA;&lt;h3 id=&#34;回到过滤器自定义过滤规则&#34;&gt;回到过滤器，自定义过滤规则&#xA;&lt;/h3&gt;&lt;p&gt;通过指定域名进行拦截，demo如下&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;||dns.weixin.qq.com.cn^&lt;/p&gt;&#xA;&lt;p&gt;应用即可&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;part2-路由器&#34;&gt;PART2 路由器&#xA;&lt;/h2&gt;&lt;p&gt;以中兴路由器为例，网络-配置DNS服务器为服务器端的IP。（我这里是192.168.5.200）&lt;/p&gt;&#xA;&lt;figure class=&#34;wp-block-image size-large&#34;&gt;&#xA;&lt;p&gt;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; width=&#34;1024&#34; height=&#34;511&#34; src=&#34;https://liangjinzhi.com/wp-content/uploads/2026/05/image-2-1024x511.png&#34; alt=&#34;&#34; class=&#34;wp-image-47&#34; srcset=&#34;https://liangjinzhi.com/wp-content/uploads/2026/05/image-2-1024x511.png 1024w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-2-300x150.png 300w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-2-768x383.png 768w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-2-1536x767.png 1536w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-2.png 1623w&#34; sizes=&#34;auto, (max-width: 1024px) 100vw, 1024px&#34; /&gt; &lt;/figure&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;part3-终端电脑&#34;&gt;PART3 终端电脑&#xA;&lt;/h2&gt;&lt;p&gt;以win10/win11为例&lt;/p&gt;&#xA;&lt;p&gt;1.按下 Win + R 键，输入 cmd 并按 Enter 打开命令提示符。&lt;br /&gt;2.输入ipconfig /flushdns 刷新DNS缓存&lt;/p&gt;&#xA;&lt;figure class=&#34;wp-block-image size-full is-resized&#34;&gt;&#xA;&lt;p&gt;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; width=&#34;494&#34; height=&#34;311&#34; src=&#34;https://liangjinzhi.com/wp-content/uploads/2026/05/image-3.png&#34; alt=&#34;&#34; class=&#34;wp-image-48&#34; style=&#34;width:532px;height:auto&#34; srcset=&#34;https://liangjinzhi.com/wp-content/uploads/2026/05/image-3.png 494w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-3-300x189.png 300w&#34; sizes=&#34;auto, (max-width: 494px) 100vw, 494px&#34; /&gt; &lt;/figure&gt;&lt;/p&gt;&#xA;&lt;p&gt;刷新后，你可以通过以下命令查看当前电脑实际使用的 DNS 服务器地址，确保它确实是你设置的 AdGuardHome 主机 IP&lt;/p&gt;&#xA;&lt;figure class=&#34;wp-block-image size-full&#34;&gt;&#xA;&lt;p&gt;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; width=&#34;355&#34; height=&#34;241&#34; src=&#34;https://liangjinzhi.com/wp-content/uploads/2026/05/image-4.png&#34; alt=&#34;&#34; class=&#34;wp-image-49&#34; srcset=&#34;https://liangjinzhi.com/wp-content/uploads/2026/05/image-4.png 355w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-4-300x204.png 300w&#34; sizes=&#34;auto, (max-width: 355px) 100vw, 355px&#34; /&gt; &lt;/figure&gt;&lt;/p&gt;&#xA;  &lt;br /&gt;&#xA;&lt;h2 id=&#34;查看效果&#34;&gt;查看效果&#xA;&lt;/h2&gt;&lt;p&gt;通过电脑任意访问一个网站如&lt;a href=&#34;https://news.qq.com/&#34;&gt;&lt;a class=&#34;link&#34; href=&#34;https://news.qq.com/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;https://news.qq.com/&lt;/a&gt;&lt;/a&gt; 回到查询日志-选择已过滤&lt;/p&gt;&#xA;&lt;figure class=&#34;wp-block-image size-large&#34;&gt;&#xA;&lt;p&gt;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; width=&#34;1024&#34; height=&#34;492&#34; src=&#34;https://liangjinzhi.com/wp-content/uploads/2026/05/image-1-1024x492.png&#34; alt=&#34;&#34; class=&#34;wp-image-42&#34; srcset=&#34;https://liangjinzhi.com/wp-content/uploads/2026/05/image-1-1024x492.png 1024w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-1-300x144.png 300w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-1-768x369.png 768w, https://liangjinzhi.com/wp-content/uploads/2026/05/image-1.png 1534w&#34; sizes=&#34;auto, (max-width: 1024px) 100vw, 1024px&#34; /&gt; &lt;/figure&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;参考资料&#34;&gt;参考资料&#xA;&lt;/h2&gt;&lt;p&gt;&lt;a href=&#34;https://github.com/SeanChang/xuanyuan_docker_proxy/blob/main/blog/adguardhome-docker.md#adguardhome-docker-%E5%AE%B9%E5%99%A8%E5%8C%96%E9%83%A8%E7%BD%B2%E6%8C%87%E5%8D%97&#34;&gt;AdguardHome Docker 容器化部署指南&lt;/a&gt;&lt;/p&gt;&#xA;</description>
        </item></channel>
</rss>
