Online advertisements are very annoying sometimes and waste most of your time when browsing content online. Some tend to pop up over the content you are watching or reading making it difficult for you to access it. I faced the challenge and I had to use adblocker to keep me away from receiving unnecessary ads in my browser. Adblocker plays a critical role by hiding or blacklisting ads.
Adblocker is useful and helpful for a number of reasons below.
- Keeps advertisers from tracking you across websites.
- Protects you from Malware as some malware comes as an advert.
- Removes distracting ads thus make pages easier to read or watch.
- Reduce bandwidth utilization especially on mobile devices.
- Reduce power usage especially draining of batteries on mobile devices.
- Block fake news.
Basically, AdBlockers are tools meant to remove or hide content identified as an advert when browsing. Adblocker exist in two forms;
- Independent programs for specific browsers or operating systems.
- Plugins and browser extensions.
Maza is a simple, native and efficient local adverts blocker and is an independent program. The tool is currently compatible with Linux and OSX operating systems only.
Benefits and features of Maza Adblocker
- Block Ads. Hides any advert in any form from interrupting with your content.
- Block tracker. No one is able to follow your online footprints from one website to another.
- Privacy protection. `Protects you from malicious activities such phishing or even malware attack
- Maza is an Open-Source application availble for free.
- Independent – Maza affects any browser.
- Is a bash-based application.
In this article, am going to take you through on how to install Maza AdBlocker on Both Linux based systems and OSX system.
Setup Requirements:
- Bash version 4.0 or higher.
- Curl command
- gsed for macOS users only. You can install it with the brew command (brew install gnu-sed).
Step 1: Install Maza on Linux | macOS | BSD
First and foremost, make a backup of your /etc/hosts file in case of any uncertain conditions.
sudo cp /etc/hosts /etc/hosts.backup
To install maza AdBlocker in Linux, macOS and BSD, run the below command in the terminal. The Command will download maza, make it executable then move it to a binary file folder.
curl -o maza https://raw.githubusercontent.com/tanrax/maza-ad-blocking/master/maza
chmod +x maza
sudo mv maza /usr/local/bin
Configure auto-update of domains to be blocked with a cron job.
$ crontab -e
Embed this file at the end of the file.
@daily maza update
Congratulations!! You have maza now installed.
Managing Maza AdBlocker services.
#To Start Maza.
$ maza start
List updated!
ENABLED!
#To update maza.
$ maza update
List updated!
#To Stop maza.
maza stop
Step 2: Install Dnsmasq Domain Name System caching service
To be able to cover all subdomains (wildcards), we will need a local DNS server (DNSMASQ). The local server is well compatible with Maza since Maza supports the Dnsmasq format.
#Update maza
maza update
Linux
For Debian/Ubuntu:
$ sudo apt update -y
$ sudo apt install -y dnsmasq
The following NEW packages will be installed:
dnsmasq
0 upgraded, 1 newly installed, 0 to remove and 16 not upgraded.
Need to get 16.2 kB of archives.
After this operation, 73.7 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 dnsmasq all 2.79-1ubuntu0.4 [16.2 kB]
Fetched 16.2 kB in 1s (24.7 kB/s)
Selecting previously unselected package dnsmasq.
(Reading database ... 128408 files and directories currently installed.)
Preparing to unpack .../dnsmasq_2.79-1ubuntu0.4_all.deb ...
Unpacking dnsmasq (2.79-1ubuntu0.4) ...
Setting up dnsmasq (2.79-1ubuntu0.4) ...
Created symlink /etc/systemd/system/multi-user.target.wants/dnsmasq.servic
e → /lib/systemd/system/dnsmasq.service.
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for systemd (237-3ubuntu10.51) ...
FreeBSD:
$ pkg update
$ pkg install dnsmasq
New packages to be INSTALLED:
dnsmasq: 2.85_1,1
gmp: 6.2.1
libidn2: 2.3.1
libunistring: 0.9.10_1
nettle: 3.7.3
Number of packages to be installed: 5
The process will require 13 MiB more space.
3 MiB to be downloaded.
Proceed with this action? [y/N]: Y
Message from dnsmasq-2.85_1,1:
--
To enable dnsmasq, edit /usr/local/etc/dnsmasq.conf and
set dnsmasq_enable="YES" in /etc/rc.conf[.local]
Further options and actions are documented inside
/usr/local/etc/rc.d/dnsmasq
For macOS:
brew install dnsmasq
Step 3: Configure and start dnsmasq service
Navigate to the location of dnsmasq configuration file. Open the file with either vi, vim, nano or any other editor that you have.
Linux (Debian/Ubuntu):
sudo nano /etc/dnsmasq.conf
MacOS and FreeBSD:
sudo nano /usr/local/etc/dnsmasq.conf
Add the following line at the end of the configuration file, save and exit the editor.
#Linux users
conf-file=/home/myuser/.maza/dnsmasq.conf
#MacOS users only
conf-file=/Users/myuser/.maza/dnsmasq.conf
Start DNSMASQ
Starting Dnsmasq service on Linux.
sudo systemctl stop dnsmasq
sudo systemctl start dnsmasq
sudo systemctl enable dnsmasq
Starting Dnsmasq service on macOS:
sudo brew service stop dnsmasq
sudo brew service start dnsmasq
Starting Dnsmasq service on FreeBSD:
sudo service dnsmasq stop
sudo service dnsmasq start
If the command returns an error to enable dnsmasq, edit /etc/rc.conf
file by adding a line marked in green colour.
$ sudo nano /etc/rc.conf
hostname="freebsd"
ifconfig_xn0="DHCP"
sshd_enable="YES"
dnsmasq_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"dnsmasq_enable="YES"
Now run the start command.
Step 4: Configure Desktop Machine
Now instruct your OS to use your DNS server. Go to Settings > Network if you are using Gnome Desktop. Click on your connection.

Edit on IPv4, under DNS, disable automatic then enter your local DNS and any other. One here is open DNS for google.

Conclusion
We have successfully installed maza on Debian/Ubuntu, FreeBSD and macOS as per this article. I believe you are now in a position to handle adverts using maza, local AdBlocker. Furthermore, we have also configure dnsmasq to used as local DNS server for maza since maza is compatible with dnsmasq format. Thank you so much for your support and feel free to leave a comment.
Also read on: