Install Pi-hole on Android

100DaysToOffload Android 

Most of you of would be aware of what Pi-hole is, but for those who are unaware, Pi-hole is network-based ad-blocking software, and a custom DNS server for Raspberry Pi devices. I don't own a Raspberry Pi device as of now, but I do own a couple of rooted android phones. In today's blog post, I'm going to discuss on how to get Pi-hole set up and running on your rooted android device.

Before starting, make sure that the device which you are gonna use is not your primary device, since it would be running 24x7, thus occupying some of its memory and storage while in use.

Prerequisites:

Steps:

  1. Download Linux Deploy app from Play Store or GitHub

  2. Open the app and grant it root access, and then click on the gear icon

  3. Over here set username and password, enable Init and select sysv as Init system, and lastly enable ssh

  4. Download ubuntu_arm64.tgz and place it inside your phone's Download folder

Why This Approach? I tried to use the default installation which is provided by the app, but for some reason the process always fails, and I couldn't get it to ssh, so I went with this approach

  1. Open Linux Deploy app again and click on the gear icon, and then set the Source Path to storage/emulated/0/Download/ubuntu_arm64.tgz. Go back to the main screen and click on the three dot menu and select install

  2. Wait for the installation to get finished, once done press start and now head over to your PC/Laptop to SSH into your phone

  3. Follow the Pi-hole installation steps listed on their GitHub

  4. Once everything is done, you need to execute these three commands

sudo usermod -a -G aid_net_bt_admin,aid_net_bt,aid_inet,aid_net_raw,aid_net_admin root

sudo usermod -a -G aid_net_bt_admin,aid_net_bt,aid_inet,aid_net_raw,aid_net_admin pihole

sudo usermod -a -G aid_net_bt_admin,aid_net_bt,aid_inet,aid_net_raw,aid_net_admin www-data
  1. Now head over to your phone's IP address and access the Pi-hole admin dashboard, and don't forget to set your phone's IP address as your DNS in your router

  2. BONUS STEP: Use my host file for one million ad lists

My Experience

I have been using this setup from the last 5 days. So far, I haven't noticed any performance or battery drop on my phone. I can still use the device for everyday usage such as watching YouTube videos. If you wanted to buy Raspberry Pi just for ad blocking, but you already owned a rooted phone, then this path is way cheaper and easier to use. I hope I'm able to provide a decent guide on this topic.

This is the Day 11 of 100DaysToOffload challenge (Round Two)