|
| 1 | +--- |
| 2 | +title: Homelab - Install Pi-hole |
| 3 | +slug: homelab-2-install-pihole |
| 4 | +publishDate: 29 Nov 2025 |
| 5 | +description: My homelab setup journey and documentation |
| 6 | +prevPost: homelab-1-additional-configuration |
| 7 | +tags: ["homelab"] |
| 8 | +--- |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +## Install Pi-hole |
| 13 | + |
| 14 | +We will use Docker and Docker Compose to set up Pi-hole and other services. |
| 15 | + |
| 16 | +1. In the home directory, create a `docker` directory and `pihole` inside `docker`. |
| 17 | + |
| 18 | + ```sh |
| 19 | + cd ~ |
| 20 | + mkdir -p docker/pihole |
| 21 | + ``` |
| 22 | +2. Create the `docker-compose.yml` file |
| 23 | + |
| 24 | + ```sh |
| 25 | + cd docker/pihole |
| 26 | + vim docker-compose.yml |
| 27 | + ``` |
| 28 | +3. Enter the contents |
| 29 | + |
| 30 | + ```sh |
| 31 | + services: |
| 32 | + pihole: |
| 33 | + container_name: pihole |
| 34 | + image: pihole/pihole:latest |
| 35 | + ports: |
| 36 | + - 53:53/tcp |
| 37 | + - 53:53/udp |
| 38 | + - 8081:80/tcp |
| 39 | + - 8443:443/tcp |
| 40 | + environment: |
| 41 | + TZ: Asia/Kolkata |
| 42 | + FTLCONF_webserver_api_password: <Admin panel Password> |
| 43 | + FTLCONF_dns_listeningMode: all |
| 44 | + volumes: |
| 45 | + - /mnt/data/docker-data/pihole/etc-pihole:/etc/pihole |
| 46 | + - /mnt/data/docker-data/pihole/etc-dnsmasq.d:/etc/dnsmasq.d |
| 47 | + restart: unless-stopped |
| 48 | + cap_add: |
| 49 | + - SYS_NICE |
| 50 | + - NET_ADMIN |
| 51 | + ``` |
| 52 | + |
| 53 | + Port 53 is for the DNS resolver, 8081 and 8443 are for the admin dashboard. Set the admin panel dashboard accordingly. |
| 54 | +4. Start the container |
| 55 | + |
| 56 | + ```sh |
| 57 | + docker compose up -d |
| 58 | + ``` |
| 59 | + |
| 60 | + This will pull the Pi-hole Docker image and start the container. |
| 61 | +5. Once the service is up, we can verify by launching the admin panel from `192.168.0.153:8081/admin`. If everything is okay, we can see the login page. |
| 62 | + |
| 63 | +## Set Pi-hole as the DNS resolver |
| 64 | + |
| 65 | +In the router admin page, we need to set the DNS endpoint to our Pi-hole server. |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +After applying, all the DNS queries will be handled by our Pi-hole server. |
0 commit comments