November 25, 2024
Tutorials

How to Install Nmap on Ubuntu 22.04

How to Install Nmap on Ubuntu 22

A Network Mapper known as Nmap is an open-source network security scanner that has flexible and robust capabilities and serves as a necessary tool for security professionals, and network administrators. It helps a lot of users while testing network security controls, detecting security risks, finding which device is executing on their networks, and discovering open ports.

In this tutorial, you will learn how to install Nmap on Ubuntu 22.04 LTS.

Method 1: How to Install Nmap on Ubuntu 22.04 With APT Package Manager?

Advanced Package Tool or APT is an official package manager that is utilized for handling the configurations, and installation of software packages, as well as removing them on Ubuntu, and other Debian-based Linux distributions.

To install Nmap via the APT package manager, first, need to update the Ubuntu package list by executing the following command:

sudo apt update

Now, run the following command to install the Nmap on Ubuntu 22.04:

sudo apt install nmap

After completing the installation process, use the below-provided command to show the Nmap version and verify its successful installation:

nmap --version

According to the given output, the version installed on Ubuntu is 7.80:

Method 2: How to Install Nmap on Ubuntu 22.04 With Source Code?

Another way to install the Nmap on Ubuntu is by utilizing the source code file. It is useful when the users require the latest unreleased version or the provided version is not fulfilling their specific needs or customizing the build. To install packages on your Ubuntu through this method, first, you need to build packages from the source code.

Now, move forward and check out the procedure for installing the Nmap on Ubuntu 22.04.

Initially, execute the following command to prepare the system by installing the required packages before installing Nmap:

sudo apt install build-essential libssh2-1-dev libssl-dev python3-distutils

After doing so, run the “wget” command to download the source code file of Nmap source code along with the link to the official Nmap download page:

wget https://nmap.org/dist/nmap-7.94.tar.bz2

Note: At the time of this tutorial, the latest stable version of Nmap is “7.94”. You can check its most recent version from its official download page.

Extract the Downloaded Source Code

Then, execute the given command to choose the latest tarball file and extract the source code in the terminal. After that, redirect to the extracted directory by typing the “cd” command:

tar xf nmap-7.94.tar.bz2 

cd nmap-7.94/

Next, use the provided command to build the configuration process and prepare the source code for compilation on the system:

sudo ./configure

Now, run the “make” command to compile the source code with the build configured. This command will read the “Makefile”:

sudo make

Finally, install the “Nmap” after comping the source code by executing the below-stated command:

sudo make install

The below output indicates that the “Nmap” has been installed successfully:

Method 3: How to Install Nmap on Ubuntu 22.04 Using “snap” Command?

Nmap can also be installed from “snap” which is a universal software packaging repository. It is known as an advanced package distribution because it has easy-to-install applications package support.

Let’s move toward the below procedure and see how to install Nmap on Ubuntu 22.04 from the snap repository.

Snapd is by default included in Ubuntu during its installation. In case, if not then you can execute the provided command to install it on your system:

sudo apt install snapd

Next, type the below-demonstrated command to install the Namp:

sudo snap install nmap

As you can see, the “nmap 7.94” version has been installed successfully:

How to Uninstall Nmap from Ubuntu 22.04?

Sometimes, users want to remove/uninstall the Nmap from their system for multiple reasons, such as they do not need any more or others. For that purpose, they should know its installation method. In our case, we will provide the three ways to uninstall the Namp.

Let’s move forward and check them out!

If you have installed the Nmap with our first method, then run the given command. It will remove the Namp with its all configurations and dependent packages:

sudo apt purge nmap

If have installed the Nmap via the source code file and now you are required to remove it from the local build, then first, navigate to its particular directory where it is installed. After that type the “make uninstall” command:

cd nmap-7.94/ 
sudo make uninstall

If you have installed the Namp through the Snap software package repository, then the given command:

sudo snap remove --purge nmap

That’s it! You have learned the different ways of installing the Nmap on Ubuntu 22.04.

Conclusion

Nmap is a versatile network security tool that is utilized for performing network-related tasks. It can be installed via the APT official package list, source code, and Snap software repository. Moreover, the Snap store offers the newest version. This tutorial described various methods for installing the Nmap on Ubuntu 22.04.

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video