Ubuntu Tutorial: Setup AdGuard

0 - Introduction

If you are looking for a way to block ads network wide AdGuard home is perfect for you. With a very easy installation and web panel to use, you can set it up in a couple of minutes.

To follow this article you will need docker installed, you can learn how to install it in this article.

1 - Setup

Let’s start the installation by creating a folder where the data will be stored at, then, inside it, create a file named ‘docker-compose.yml’ and paste the following contents:

services:
  adguardhome:
    image: adguard/adguardhome
    container_name: adguardhome
    restart: unless-stopped
    network_mode: host
    volumes:
      - ./data/work:/opt/adguardhome/work
      - ./data/config:/opt/adguardhome/conf
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "68:68/udp"
      - "80:80/tcp"
      - "443:443/tcp"
      - "443:443/udp"
      - "3000:3000/tcp"
      - "853:853/tcp"
      - "784:784/udp"
      - "853:853/udp"
      - "8853:8853/udp"
      - "5443:5443/tcp"
      - "5443:5443/udp"
    deploy:
      restart_policy:
        condition: unless-stopped

After saving the file, on a terminal, run:

docker compose up # -d to run dethatched

When the container starts up, you can go to your browser to run the installation at:

http//machineip:3000

After clicking ‘Get Started’ you will see a list of interfaces where AdGuard will be accessible at. If you get an error saying that port 80 is in use, you need to either free the port or change it in the docker compose file.

If you scroll down, in the same page as before, you will also see in which interfaces the DNS server is accessible at. In this case, it will probably be in use.

You can check this page, to see how to free that port, and fix any other errors you could get.

After fixing any port collisions you might have gotten and clicking next, you will be prompted to input a username and password.

This username and password will be used anytime you need to access the dashboard.

After choosing them, click next.

Finally, just press ‘Open Dashboard’ and you will be taken there.

You will be prompted for the credentials you set earlier.

In this dashboard, you can set the filters for the adblocker, set dns names for internal ips, and configure almost everything about AdGuard.

And that’s it, now you just need to set the dns server on your pc or your router!

Thanks for reading and stay tuned for more tech insights and tutorials. Until next time, keep exploring the world of tech!