1. Home
  2. Linux
  3. Install nmap on linux

How to install Nmap on Linux

Nmap (AKA Network Mapper) is a command-line network scanning utility for Linux, BSD, and other operating systems. When run, users can use it to analyze devices on a network and generate a map of what it discovers, scan individual machines, and much more. Here’s how to install install Nmap on Linux.

Note: Need a network mapping tool but not interested in using a command-line utility? Check out Zenmap. It’s a GUI front-end for Nmap on Linux.

Ubuntu instructions

On Ubuntu Linux, the Nmap application is available for installation in the “Ubuntu Main” software repository. You won’t need to jump through any hoops to activate this repo, unlike the “Universe” one. To get access to this application, launch a terminal window using the Ctrl + Alt +T or Ctrl + Shift + T keyboard combination and use the Apt package manager to load it up.

sudo apt install nmap

Debian instructions

Debian users who need access to the Nmap application are in luck, as the Nmap tool is right in the “Debian Main” software repository. Though, keep in mind that with most (if not all) software on the Debian operating system, it’s likely to be out of date. If this doesn’t bother you, launch a terminal window using Ctrl + Alt +T or Ctrl + Shift + T and get Nmap installed using the Apt-get package manager.

sudo apt-get install nmap

Alternatively, if you need the latest features that the Nmap tool has to offer, it may be a good idea to learn about how to activate Debian Backports. It provides more up-to-date software on older releases of the operating system. Or, follow the Snap package instructions later on in this post, if Backports doesn’t work for you.

Arch Linux instructions

On Arch Linux, users can install the Nmap application as long as they have the “Extra” software repository set up. Since some Arch Linux users do not turn this software repository on, we’ll show you how to enable it. To start, launch a terminal window and open up your /etc/pacman.conf file in the Nano text editor.

sudo nano -w /etc/pacman.conf

Scroll through the Pacman.conf file and look for the “Extra” software repository information. Then, delete all instances of the # symbol from in front of it, as well as other occurrences directly below it.

After you’re done editing the /etc/pacman.conf file, save with Ctrl + O, exit with Ctrl + X, and re-sync the Pacman package manager using the command below.

sudo pacman -Syy

Assuming the “Extra” software repository sets up during the Pacman sync process, it’ll be safe to install the Nmap app with:

sudo pacman -S nmap

Fedora instructions

The Nmap tool is available to Fedora Linux through both the “Fedora i386” and “Fedora x86_64” software repositories. To install the latest release of Nmap on your Fedora Linux PC, start by launching a terminal window (Ctrl + Alt +T or Ctrl + Shift + T). Once the command-line window is ready, use the Dnf package manager command below.

sudo dnf install nmap

OpenSUSE instructions

All OpenSUSE Linux distributions provide the Nmap application via the “OSS All” software repository, one of the primary software sources turned on by default. If you’re using Leap 15.0, Leap 42.3 or Tumbleweed, installation is quite straight-forward. To start, open up a terminal session by pressing Ctrl + Alt +T or Ctrl + Shift + T. After that, use the Zypper package manager to load up the software.

Note: keep in mind that some releases of OpenSUSE Linux (Leap) tend to offer users older software, rather than the latest and greatest. Generally, this is a good thing, as it means the software is stable. However, if you want the latest Nmap features, you may be disappointed. To get around this, consider following the Snap package instructions later on in this guide.

zypper install nmap

Snap package instructions

Amazingly, the Nmap network tool has made its way to the Snap package store, allowing anyone running the Snapd runtime to get quick access to this tool. To install this app via Snap on your system, use the snap install command below.

Note: installing Snap packages on Linux requires the Snapd runtime. For information on how to get this runtime set up on your Linux distribution, check out our guide here.

sudo snap install nmap

Source code instructions

Need to get your hands on the Nmap utility but can’t run Snap packages or install it traditionally on your Linux operating system? If so, you’ll be happy to know the source code is up online, and easy to compile.

To compile Nmap, launch a terminal window and follow the step-by-step instructions below.

Step 1: Read the Nmap website, learn the packages you’ll need to install to build the software and get them working on your Linux PC.

Step 2: Use wget to download the source code.

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

Step 3: Extract the code.

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

Step 4: Compile the program using configure and make.

./configure
make

Step 5: Install Nmap on Linux.

sudo make install

Comments are closed.