0107.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Running Pi-Hole Ad-Blocker in a VirtualBox VM</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="VirtualBox,Virtual Machine,Raspberry Pi OS,Raspbian,Pi-Hole,PiHole,DNS,Ad Blocker,DNS Ad Blocking,Block,Home Lab,Home Lab Ideas,Install Guide,Self-Hosted,Web Based,Ad Blocking,Ad,Free Software,Free Open-Source Software,FOSS,Debian,Install Pi-Hole On Debian,Hypervisor,VirtualBox VM,VM,Raspberry Pi VirtualBox,Pi-Hole Installation Guide,Open Source,Open-Source,Networking,Network Wide Ad Blocking,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Running Pi-Hole Ad-Blocker in a VirtualBox VM">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="10/08/2022 09:25:18 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 Ad-Blocker in a VirtualBox VM</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>Creating the VM</h2>
  26. <ol>
  27. <li>Download Raspberry Pi OS <a href="https://downloads.raspberrypi.org/rpd_x86_latest" target="_blank">Download</a></li>
  28. <li>Launch Virtualbox</li>
  29. <li>Create a New VM by selecting Machine &gt; New
  30. <p>Name: Raspberry Pi-Hole<br />
  31. Machine Folder: C:\VMs<br />
  32. Type: Linux<br />
  33. Version: Debian (32-bit)<br />
  34. Memory Size: 1024 MB<br />
  35. Hard disk: Create a virtual hard disk now</p>
  36. </li>
  37. <li>Click Create</li>
  38. <li>On the Create Virtual Hard Disk dialog
  39. <p>Name the virtual disk image Raspberry Pi-Hole.vdi<br />
  40. File size: 12-16 GB<br />
  41. Hard disk file type: VDI<br />
  42. Storage on physical hard disk: Dynamically Allocated</p>
  43. </li>
  44. <li>Click Create</li>
  45. <li>Select the VM and Click Settings</li>
  46. <li>Select System &gt; Processor</li>
  47. <li>Give the VM at least 2 processors</li>
  48. <li>Select Display</li>
  49. <li>Slide the Video Memory to 128 MB</li>
  50. <li>Select Network</li>
  51. <li>Set the attached to dropdown to Bridged Adapter</li>
  52. <li>Select Storage</li>
  53. <li>Click on the CD-ROM drive</li>
  54. <li>Select the disc dropdown to the right &gt; Choose a virtual optical disc file...</li>
  55. <li>Browse to and select the Raspberry Pi desktop .iso file</li>
  56. <li>Click OK</li>
  57. <li>Make sure the Raspberry Pi-Hole VM is selected and click Start &gt; Normal</li>
  58. <li>Select Graphical Install</li>
  59. <li>Select a keyboard map &gt; click Continue</li>
  60. <li>Select Guided - use entire disk &gt; click Continue</li>
  61. <li>Click Continue, Continue, Continue</li>
  62. <li>Select Yes to confirm writing the changes to disk &gt; click Continue</li>
  63. <li>Wait while Debian and the Raspberry Pi Desktop are installed</li>
  64. <li>Select Yes to install GRUB on the master boot record &gt; click Continue</li>
  65. <li>Select /dev/sda &gt; click Continue</li>
  66. <li>Click Continue to reboot the VM</li>
  67. <li>Click Next on the welcome dialog</li>
  68. <li>Set the Country, Language and Time Zone &gt; click Next</li>
  69. <li>Enter and confirm a password for the pi user &gt; click Next</li>
  70. <li>Click Skip to updating software</li>
  71. <li>Click Finish to reboot the VM and complete setup</li>
  72. </ol>
  73. <h2>Installing Updates and Pi-Hole</h2>
  74. <ol>
  75. <li>Click the Applications button &gt; Accessories &gt; Terminal</li>
  76. <li>Run the following commands to install updates
  77. <div class="codeBlock">sudo apt update<br />
  78. sudo apt upgrade -y<br />
  79. sudo apt clean<br />
  80. sudo reboot now</div>
  81. </li>
  82. <li>Select Devices &gt; Insert Guest Additions CD image...</li>
  83. <li>If the installation autoruns, select Run</li>
  84. <li>On the desktop, Right click on the Guest Additions disc &gt; Open in Terminal</li>
  85. <li>In the Terminal window run the following commands
  86. <div class="codeBlock">sudo sh ./VBoxLinuxAdditions.run<br />
  87. sudo reboot now</div>
  88. </li>
  89. <li>The VM will reboot</li>
  90. <li>Upon rebooting, you can now full screen the VM and the internal resolution will automatically change to match the window size</li>
  91. <li>Click the Applications button &gt; Accessories &gt; Terminal</li>
  92. <li>Run the following command to install Pi-Hole
  93. <div class="codeBlock">curl -sSL https://install.pi-hole.net | bash</div>
  94. </li>
  95. <li>Press Enter until the DNS selection is displayed</li>
  96. <li>Select a DNS provider and press Enter</li>
  97. <li>Press Enter through the rest of the Pi-Hole installer, selecting the defaults</li>
  98. <li>Copy the randomly generated admin password (just in case)</li>
  99. <li>Press Enter to complete the installation</li>
  100. <li>Run the following command to change the Pi-Hole admin password
  101. <div class="codeBlock">sudo pihole -a -p</div>
  102. </li>
  103. <li>Enter and confirm the new password</li>
  104. <li>Click the Applications button &gt; Internet &gt; Chromium Web Browser</li>
  105. <li>Navigate to http://DNSorIP/admin</li>
  106. <li>Click Login</li>
  107. <li>Authenticate with the admin password</li>
  108. </ol>
  109. <h2>Testing Pi-Hole</h2>
  110. <ol>
  111. <li>Right click the VM network connection &gt; Wireless &amp; Wired Network Settings</li>
  112. <li>Select eth0 from the interface dropdown</li>
  113. <li>Clear out the DNS servers and input the VM IP address</li>
  114. <li>Click Apply</li>
  115. <li>Click Devices &gt; Network &gt; Connect Network Adapter to disable networking</li>
  116. <li>Click Devices &gt; Network &gt; Connect Network Adapter to re-enable networking</li>
  117. <li>In Chromium, open a new tab and navigate to https://yahoo.com</li>
  118. <li>Go back to the Pi-Hole tab and see that some DNS queries have been blocked</li>
  119. </ol>
  120. <h2>Setting Up From Windows Client</h2>
  121. <ol>
  122. <li>Click the Start button &gt; Type control panel &gt; press Enter</li>
  123. <li>Click View By &gt; Small Icons</li>
  124. <li>Click Network and Sharing Center</li>
  125. <li>Click Change adapter settings</li>
  126. <li>Right click on the network connection &gt; Properties</li>
  127. <li>Select Internet Protocol Version 4 (TCP/IPv4) &gt; Properties</li>
  128. <li>Select the radio option next to Use the following DNS server addresses</li>
  129. <li>Input the IP address of the Pi-Hole VM</li>
  130. <li>Click OK on both of the open dialog windows</li>
  131. <li>Right click the Start button &gt; Command Prompt (Admin)</li>
  132. <li>Type the following commands to flush your DNS cache and restart the network connections (note: your network connection will drop if running the commands on a remote machine)
  133. <div class="codeBlock">ipconfig /flushdns<br />
  134. ipconfig /release<br />
  135. ipconfig /renew</div>
  136. </li>
  137. </ol>
  138. <p>More on Pi-Hole <a href="https://pi-hole.net/" target="_blank">https://pi-hole.net/</a></p> </div>
  139. </div>
  140. </body>
  141. </html>