Install Nmap on Ubuntu in 3 Simple Steps

Try this guide with our instant dedicated server for as low as 40 Euros

How to Install Nmap on Ubuntu_ Network Scanner Setup

Network Mapper, more commonly known as Nmap, is a powerful tool for network discovery and security auditing in Linux operating systems.

Network administrators extensively utilize Nmap for a variety of critical tasks, including network inventory, scheduling service upgrades, network mapping, and scanning, as well as monitoring the uptime of hosts and services via terminal commands.

Before you can use Nmap to monitor and audit your network infrastructure, you need to set it up properly on your Ubuntu machine. The focus of the process is to streamline the installation of Nmap on Ubuntu, ensuring you have the necessary tools at your disposal for effective network management.

In this focused tutorial, we will present the three steps you need to follow to install Nmap on Ubuntu.

Table of Contents

  1. Install Nmap on Ubuntu
    1. The Prerequisite
    2. Step #1: Update the Ubuntu Package Index
    3. Step #2: Install the Nmap Package
    4. Step #3: Check the Version Information
  2. Conclusion
  3. FAQ’s

Install Nmap on Ubuntu

Before we go into the details of installing Nmap on an Ubuntu machine, let’s see the prerequisites of the process.

The Prerequisite

First, make sure you have the following before you try the Nmap installation on your Ubuntu system:

  • A system running a stable Ubuntu version
  • A root user account or a user account with permission to execute commands as a superuser.

Step #1: Update the Ubuntu Package Index

Before installing any new software, it’s a good practice to update your Ubuntu package list to ensure you have the latest versions for sustained performance.

So, as the first step of the process, execute the following command:

# apt-get update

Step #1 Update the Ubuntu Package Index

This command fetches the list of available updates from the repositories as defined in your system’s sources.list file, ensuring the apt package manager knows about the latest versions of packages and their dependencies.

Step #2: Install the Nmap Package

With your package list updated, you’re ready to install Nmap.

Ubuntu’s repositories typically include Nmap, making it straightforward to install using apt which fetches the packages from the official Ubuntu package repository index.

For this, run the following command:

# apt install nmap

Step #2 Install the Nmap Package

During the installation process, this command will ask for your confirmation by displaying the amount of disk space the new installation will use. Confirm the installation, and apt will handle the rest by downloading and installing Nmap and any required dependencies.

Step #3: Check the Version Information

After installation, it’s a good idea to verify that Nmap has been correctly installed. A great way of checking this is to print the version information of the utility.

For this, run the following command in the terminal:

# nmap --version

Step #3 Check the Version Information

This output will display the version of Nmap installed, along with some additional information about the build. Confirming the version can also ensure compatibility with specific features or scripts you plan to use with Nmap.


Installing Nmap on your Ubuntu system begins a journey into in-depth network analysis and security evaluation. With Nmap, you can perform various network-related tasks, from simple network inventory checks to complex security audits. Remember, the power of Nmap extends far beyond mere installation; it lies in its versatile application across different network scenarios. By mastering its usage, you unlock a valuable network security and management skill set, reinforcing your network’s integrity against potential threats and vulnerabilities.

RedSwitches helps customers by offering customizable bare metal servers.

We provide competitive, dedicated server pricing and ensure swift delivery of instant dedicated servers, typically on the same day of order approval. Whether you require a dedicated server, a traffic-friendly 10Gbps dedicated server, or a high-performance bare metal server, we are your trusted hosting partner.


Q. Why must I update the Ubuntu package list before installing Nmap?

Updating the Ubuntu package list ensures that your system knows the latest versions of packages and their dependencies. Ensuring a seamless installation process for new software, mainly when you aim to install Nmap on Ubuntu, necessitates this preliminary step. It mitigates potential conflicts and guarantees compatibility, laying a solid foundation for the smooth integration of Nmap into your Ubuntu system.

Q. What is the recommended frequency for updating the package list on Ubuntu, especially before installing software like Nmap?

Updating the package list on your Ubuntu system is advisable before installing any new software, including Nmap, or executing system updates to ensure you have the latest software versions and dependencies. For general maintenance, doing so at least once a week can help keep your system secure and up-to-date.

Q. How can I install Nmap without sudo privileges?

Installing Nmap typically requires sudo privileges because it affects system-wide resources and directories. If you don’t have sudo privileges, you must seek assistance from your system administrator for the installation process.

Q. How should I proceed if I run into an issue while installing Nmap?

If you encounter an error during the installation, check your internet connection and ensure your package list is updated. If the problem persists, you can search for the error message online for specific solutions or ask for help on Ubuntu forums.

Q. How can I uninstall Nmap if I no longer need it?

If you need to uninstall Nmap, you can execute the command sudo apt remove nmap in your terminal. To also remove Nmap’s configuration and/or data files, use sudo apt purge nmap.

Q. Does Nmap offer a graphical user interface option on Ubuntu?

Yes, Nmap provides a graphical user interface known as Zenmap. However, it might not be included by default when you install Nmap via the command line. You can install Zenmap separately if you prefer a GUI for network scanning.

Q. How can I verify that Nmap has been updated to the latest version after installation?

To check if Nmap is up-to-date, first update your package list, then run the command nmap –version to see the current version. You can compare this with the latest version available on the Nmap website or repository.

Q. Can I use Nmap for scanning networks that I do not own or have permission to scan?

Scanning networks without permission is illegal and unethical. Always ensure you have explicit consent to scan a network, as unauthorized scanning can lead to legal consequences and is considered malicious behavior.

Q. How do I fix the ‘E: Unable to locate package nmap’ error when trying to install Nmap?

If you see this error, it could mean that your package list is outdated or that the Nmap package is not available in your current Ubuntu repositories. Make sure you’ve run sudo apt update before attempting to install Nmap again. If the issue persists, check your internet connection and repository settings.

Q. How can I learn to use Nmap effectively after installing it?

Nmap has comprehensive documentation and a community-driven wiki available online. Starting with basic commands and exploring the Nmap Scripting Engine (NSE) can be an excellent way to become proficient. Practice in a controlled environment, like your network, and consider taking online courses or tutorials dedicated to Nmap.

Try this guide with our instant dedicated server for as low as 40 Euros