0478.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Running Pi-Hole Network Wide Ad Blocker Using Docker</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="Pihole,Docker,Ad Blocker,DNS Ad Blocking,DNS,Containerize,Pi-Hole,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Running Pi-Hole Network Wide Ad Blocker Using Docker">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="06/17/2022 08:42:30 AM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>Running Pi-Hole Network Wide Ad Blocker Using Docker</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>What is Pi-Hole?</h2>
  26. <blockquote cite="https://portainer.io">The Pi-hole&reg; is a DNS sinkhole that protects your devices from unwanted content, without installing any client-side software. -<a href="https://github.com/pi-hole/pi-hole" target="_blank">https://github.com/pi-hole/pi-hole</a></blockquote>
  27. <h2>Installing Docker</h2>
  28. <ol>
  29. <li>Log into the Linux based device</li>
  30. <li>Run the following commands in the terminal
  31. <div class="codeBlock"># install prerequisites<br />
  32. sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y<br />
  33. # add docker gpg key<br />
  34. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -<br />
  35. # add docker software repository<br />
  36. sudo add-apt-repository &quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable&quot;<br />
  37. # install docker<br />
  38. sudo apt install docker-ce docker-compose containerd.io -y<br />
  39. # enable and start docker service<br />
  40. sudo systemctl enable docker &amp;&amp; sudo systemctl start docker<br />
  41. # add the current user to the docker group<br />
  42. sudo usermod -aG docker $USER<br />
  43. # reauthenticate for the new group membership to take effect<br />
  44. su - $USER<br />
  45. # edit resolvd config<br />
  46. sudo nano /etc/systemd/resolved.conf</div>
  47. </li>
  48. <li>Uncomment the line starting with DNSStubListener= and set the value to no
  49. <p>DNSStubListener=no</p>
  50. </li>
  51. <li>Press CTRL+O, Enter, CTRL+X to write the changes to resolved.conf</li>
  52. <li>Continue with the following commands to restart systemd-resolve to free up port 53
  53. <div class="codeBlock"># restart the systemd-resolve service<br />
  54. sudo systemctl restart systemd-resolved</div>
  55. </li>
  56. </ol>
  57. <h2>Running Pi-Hole</h2>
  58. <ol>
  59. <li>Now that Docker is installed, run the following commands to setup the Pi-Hole Docker container and run it
  60. <div class="codeBlock"># create working directories<br />
  61. mkdir /home/$USER/docker/pihole -p &amp;&amp; mkdir /home/$USER/docker/pihole/dnsmasq.d -p<br />
  62. # run the pihole docker container<br />
  63. docker run -d --name=pihole -e TZ=America/New_York -e WEBPASSWORD=password -v /home/$USER/docker/pihole/:/etc/pihole -v /home/$USER/docker/pihole/dnsmasq.d:/etc/dnsmasq.d -p 80:80 -p 53:53/tcp -p 53:53/udp --restart=unless-stopped pihole/pihole</div>
  64. </li>
  65. <li>Once the Pi-Hole container is downloaded and running, open a web browser and navigate to http://DNSorIP/admin</li>
  66. </ol>
  67. <p>Documentation: <a href="https://github.com/pi-hole/docker-pi-hole" target="_blank">https://github.com/pi-hole/docker-pi-hole</a></p>
  68. </div>
  69. </div>
  70. </body>
  71. </html>