How to Install Nmap from Ubuntu Terminal

Last updated: May 25, 2022

Nmap is a free, open-source scanner used to discover hosts and services on the network. It is commonly used to audit the network. It uses many scanning techniques to collect connected systems information.

In this guide, we learn how to install Nmap from the Ubuntu terminal.


  • A system running Ubuntu.
  • Previous knowledge of using a terminal.
  • A user account with sudo privileges.

Install Nmap on Ubuntu

You can install Nmap on Ubuntu in 3 ways: Using apt, snap, and from source.

Installing Nmap using apt package manager is the easiest method. To get a much newer version on nmap use snap or from source.

Install Nmap on Ubuntu using Apt

To install Nmap using apt do the following steps:

Step 1: Update apt package index

sudo apt update

Step 2: Install Nmap package

sudo apt install nmap

Step 3: Verify by checking the Nmap version

nmap --version
Nmap version 7.80 ( )
Platform: x86_64-pc-linux-gnu
Compiled with: liblua-5.3.6 openssl-3.0.0 nmap-libssh2-1.8.2 
libz-1.2.11 libpcre -8.39 libpcap-1.10.1 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select

On my Ubuntu 22.04 it has installed nmap version 7.80.

The above method is compatible with Linux distributions such as Mint, Pop!_OS, and Debian.

Install Nmap on Ubuntu using snap

If you prefer the newer version of Nmap, you can choose to install nmap using snap.

To install any snap packages, your system should have snapd installed. Now Ubuntu 22.04 already comes preinstalled with snaps. In case not found you can install snapd on Ubuntu using the following command:

sudo apt install snapd

Now, Install Nmap using snap command:

sudo snap install nmap

Nmap version 7.92 is installed which is a much newer version than the apt repositories have.

/snap/bin/nmap --version
Nmap version 7.92 ( )

Install Nmap from Source

Installing from source means we are not using any package manager. You get more control over the software and can download the latest version to compile.

First Install essential packages to build

sudo apt install build-essential

Download Nmap source code:


Extract .tar.bz2 file and change directory:

tar xf nmap-7.92.tar.bz2
cd nmap-7.92/

The following commands configure, compile and install nmap:

sudo ./configure
sudo make
sudo make altinstall

In the last command, I have used altinstall instead of install because later will overwrite the default Nmap binary.


In this guide, we learned how to install Nmap on Ubuntu Linux.

Three ways to install Nmap are :

  • using apt
  • using snap
  • from source

Thanks for reading, please leave your suggestions and feedback in the below comment section.



Please add comments below to provide the author your ideas, appreciation and feedback.

Comments Off on How to Articles