Nmap Section 8 of 13

Installation

Nmap runs on all major operating systems. This guide covers installation on Linux distributions, macOS, Windows, Docker, and building from source.

Linux (Debian/Ubuntu/Kali)

Using apt (Recommended)

The standard package manager on Debian-based systems. Kali Linux includes Nmap by default.

bash
1sudo apt update && sudo apt install nmap

Verify Installation

Check that Nmap is installed correctly and view its version.

bash
1nmap --version

Update Nmap

Keep Nmap up to date for the latest scripts and features.

bash
1sudo apt update && sudo apt upgrade nmap

Linux (RHEL/CentOS/Fedora)

Using dnf/yum

Fedora and newer RHEL/CentOS versions use dnf. Older CentOS versions use yum.

bash
1sudo dnf install nmap

Using yum (Legacy)

For older CentOS and RHEL systems that do not have dnf.

bash
1sudo yum install nmap

macOS

Using Homebrew (Recommended)

Homebrew is the most popular package manager for macOS. If you do not have it, install from brew.sh first.

bash
1brew install nmap

Using MacPorts

Alternative package manager for macOS.

bash
1sudo port install nmap

Install Nmap + Zenmap GUI

Zenmap is the official Nmap GUI. It requires XQuartz on macOS.

bash
1brew install --cask nmap

Windows

Download Installer

Download the official Windows installer from nmap.org. The installer includes Nmap, Ncat, Ndiff, and Zenmap.

bash
1# Download from: https://nmap.org/download.html

Using Chocolatey

If you have Chocolatey package manager installed, you can install Nmap via command line.

bash
1choco install nmap

Using winget

Windows Package Manager (winget) is built into Windows 10/11.

bash
1winget install Insecure.Nmap

Docker

Official Nmap Docker Image

Run Nmap in a container without installing it on your host system.

bash
1docker run --rm networkscanner/nmap -A scanme.nmap.org

Kali Linux Container

Run Nmap from the official Kali Linux Docker image with all tools pre-installed.

bash
1docker run --rm -it kalilinux/kali-rolling nmap -A scanme.nmap.org

Build from Source

Building from source gives you the latest features, custom compile options, and the ability to modify Nmap's behavior. This is recommended for developers and users who need cutting-edge features.

1. Install Dependencies

You need a C compiler, make, and the OpenSSL development libraries.

bash
1sudo apt install build-essential libssl-dev

2. Download Source

Get the latest stable source tarball from nmap.org.

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

3. Extract

Extract the archive and enter the source directory.

bash
1tar -xjf nmap-7.94.tar.bz2 && cd nmap-7.94

4. Configure

Run the configure script to check your system and set build options.

bash
1./configure

5. Compile

Compile the source code. This may take several minutes.

bash
1make

6. Install

Install Nmap system-wide to /usr/local/bin and related directories.

bash
1sudo make install

Info

After building from source, run nmap --version to confirm the installation. The output should show the version you compiled.

Verification & First Scan

After installation, verify Nmap works by running a simple scan against scanme.nmap.org — a test server maintained by the Nmap project specifically for this purpose.

bash
1nmap scanme.nmap.org

You should see output showing open ports, services, and possibly OS detection results. If this works, your Nmap installation is complete and functional.