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 Nmap (Network Mapper) is a powerful open-source tool used for network discovery and security auditing. It is widely utilized by network administrators and security professionals to map out networks, identify active devices, and detect open ports and services running on those devices. Nmap also supports advanced features such as OS detection, version detection, and scriptable interaction with the target, making it an essential tool for network security analysis.

On Fedora 40 or 39, Nmap can be installed using two primary methods via the command-line terminal. The first method is through Fedora AppStream, which provides a stable and straightforward installation directly from Fedora’s official repositories. This method is suitable for most users who require a reliable and easily maintainable version of Nmap. Alternatively, for those who need the very latest version or want to customize their installation, Nmap can be manually downloaded, compiled, and installed from the official source archive. This guide will walk you through both methods, ensuring you have Nmap set up to best suit your needs.

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:

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

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:

./configure

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:

make

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.

Conclusion

With Nmap installed on your Fedora system, whether via Fedora AppStream or by compiling the latest version from source, you gain a powerful tool for network security and management. The AppStream method offers ease of installation and maintenance, while manually compiling Nmap provides the flexibility to use the most recent features and updates. Regularly updating your Nmap installation, especially when compiling from source, will ensure you stay equipped with the latest tools and capabilities for network analysis on Fedora.

1 thought on “How to Install Nmap on Fedora 40 or 39”

  1. I’d just like to thank you for the documentation, and tutorials you have here on your website. Not to mention all the great art as thumbnails, and what not.

    😀

    Reply

Leave a Comment