How to Install Nmap on Ubuntu? (Step by Step Process)
Introduction
Before diving into the installation of Nmap, it is essential to have an understanding of what is Nmap and its capabilities.
Nmap stands for Network Mapper. It is a robust open-source tool for inspecting, scanning, and managing networks. It is used by network administrators for network discovery and security scanning.
They use Nmap to identify hosts, Operating Systems, services, and vulnerabilities on your network. In simple words, it is used to scan hosts and services on a computer network, thus creating a “map” of the network.
Nmap is available for various operating systems, including Windows, Linux, and macOS. In this article, we will focus on how to install Nmap on Ubuntu.
Let’s examine the different scenarios where in which Nmap can be utilized:
-
Network mapping and inventory
-
Vulnerability Assessment
-
Security Auditing
-
Testing firewall rules
-
Discovering open ports on network systems
-
Automating tasks such as version detection and host discovery
Prerequisites for Nmap Installation on Ubuntu
Before getting into the tutorial on how to install Nmap in Ubuntu, let’s see the prerequisites.
1. Ubuntu Operating System
Nmap is compatible with Ubuntu and can be installed on any version of the operating system. For this tutorial, you should have a running Ubuntu 20.04 LTS Server.
2. Administrative privileges
Nmap requires administrative privileges to run any command, so you need to be logged in as a root user or use the “sudo” command.
3. Understanding of Command Line
The installation process of Nmap on Ubuntu happens on the command line. So it is important to have a basic understanding of how to run the commands and navigate through the command line.
4. Updated Package List
Before you proceed with the installation of Nmap on Ubuntu, It is important to have updated packages in your system. You need to have apt available in your system.
5. Internet Connection
In order to download the necessary packages, a strong internet connection is a must.
How to Install Nmap on Ubuntu?
Let’s walk you through the tutorial for installing Nmap for Ubuntu:
Step-1: Updating the system package list
Before installing Nmap in Ubuntu, make sure to update and upgrade your system packages with the latest available versions from Ubuntu.
To upgrade all the packages, open the terminal and run the following command:
sudo apt update && sudo apt upgrade
Step-2: Installing Nmap
In the next step, you can download and install Nmap and the respective dependencies from the Ubuntu repo. This can be performed by running the below command:
sudo apt install nmap
The installation process may take a few minutes to complete, so make sure to have a stable internet connection.
Step-3: Verifying the Installation
After the successful installation of Nmap, you can verify the installed files by writing the below command:
dpkg -L nmap
It will list down all the installed files and if something is missing you can check here.
Step-4: Check Version
To check the currently installed version of Nmap on your system, you can write:
nmap –-version
Step-5: Scan using Nmap
After the successful installation of Nmap on your system, you can use it to scan for hosts and services on your network. Below is the syntax for the command:
nmap <options><target_ip>
The command with an example:
nmap 192.168.1.0/24
This command is going to scan all the current online hosts with IP range 192.168.1.0 to 192.168.1.255. The resulting list will show the number of IP addresses and their corresponding hostnames, with the status of each host (up or down).
If you want to scan a specific host or IP address, then you can write this command (for example):
nmap 192.168.1.1
This will specifically show the host of this IP address and will also show an open SSH port 22.
Step-6: Scanning for open ports
Another important task that you can perform is to scan open ports on a host. The syntax of the command is:
sudo nmap -p <port-number><host-ip-address>
To scan for open ports on a specific host, write the below command:
sudo nmap -p 1-65535 192.168.1.1
The above command will scan all ports ranging from 1 to 65535 on host 192.168.1.1, and output a list of open ports and all services that are running on them.
Step-7: Check all available options
If you want to see all the tools available on Nmap, use the nmap -h command.
Wrapping Up:
These were the easy steps involved in installing Nmap on Ubuntu 20, a popular Linux distribution. By following the steps mentioned in the article, you can easily install Nmap on Ubuntu and start exploring and auditing your network. If you want to have a better understanding of your network infrastructure and want to improve network security then explore Nmap. Nmap can be used for both legitimate network administration and ethical hacking.