How to Install Nmap on Fedora 40 or 39

Nmap, short for Network Mapper, is a powerful and versatile tool used by network administrators, security professionals, and enthusiasts to discover networks, perform security scans, and audit network security. Its ability to adapt to different network environments and tasks makes it an essential utility in the cybersecurity toolkit. Nmap’s robust feature set includes:

  • Port Scanning: Identifies open ports on network devices, determining potential access points for security assessments.
  • Network Inventory: Catalogs devices on a network, including operating systems, software, and services.
  • Service Detection: Determines what services are running on open ports, providing insights into network functionality.
  • OS Detection: Employs advanced techniques to deduce the devices’ operating systems on a network.
  • Scriptable Interactions: The Nmap Scripting Engine (NSE) is used for more sophisticated network exploration and security auditing.
  • Network Mapping: Visualizes network topologies, helping in understanding the structure and spread of networks.
  • Vulnerability Detection: Integrates with vulnerability databases to identify potential security weaknesses in network devices.
  • Flexibility and Extensibility: Supports various customization options for tailored network analysis.

With these capabilities, Nmap is a critical tool for maintaining network security and integrity. Now, let’s explore the technical steps to install Nmap on Fedora 40 or 39 Linux, ensuring you have the necessary knowledge and tools to effectively use this powerful network scanner.

Method 1: Install Nmap via DNF

Update Fedora Before Nmap Installation

First, update your system to ensure all existing packages are up to date.

sudo dnf upgrade --refresh

Install Nmap via DNF Command

By default, NMAP is available on Fedora’s repository. Given Fedora is a 6-month release focusing on the latest upstream releases, this version is the most up-to-date, making the installation easy and without importing any third-party repositories.

Begin with the installation and execute the following command:

sudo dnf install nmap

Next, verify the installation by checking the version and build:

nmap --version

Install Nmap on Fedora via Source

There could be instances where the need for the latest version of Nmap arises, or the version provided in Fedora’s repositories may not cater to specific requirements. Compiling Nmap from source is a viable solution, ensuring you have access to the most recent features and updates. Although this method entails additional steps and necessitates a routine check for updates followed by re-compilation, it can be advantageous for advanced users or those with distinct needs.

Install Initial Required Packages for Nmap

Before diving into source code compilation, preparing our system with the appropriate tools is paramount. The essential tools for building Fedora packages include the gcc compiler and the ‘make’ utility.

To install these, open your terminal and execute the following command:

sudo dnf install make automake gcc gcc-c++

Further, install the development tools and other requisite packages for building Nmap:

sudo dnf groupinstall "Development Tools"
sudo dnf install libssh2-devel openssl-devel python3-devel

Download Nmap Source Archive

After setting up the essential tools, obtain the Nmap source code. Fetch the source code from the official Nmap download page, targeting the latest stable release, using the wget command.

Note: It’s pivotal to check the download page for the latest version number and link, as these details may have changed since this guide was created.

To download the Nmap source code, use the following command:


Extract the Nmap Source Code

Upon successfully downloading the Nmap source code, extracting the files from the archive takes time. Execute the commands below to achieve this:

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

Configure Nmap Build

Now, it’s time to initiate the configuration process. This step readies the Nmap source code for compilation on your specific system, ensuring compatibility and optimized performance.

To orchestrate the build, run the command below:


If there’s a preference for installation with local directories, utilize the following command:

./configure --with-localdirs

Compile Nmap

With the build duly configured, the subsequent step is compiling the source code. This process is orchestrated using the make command, which reads the Makefile in the Nmap source directory and compiles the source code accordingly:


Install Nmap Binary

To install Nmap, execute the command below:

sudo make install

Verifying Nmap Installation

Post-installation, it’s imperative to verify the correct installation of Nmap from the source and ensure it’s the latest version. Employ the command below to ascertain this:

nmap --version

This command shows the installed Nmap version, aligning with the version of the obtained source code. Thus, you have successfully compiled and installed the latest Nmap version from the source on your Fedora Linux system.


We’ve walked through the steps to install Nmap on Fedora 40 or 39 Linux using the DNF Package Manager or compiling the source binary. Remember, Nmap is more than just a tool; it’s your ally in understanding and securing your network. Dive in, experiment with its features, and make the most of its capabilities to keep your network in check.

Useful and Relevant Links

Here are some valuable links related to using Nmap:

  • Nmap Official Website: Visit the official Nmap website for information about the network scanning tool, its features, and download options.
  • Nmap Documentation: Access comprehensive documentation for detailed guides on installing, configuring, and using Nmap.
  • Nmap Reference Guide: Explore the Nmap reference guide for an in-depth manual on Nmap’s commands and options.
Joshua James
Follow me
Latest posts by Joshua James (see all)