Computer & Technology Guides Guides

Install Pi-hole on Raspbian Lite From Scratch

Spread the love

Pi-hole is a fantastic product for your home network and allows ad blocking at the network level. My install Pi-hole article will walk you through every thing you will need to do to install Pi-hole from scratch using a low power Raspberry Pi!


While there are many ways to install Pi-hole and many different operating systems and hardware you can use, for this article we are going to be using the following to install Pi-hole on your network. I assume you are starting from scratch so if you have any of the below you can skip purchasing them, obviously. Note that links are affiliate.


  • Raspberry Pi B 3+ with Power Supply and Heatsinks – This is the latest version of the Raspberry Pi and comes with a power supply and heatsinks.
  • Samsung Evo Plus 32GB MicroSD HC Class 10 UHS-1 – Picking the right microSD card is important. Reliability and speed are crucial to the performance of your Raspberry Pi.
  • Anker 8-in-1 USB 3.0 Portable Card Reader – In order to write Raspbian Lite to your microSD card you will need a microSD reader if your computer does not support it already.
  • Ethernet Cable – Any Cat 5E or higher rated cable will do. The Raspberry Pi B 3+ is limited to USB 2.0 bus speeds so no matter what you do you will not be able to reach Gigabit speeds.
  • An open Ethernet port – Your Raspberry Pi will need to connect to your network, either by your router or a switch.
    • Router – Finding a router is outside the scope of this article. When I start researching a product I first check out and check out how many reviews the products have. There are also many websites that review routers that you can base your decision off of. I personally enjoy The Wire Cutter who keeps all their articles updated.
    • TRENDnet 5-Port Unmanaged Gigabit GREENnet – If you already have a router and just want to expand your network, an unmanaged switch is a cheap and easy way to do so.


  • Windows 10 – Windows 10 will be used to download our operating system and then write it to our microSD card.
  • Raspbian Lite – We will be installing Raspbian Lite to run Pi-hole.
  • Etcher – We will be using Etcher to burn the Raspbian Lite to our microSD card.
  • MobaXterm – MobaXterm will allow us to remotely manage our Pi-hole server.
  • Pi-hole – The reason we are here.

Install Raspbian Lite

Head on over to the official download page and grab the Raspbian Stretch Lite download. Take your microSD card and put it into your microSD card reader then plug it into your computer.

Format Your microSD Card

We will be using Disk Management to format and name your microSD card. If there are no other partitions on it you can skip this step and move on to installing with Etcher as Etcher will format your card as well. Using Disk Management will make sure that you only have one partition for your Raspbian Lite install.

In Windows 10 search menu type create and format like below:

Create and Format Disks Windows 10
Create and Format Disks Windows 10

Once open, find your microSD card and delete any partitions associated with it. You should end up with your microSD card with nothing by unallocated space like below:

MicroSD Unallocated Space
MicroSD Unallocated Space Example

Now we need to create a new Volume so right click the area that says Unallocated and then select New Simple Volume:

Create New Simple Volume
Create a new simple volume

Follow the new window steps to create your volume. You do not need to change anything, other than the name of the volume should you choose to. In my example, we are going to use the name RaspLite.

Naming New Simple Volume
Naming our microSD Card

Click Next and then Finish and now we have our new volume ready to install via Etcher.

Install Raspbian Lite with Etcher

If you haven’t already, go to and download the latest version and open it up. Etcher is simple, you simply need to select the image, which you downloaded earlier and then select your microSD card and then hit Flash!

Etcher, after selecting Raspbian Lite image and microSD card.

The Flash will take a few minutes, depending on your setup. We have one more step to do before we install the microSD card into your Raspberry Pi.

Enable SSH

Before we install our microSD card into the Raspberry Pi we need to make sure we can log in via SSH since we are going to run the Raspberry Pi headless (CLI only). Doing this is easy. In your Windows Explorer simply open up your microSD drive and then create a new file simply called ssh. No file name extension is needed. The easiest way to do this is to right click, create a new text file, name it ssh and then remove the .txt file extension.

Create new file called ssh
Create new file called ssh

The end result will look similar to this:

Boot SSH File
SSH file opens up port 22 for Raspbian Lite

Now we are ready to install the microSD card into our Raspberry Pi and turn it on.

Connect To Raspbian

At this point you should have your microSD card in your Raspberry Pi and your Raspberry Pi should be booted. Simply plug in the power to your Raspbian, make sure it is plugged into your network and then follow the next steps once it has booted.

Download MobaXterm

MobaXterm will be our way of managing our Pi-hole on our network. Download it via their website. The free version is plenty fine for what we are going to do but if you do more I highly recommend the paid version as the quality of this software is fantastic.

Once downloaded we are going to create and save a new session.

Create New Session

Open MobaXterm and then select the Sessions menu and then click New Sessions. On the new window choose SSH. Fill in like below, replacing with your ip address.

MobaXterm Raspbian Lite Setup
Connect to Raspbian Lite with MobaXterm

Click Ok and then simply double click your new Session to open a connection to your Raspberry Pi.

As per the screenshot above, your username is simply pi. The default password is raspberry.

Change Raspbian Lite Password & Update

The first step we are going to take is to change our password. The command is simply:

Raspbian Lite Password Change
Change the default password on Raspbian Lite

Simply follow the instructions as above and now you have a bit more secure Raspbian Lite installation.

Our next step is to update Raspbian Lite and make sure we have the latest version of all of our files. Run the following commands:

sudo apt-get update
sudo apt-get dist-upgrade

Once done we are ready to install Pi-hole!

Install Pi-hole

The steps to install Pi-hole is the easiest part out of all of this. We can do this simply by running 2 commands. As we are going to use Google DNS as our upstream DNS server as well as install the rest of the options as default so we do not have to change anything at all in the installation script. If you wish to use another upstream DNS then I will note below where you will need to make the change. The rest of the options are up to you to disable or enable at your choosing.


Run the following two commands to start the installation:

wget -O
sudo bash

The installation script will run and eventually you will be shown this screen:

Install Pi-Hole Screen
Installation start screen for Pi-hole

You can hit enter the rest of the way through if you want to use Google DNS for upstream. If you wish to use another upstream provider then you should stop on this screen and make your changes:

Pi-Hole Change Upstream DNS
Change the upstream DNS for Pi-hole.

The installation should finish and you should land on this screen:

Pi-Hole Installation
Pi-hole finished screen

Your finish screen will show you the IPv4 and IPv6 addresses you will need to use in your router so that your router can forward all DNS requests to your Pi-hole server instead of your ISP.

Hit enter and you will be brought back to your command line screen. It is important to note your web interface password here so you can login later. It will be shown like this:

Pi-hole Web Ineterface Password
Your Pi-hole web interface password is shown here

Final Configuration

The final configuration steps largely depend on your home network’s setup. How you configure your router to point to Pi-hole depends on your router’s model. You can check out this page for some examples or refer to your router’s documentation or support page.

Once you have configured your router and requests are being sent to your Pi-hole server, you will more than likely want to view stats and be able to change settings with via more than just the command line. That is where the Pi-hole web interface comes in.

On the finish page you are given your Pi-hole’s ip address. Type that into your web browser and add /admin to the end. From my screenshot, I would type in the following:

You will be shown the following screen:

Pi-Hole Dashboard
Pi-Hole Dashboard

From here you can click the Login link and use the web interface password noted previously to login to your dashboard to see even more stats and settings for your Pi-hole server.

After running for awhile, you can see quite a bit of information as seen below:


If you wish to move to a more secure DNS I recommend checking out this article for how to run DNS-Over-HTTPS, which I do for both of my Pi-hole servers.

Devices With Hard-coded DNS

If you find that some of your devices are not hitting your Pi-hole it is more than likely because they have their DNS hard-coded. Popular devices such as the Chromecast are guilty of this. If you have an EdgeRouter X, you can check out my guide on how to capture hard-coded DNS queries on your network and redirect them to your Pi-hole. You can also check out this thread on Reddit for other devices.

Setup Log2Ram

Log2Ram is a great for your Raspberry Pi because it reduces the number of times that Pi-hole writes to your SD card, which can reduce the lifespan of your SD Card. The Log2Ram GitHub page has all the information you need to set it up and customize it so check it out.

Improve Boot Time

By default it takes a bit of time to boot up Raspbian Lite. Check out this guide on how to get the boot time down to a more reasonable level: How-To Improve Your Raspberry Pi Boot Time On Raspbian Lite

Spread the love

19 replies on “Install Pi-hole on Raspbian Lite From Scratch”

This also works on the original raspberry pi, and also ZeroW and will happily run on a much smaller SD card to save some $, new rasp B+ is overkill paired with Rasbian Lite with that large SD card.

This wasn’t meant to be a dirt cheap way to do it but yes, if you dig around eBay or other retailers you can probably save a few bucks.

Great guide tyvm. I did realize but I didn’t have IPv6 set up with my router. What do I need to do to change this and then what do I need to do with pihole?

Thanks very good guide, … all somekind of useless at the end.. as my router does not allow me to change DNS …. so I am back on a device level… which I wanted to prevent… but still great guide…

(the only thing which was not clear to me, was how I could get the IP of the PI… I checked my router for that… but I guess there are more convienent ways to do this…

Thanks, and again, very good and clear guide..
Greeting from Germany

Hey Brent, love the easy and helpful guide.
Quick question tho; the auto list update step, after adding the last 7*** and ‘ctrl+O’ to save, and ‘ctrl+x’ to exit, I keep getting unsuccessful process.
after ‘ctrl+O’ do I need to change the file name? or keep it as is by just hitting ‘enter’ ?

Its worth noting that advancedIPscanner is a great utility for figuring out the IP addresses of the devices on your network quickly.

Thanks Brent! May I make some suggestions?

Before the “Connect to Raspbian” topic, I was wondering how I would connect to the pi; it’s headless, and I don’t know its hostname or IPv4 address (or it’s MAC address, for that matter!).

As an IT Pro, I knew I could check the DHCP table on my Internet router. When I checked, the default hostname is “raspberrypi”. The device registers its hostname with the router, so I could just ping “raspberrypi” on my Windows 10 computer and it resolved and pinged successfully. You may wish to consider adding this suggestion. If you know this, it avoids the relatively complicated process of checking the DHCP table on the router.

You mention downloading “mobaxterm”. Actually, this isn’t strictly necessary anymore; Windows 10 version 1803 and above have an SSH client built in!

Combining the two, the instructions to connect are simply…
1. Open a Command Prompt window.
2. Enter ‘ssh -l pi raspberrypi’
3. Enter the default password “raspberry”


plodding through this how-to. The moment I take the microsd card out and put it into my Raspberry Pi (2 or 3 or something) I only get a command line interface. Your how-to shows pretty pictures, but I’m stuck with login:….. I was able to get in with pi/raspberry, and update password. but I’ll have to muddle through the rest.

plodding through this how-to. The moment I take the microsd card out and put it into my Raspberry Pi (2 or 3 or something) I only get a command line interface. Your how-to shows pretty pictures, but I’m stuck with login:….. I was able to get in with pi/raspberry, and update password. but I’ll have to muddle through the rest.

pretty much everything worked except for that mobaxterm. I’d prefer to use the remote desktop that I’m already using, VNC – let’s make that work! thanks.

Well done tutorial, thank you.
Successfully installed until it was time for FTL download.
Error: Unable to get latest release location from Github
FTL Engine not installed.
Not sure how to rectify this.

Leave a Reply

Your email address will not be published. Required fields are marked *