0107.html 6.6 KB

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