How to install nmap on Ubuntu

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install nmap on Ubuntu.

Nmap is a free and open source tool that you can use to perform different network related tasks.

You can use nmap to audit your server. You may have open ports that you are not aware of on your server, and you can find out easily with nmap what ports are open and what services are using them.

Nmap can also be used to know more details about the system, such as OS name and OS version, as well as ping sweeps.

Step 1 - Update packages

Before installing nmap, to ensure that your system is not running old and outdated packages, you need to update your system.

Ubuntu can be easily updated, using GUI or terminal via the command below

sudo apt-get update

Once you check for updates, your system will notify you if there are packages that needs to be upgraded.

To upgrade those packages, simply use the upgrade command

sudo apt-get upgrade

Once all packages updated and upgraded, proceed to the next step, to install nmap.

Step 2 - Install nmap on Ubuntu

nmap is available on official repositories of Ubuntu, and you can easily install nmap from your terminal, without having to add a repository or PPA on your system.

To install nmap, simply run the command below

sudo apt-get install nmap -y

Step 3 - Verify nmap installation

Once you have installed nmap on your system, to make sure that nmap installation had no issues during, check nmap version using the command below.

Checking version is an easy way of checking if nmap package can be executed

nmap --version

And you should get a similar output on your terminal, this means that nmap installation process had no issues, and that you can use nmap now.


In this tutorial, you learned how to install and uninstall nmap on Ubuntu. We created this tutorial for Ubuntu systems. However, the package nmap is the same for all linux distros, and you should be able to install nmap on all Ubuntu based distros by following our tutorial.

I hope this tutorial, helped you installing nmap on your machine.