0478.html 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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="How To,Tutorial,i12bretro,Pihole,Docker,Ad Blocker,DNS Ad Blocking,DNS,Containerize,Pi-Hole">
  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. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  12. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  13. <script type="text/javascript" src="includes/js/steps.js"></script>
  14. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  15. </head>
  16. <body>
  17. <div id="gridContainer">
  18. <div class="topMargin"></div>
  19. <div id="listName" class="topMargin">
  20. <h1>Running Pi-Hole Network Wide Ad Blocker Using Docker</h1>
  21. </div>
  22. <div></div>
  23. <div id="content">
  24. <h2>What is Pi-Hole?</h2>
  25. <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>
  26. <h2>Installing Docker</h2>
  27. <ol>
  28. <li>Log into the Linux based device</li>
  29. <li>Run the following commands in the terminal
  30. <div class="codeBlock"># install prerequisites<br />
  31. sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y<br />
  32. # add docker gpg key<br />
  33. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -<br />
  34. # add docker software repository<br />
  35. sudo add-apt-repository &quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable&quot;<br />
  36. # install docker<br />
  37. sudo apt install docker-ce docker-compose containerd.io -y<br />
  38. # enable and start docker service<br />
  39. sudo systemctl enable docker &amp;&amp; sudo systemctl start docker<br />
  40. # add the current user to the docker group<br />
  41. sudo usermod -aG docker $USER<br />
  42. # reauthenticate for the new group membership to take effect<br />
  43. su - $USER<br />
  44. # edit resolvd config<br />
  45. sudo nano /etc/systemd/resolved.conf</div>
  46. </li>
  47. <li>Uncomment the line starting with DNSStubListener= and set the value to no
  48. <p>DNSStubListener=no</p>
  49. </li>
  50. <li>Press CTRL+O, Enter, CTRL+X to write the changes to resolved.conf</li>
  51. <li>Continue with the following commands to restart systemd-resolve to free up port 53
  52. <div class="codeBlock"># restart the systemd-resolve service<br />
  53. sudo systemctl restart systemd-resolved</div>
  54. </li>
  55. </ol>
  56. <h2>Running Pi-Hole</h2>
  57. <ol>
  58. <li>Now that Docker is installed, run the following commands to setup the Pi-Hole Docker container and run it
  59. <div class="codeBlock"># create working directories<br />
  60. mkdir /home/$USER/docker/pihole -p &amp;&amp; mkdir /home/$USER/docker/pihole/dnsmasq.d -p<br />
  61. # run the pihole docker container<br />
  62. 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>
  63. </li>
  64. <li>Once the Pi-Hole container is downloaded and running, open a web browser and navigate to http://DNSorIP/admin</li>
  65. </ol>
  66. <p>Documentation: <a href="https://github.com/pi-hole/docker-pi-hole" target="_blank">https://github.com/pi-hole/docker-pi-hole</a></p>
  67. </div>
  68. </div>
  69. </body>
  70. </html>