How to install NMAP on Ubuntu?
Nmap is a crucial tool for scanning networks and checking for security issues, helping you find possible weaknesses in your system. Installing Nmap on Ubuntu takes you a big step closer to having a safer network.
We’ve created an easy guide that shows you how to install Nmap using the package manager, Snap, and compile it from the source.
Table of Contents
What is Nmap?
Nmap is a trusted tool for ethical hackers and security testers when they need to scan a network. This free, open-source tool helps discover and audit network security by mapping out hosts and services, providing important details that can help identify potential security issues.
Installation of Nmap on Ubuntu Server
This guide will explore different ways to install Nmap on an Ubuntu server.
Method 1: Install Nmap Using the Package Manager
For a quick and simple way to install Nmap on your Ubuntu system, the apt package manager is your best bet. This method is easy and great for beginners or anyone who prefers a straightforward approach. You can install a stable version of Nmap with just a few commands.
Step 1: Log into your server through web ssh or ssh clients such as Bitwise or Putty.
Step 2:Â Then, update a package list by typing the following command in the terminal and pressing Enter:
# apt update
Step 3:Â Now, install Nmap by typing the following command and pressing Enter:
# apt install nmap
The terminal will display the installation progress, and once it’s complete, Nmap will be installed on your system.
Step 4:Â To check if Nmap is installed correctly, type:
# nmap -v
This will display the installed version of Nmap.
While this method is easy and commonly used, it might not always give you the latest version of Nmap.
You’ve successfully installed Nmap using the package manager. Now you can start using this powerful tool to secure your network.
Method 2: Compiling Nmap from Source
If you want the latest Nmap features that aren’t in the stable release yet, compiling it from source is the way to go. While this method might bring some instability, it gives you access to the newest updates. Here’s how to do it:
Step 1:Â Log into your server through web ssh or ssh clients such as Bitwise or Putty.
Step 2:Â To compile Nmap from source, you need some essential packages. Run the following command in the terminal:
# apt install build-essential libssl-dev
Step 3: Now, download the Nmap source code. Use the wget command to get it directly from the official Nmap website:
# wget https://nmap.org/dist/nmap-<version>.tar.bz2
Replace <version> with the latest version available (e.g., nmap-7.95).
Step 4:Â After the download, extract the file using this command:
# tar jxvf nmap-<version>.tar.bz2
Step 5:Â Move into the directory created after extraction:
# cd nmap-<version>
Step 6:Â Finally, compile and install Nmap with the following commands:
# ./configure && make && sudo make install
This method lets you install the latest version of Nmap, but keep in mind it may not be as stable as the version from the package manager.
You’ve successfully compiled and installed Nmap from its source code. While this method has a few extra steps, it gives you access to the newest features Nmap has to offer.
Method 3: Installing Nmap Using Snap
If you want an easy way to install Nmap without dealing with dependencies or updating your package list, Snap is a great option. Snap is a universal package manager that comes pre-installed on Ubuntu 16.04 and later. This method ensures you get the latest Nmap version without compiling or resolving dependencies. Here’s how to do it:
Step 1:Â Log into your server through web ssh or ssh clients such as Bitwise or Putty.
Step 2:Â Type the following command and press Enter to install Nmap.
# snap install nmap
Step 3:Â To verify the installation, type:
# nmap -v
This will show the version of Nmap you just installed.
Installing with Snap gives you one of the most updated versions of Nmap.
You’ve successfully installed Nmap using Snap. This method is perfect for a quick installation without worrying about dependencies or package updates.
Conclusion
By following these steps, you’ve equipped yourself with Nmap, a powerful tool for analyzing and securing your network. Always use Nmap responsibly and ethically to promote a safe digital environment.