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.
Method 1: Using APT (Advanced Package Tool) - Recommended
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
OutputNmap version 7.80 ( https://nmap.org ) 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.
Method 2: Using Snap (Optional)
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.
Output
/snap/bin/nmap --version
Nmap version 7.92 ( https://nmap.org )
Method 3: From Source (Optional)
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:
wget https://nmap.org/dist/nmap-7.92.tar.bz2
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.
Now you can start - Using Nmap to Scan Open Ports [with Examples]
Comments