LinuxTutorialsUbuntu

How To Install Nmap on Ubuntu 20.04 LTS

Install Nmap on Ubuntu 20.04

In this tutorial, we will show you how to install Nmap on Ubuntu 20.04 LTS. For those of you who didn’t know, Nmap, short for Network Mapper, is a powerful open-source tool used for network discovery, security auditing, and vulnerability scanning. It is an essential utility for network administrators, security professionals, and enthusiasts alike. Nmap allows users to scan networks, identify open ports, determine operating systems, and uncover potential security risks.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Nmap security scanner on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 20.04, 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Nmap on Ubuntu 20.04 LTS Focal Fossa

Step 1. Before installing any new software, it’s always a good practice to update the package manager to ensure you have access to the latest versions of packages. Run the following command:

sudo apt update
sudo apt upgrade

This command will refresh the package lists from the repositories, ensuring you have the most up-to-date information.

Step 2. Installing Nmap on Ubuntu 20.04.

Nmap is available from the default Ubuntu and Debian repositories. Just follow the steps one by one:

sudo apt install nmap

Once the installation is complete, you can verify that Nmap is properly installed by checking its version. Run the following command:

nmap –version

Step 3. Using Nmap.

The article covers the basic options this tool has to offer. For a full list of options visit the Nmap official page or access the manual from your command line:

man nmap

Scan IP range or subnet:

To obtain general information about a remote system type:

sudo nmap target-IP-address or domain.com

Instead of scanning individual IPs, scan a whole IP range by defining it in your command line:

sudo nmap 192.168.77.2-222

The following command scans the entire specified subnet:

sudo nmap 192.158.77.0/24

Port Scanning with Nmap

Nmap is an efficient port scanner that recognizes six port states:

  • open – actively accepting TCP connections, UDP datagrams, or SCTP associations
  • closed – accessible; however, no application is listening on the port
  • filtered – Nmap cannot determine whether the port is open due to packet filtering
  • unfiltered – the port is accessible; however, Nmap is unable to determine if it is open or closed
  • open|filtered – Nmap cannot determine if a port is open or filtered
  • closed|filtered – Nmap cannot establish if a port is closed or filtered

Port Specification and Scan Order

By default, Nmap scans the thousand most common ports for each protocol. It also offers options for specifying which ports are to be scanned and whether the scan is random or ordered.

The -p option allows you to specify port ranges and sequences:

sudo nmap –p 80,443 192.168.77.222

This command scans ports 80 and 443 for the defined host.

TCP SYN scan

Initiate TCP SYN for a fast and unobtrusive scan. Since this type of scan never completes TCP connections, it is often referred to as half-open scanning. To run a TCP SYN scan, use the command:
sudo nmap -sS 192.168.77.222

Congratulations! You have successfully installed Nmap. Thanks for using this tutorial for installing the Nmap security scanner on your Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Nmap website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button