How to Install and Uninstall dnsmasq Ubuntu 22.04

Updated: September 18, 2022

Dnsmasq is a lightweight, easy to configure, DNS forwarder and DHCP server. It is designed to provide DNS and optionally, DHCP, to a small network. It can serve the names of local machines which are not in the global DNS. The DHCP server integrates with the DNS server and allows machines with DHCP-allocated addresses to appear in the DNS with names configured either in each host or in a central configuration file. Dnsmasq supports static and dynamic DHCP leases and BOOTP/TFTP for network booting of diskless machines. In this tutorial, I will show you ways to install dnsmasq Ubuntu 22.04.

Software Requirement

  • Operating system: Ubuntu 22.04 is needed for dnsmasq to work
  • Privileges: Make sure that you can run the sudo commands line.

Prerequisites to install dnsmasq on Ubuntu 22.04

Install dnsmasq Ubuntu 22.04

dnsmasq is one of the popular ways on Ubuntu now so that this tutorial will show you how to install it in various ways. Choose the one that you think is easy and you can follow.

Install dnsmasq using APT

This is a popular method for installing any Ubuntu packages because it’s easy to follow, even if you are a newbie in Linux. Following these instructions to install dnsmasq on your Ubuntu.

Step 1: You must update the APT package repository cache before attempting to install, update, or remove any packages. Obtain new packages from Ubuntu by updating the APT database. Launch the terminal and enter the following Linux command:

sudo apt-get -y update

Step 2: Start installing the packages on Ubuntu 22.04. After updating the system, you can install dnsmasq Ubuntu by executing this command in the terminal.

sudo apt install dnsmasq

Install dnsmasq using Aptitude

Aptitude allows users to view a list of available packages and manage package installation, upgrade, and removal. If you haven’t already installed it on Ubuntu, run this command to do so.

sudo apt -y install aptitude

After that, you can now install dnsmasq by following these steps:

Step 1: You must update the APT package repository cache before attempting to install, update, or remove any packages. Update the APT database to download new packages from Ubuntu. Launching the terminal and entering the following Linux command:

sudo apt-get -y update

Step 2: Start installing the packages on Ubuntu 22.04. You can now install dnsmasq Ubuntu by executing this command in the terminal.

sudo aptitude -y install dnsmasq

Uninstall dnsmasq on Ubuntu 22.04

Have you ever considered how difficult it is to uninstall an application from Ubuntu? You are mistaken; anyone, not just package administrators, can easily uninstall any program.

You can uninstall dnsmasq Ubuntu by running this command if you installed it using APT or Aptitude.

sudo apt remove --auto-remove dnsmasq

If you want to uninstall dnsmasq and remove its data and dependencies, you can also run the following command:

sudo apt autoremove --purge dnsmasq

Ending

In this guide, I showed you ways to install dnsmasq on Ubuntu 22.04 and ways to uninstall dnsmasq too. If you need any help, don’t hesitate to contact me. I’m very glad to answer them.