How to Install Nmap on Debian 12, 11 or 10

Nmap, renowned for its network scanning capabilities, is an indispensable tool for security enthusiasts and professionals. For those aiming to install Nmap on Debian 12 Bookworm or the older stable releases of Debian 11 Bullseye or Debian 10 Buster, it’s essential to grasp its multifaceted features and advantages to network analysis and security.

Core Attributes of Nmap on Debian:

  • Versatile Scanning: Nmap is adept at scanning both IPv4 and IPv6 networks, offering a range of techniques from ping scans and port scans to advanced OS and service version detections.
  • Purpose-Driven: Whether it’s for network exploration, security assessments, vulnerability identification, or penetration testing, Nmap is tailored to meet diverse security and analysis needs.
  • Scripting Engine: Nmap’s built-in scripting engine empowers users to craft custom scripts, enabling automation of intricate scanning tasks and fostering dynamic interactions with target systems.
  • Comprehensive Reporting: With Nmap, users can generate detailed reports in formats like XML, HTML, and grepable text, facilitating in-depth analysis and streamlined data processing.
  • Command-Line Mastery: Nmap’s robust command-line interface ensures that users have the flexibility to fine-tune their scans, optimizing the tool’s performance and output.

In essence, Nmap stands as a beacon in network security and analysis. Its robust features and adaptability to Debian distributions make it a go-to choice for those keen on maintaining network integrity and security.

The main article has two sections on how to install Nmap from Debian’s default APT repository or download and install the source version for the latest version.

Install Nmap on Debian 12, 11, or 10 via APT

Step 1: Update Debian Linux Before Nmap Installation

Before proceeding with the installation process, ensuring that your system packages are up-to-date is essential. This can be achieved by executing the following command in the terminal:

sudo apt update && sudo apt upgrade

By doing so, you can avoid any conflicts during the installation or operation of Nmap.

Step 2: Install Nmap via APT Command on Debian Linux

Once you have ensured that your system packages are up-to-date, you can proceed with the installation process of Nmap. Fortunately, Nmap is available in Debian’s default repository, making the installation process straightforward. You can install Nmap by executing the following command in the terminal:

sudo apt install nmap

This will install Nmap on your Debian system.

Step 3: Verify Nmap Installation on Debian Linux

After the installation, verifying that Nmap is installed correctly is essential. To do so, execute the following command in the terminal:

nmap --version

This command will display the version number and additional information about the installed version of Nmap. If Nmap is installed correctly, you will see the version number and details about the installation.

Install Nmap on Debian 12, 11, or 10 via source

For specific scenarios, users may need the most recent version of Nmap, or the version available in Debian’s repositories might not be adequate. Compiling Nmap from its source code offers a way to address these needs, ensuring access to the latest features and updates. While this approach requires more steps and regular re-compilation for updates, it can be advantageous for advanced users or those with specific requirements.

Step 1: Install Initial Required Packages for Nmap on Debian

Before diving into source code, we must equip our system with the necessary tools. The build-essential package encompasses a set of packages vital for compiling Debian software. This includes tools like the gcc compiler and make. By installing this package, we set the foundation to compile and construct Nmap from its source. To proceed, open your terminal and input:

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

Step 2: Download Nmap Source Archive on Debian

Our next move is to fetch the Nmap source code. The official Nmap download page is the trusted source for this. We’ll employ the wget command to download the current stable release for this guide. It’s worth noting that the version might change over time. As of this guide, the latest stable release is 7.94. However, always refer to the download page for the most recent version and adjust your command accordingly.

To fetch the Nmap source code, execute:


Visit the download page to get the latest version! This command is just an example and will soon be outdated.

Step 3: Extract Nmap Source Archive on Debian

With the Nmap source code in hand, our next task is to unarchive the files. To achieve this, run:

bzip2 -cd nmap-7.94.tar.bz2 | tar xvf -
cd nmap-7.94

Step 4: Proceed with Nmap Build Configuration

We’re now at a stage where we can initiate the configuration process. This step tailors the Nmap source code for your specific Debian system, ensuring both compatibility and peak performance. To set up the build configuration, input:

./configure --with-localdirs
Screenshot showcasing compile configuration steps for Nmap on Debian.Pin
Capture of the configuration phase required before compiling Nmap on Debian.

Step 5: Compile Nmap Source on Debian via make

With our build ready, it’s time to compile the source code. The make command facilitates this, interpreting the Makefile in the Nmap source directory to compile the source code:

Screenshot of the completed make build process for Nmap on Debian.Pin
Snapshot of the successful culmination of the Nmap ‘make build’ process on Debian.

Step 6: Install Nmap on Debian via make install Command

Having compiled the source code, we’re now poised to install Nmap. This phase situates the compiled software in the relevant directories of your system. To finalize the Nmap installation, run:

make install

If the command fails to install, you may need to run “sudo” infront of “make install”.

Step 7: Confirming the Nmap source Installation

Post-installation, verifying that Nmap has been accurately installed from the source and reflects the latest version is paramount. To authenticate this, execute:

nmap --version

This command will reveal the installed Nmap version, which should align with the source code version you procured. Congratulations, you’ve adeptly compiled and installed the most recent version of Nmap from source on your Debian system.

Screenshot displaying Nmap version details post manual installation on Debian.Pin
Inspect the version details of Nmap following a manual installation from a compiled build on Debian.

Basics of Nmap Commands on Debian 12, 11 or 10

To become familiar with Nmap, it is important to have a basic understanding of its commands. These commands are essential to utilize the full functionality of Nmap.

Nmap Port States Definitions

When scanning for open ports on a target system, Nmap reports the state of each port it probes. The following table outlines the different port states that Nmap may report:

Port StateDescription
OpenThe target port is accepting connections and actively responding to probes. This state indicates that a service or application listens on the port and is ready to accept incoming connections.
ClosedThe target port is closed, which is reachable but not accepting connections. This state suggests that a firewall or other security mechanism blocks incoming traffic to the port.
FilteredThe target port is filtered, meaning that Nmap could not determine the state of the port due to firewall rules or other security mechanisms that prevented the probes from reaching the target.
UnfilteredThe target port is unfiltered, meaning that Nmap was able to determine whether the port is open or closed. This state is often reported when the target system is behind a load balancer or a packet filtering device.

Nmap Basic Commands

While the following sections provide an overview of some basic Nmap commands, it is recommended to refer to a comprehensive guide, such as “Nmap Commands for Beginners: Simple Scanning Tips,” for a more detailed list of commands and tips.

Scan Host:

To scan a host, whether internal or external, you can use the following command:

nmap [IP address] or [website address]

Alternatively, you can scan internally using the following command:

nmap localhost

To perform a scan quickly, you can use the -F flag:

nmap -F [IP address] or [website address]

When scanning, if you want to scan specific hosts, you can specify.

nmap [IP address],[IP address],[IP address]

If you want to scan specific hosts, you can specify them using the following command:

nmap [IP address],[IP address],[IP address]

Operating System Scan:

To initiate an operating system scan, you can use the following command:

nmap -O --osscan-guess [IP address] or [website address]

Port Specification and Scan Order:

To initiate a custom port scan, you can use the -p flag followed by the ports you wish to scan:

nmap –p 80,443,8080,9090 [IP address] or [website address]

Services Scan:

To initiate a services scan, you can use the following command:

nmap -sV [IP address] or [website address]


To initiate a TCP SYN scan, you can use the following command:

nmap -sS [IP address] or [website address]

Nmap Help:

Overall, Nmap has many features and combinations. To learn more about these, you can use the following command to bring up the list of commands and optional flags that can be used with your scans:

nmap --help

By utilizing these basic Nmap commands, you can perform effective network scans, identify vulnerabilities, and enhance the security of your system.

Section 3: Additional Tips on Nmap with Debian Linux

How to Remove (Uninstall) Nmap

Removing the Packaged Version of Nmap

If you installed Nmap using the package manager (apt), you can uninstall it with the following command:

sudo apt remove nmap

This command will remove Nmap and any associated configuration files. If you also want to remove the dependencies that were installed with Nmap and are no longer used by any other programs, you can use:

sudo apt autoremove

Removing the Compiled Version of Nmap

The removal process is slightly different if you’ve compiled Nmap from source and installed it. Typically, if you used make install to install Nmap, you can navigate to the source directory and use make uninstall to remove it. However, not all Makefiles include an uninstall target.

Navigate to the Nmap source directory:

cd /path/to/nmap/source/directory

Then run the following command:

sudo make uninstall

You should see something similar below:

running uninstall
Removing '/usr/local/lib/python3.11/dist-packages/'.
Removing '/usr/local/lib/python3.11/dist-packages/__pycache__/ndiff.cpython-311.pyc'.
Removing '/usr/local/bin/ndiff'.
Removing '/usr/local/share/man/man1/ndiff.1'.
Removing '/usr/local/bin/uninstall_ndiff'.
make[1]: Entering directory '/home/joshua/nmap-7.94/nping'
rm -f /usr/local/bin/nping
rm -f /usr/local/share/man/man1/nping.1
make[1]: Leaving directory '/home/joshua/nmap-7.94/nping'

joshua@debian:~/nmap-7.94$ nmap --version
bash: /usr/local/bin/nmap: No such file or directory


In conclusion, installing Nmap on a Debian system is a straightforward process that can significantly benefit security professionals, system administrators, and network engineers. Following the basic steps outlined in this guide, users can quickly and easily install Nmap on their Debian system, update system packages, and verify the installation. With Nmap, users can explore and audit networks, detect vulnerabilities, and map the network topology to enhance their system security.

Leave a Comment

Your Mastodon Instance
Share to...