How to install NMAP on Ubuntu?

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.


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

Update package list

Step 3: Now, install Nmap by typing the following command and pressing Enter:

# apt install nmap

Save $100 in the next
5:00 minutes?

Register Here

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

Check if Nmap is installed correctly

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

Save $100 in the next
5:00 minutes?

Register Here

Compile Nmap from source

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).

Download the Nmap source code

Step 4: After the download, extract the file using this command:

# tar jxvf nmap-<version>.tar.bz2

Extract the file

Step 5: Move into the directory created after extraction:

# cd nmap-<version>

Move into the directory

Step 6: Finally, compile and install Nmap with the following commands:

# ./configure && make && sudo make install

Compile and Install Nmap

Compile and Install Nmap

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.

Save $100 in the next
5:00 minutes?

Register Here
Note: Compiling from source takes more time than using the package manager. Also, remember that this version might be less stable. Use this method if you need the latest features directly from the source code.

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

Install Nmap

Step 3: To verify the installation, type:

# nmap -v

Verify the installation

This will show the version of Nmap you just installed.

Installing with Snap gives you one of the most updated versions of Nmap.

Note: Snap packages are usually larger than those installed with apt or compiled from source because they include all necessary dependencies. Keep this in mind if you’re short on storage space.

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.

Save $100 in the next
5:00 minutes?

Register Here