You can follow pi hole website to do it pi-hole.net
Very easy, straight forward, and well explained.
The only thing you might want to check before buying something or trying this is if your router allows to set custom dns servers. Basically,connect to your router, and check the step 3, and see if it has the option for it. From my understanding some might not have the option.
Not necessary, but a next step can also be to install a VPN and route your mobile phone thru it too. Means you are also covered on the go, so no ads on mobile too , when you aren’t home too !