How to Install Nmap Network Scanner on Linux
Network Mapper (Nmap) is a free and open-source network security scanning tool. By sending IP packets and analyzing the responses, Nmap provides insights into hosts and services on remote networks. It can also be used to audit device security, identify network vulnerabilities, or conduct inventory checks.
This guide will walk you through the process of installing Nmap on Linux and highlight its key features.
Prerequisites
- A user account with root privileges.
- Access to the terminal (Ctrl + Alt + T).
Installing Nmap on Linux
Nmap is included by default on Kali Linux, a distribution tailored for penetration testing that features a variety of security tools, including Nmap. For other Debian-based Linux distributions, you’ll need to install Nmap separately.
You can choose from four methods to install Nmap, depending on your preferences and requirements:
1.Using the CLI with your package manager of choice.
2.Through the GUI.
3.By compiling the Nmap source code.
4.By installing Nmap in Docker.
The following sections will detail each method and provide the necessary installation steps.
Install Nmap via Package Manager/Command Line
Installing Nmap via the command line is the simplest and most direct method. It involves running a few commands. Follow these steps:
Update your system’s package repository to ensure you install the latest version of Nmap:
Sudo apt update
Install Nmap by executing the following command:
sudo apt install nmap -y
Verify that Nmap has been installed by running:
nmap –version
If the installation was successful, the output will display the version of the Nmap utility:
Install NMAP via GUI
You can use the Ubuntu Software tool to install Nmap via the GUI. The GUI option is intuitive and useful for people who are not well-versed in using the terminal. Follow the steps below:
1. Click the grid button in Ubuntu to show all apps, and type ubuntu software in the search bar. From the result list, select the Ubuntu Software app.
2. When the Ubuntu Software application opens, click the search icon and type “nmap.”
3.From the search results, select the Nmap utility and click the Install button.
Provide your administrator password when prompted and wait for the installation process to complete.
Install Nmap by Compiling Source Code
Compiling from source involves converting human-readable source code into machine-readable binary code that your computer can execute.
Compiling from source often provides access to the latest features and updates before they are included in official releases. However, this method can be complex, may lack official support, and typically requires knowledge of dependencies and build tools.
If you choose to install Nmap by compiling it from the source code, follow these steps:
1.Open the terminal and run the following command to install the packages required for compiling Nmap:
sudo apt install build-essential libssl-dev
2.Use a browser to visit the official Nmap website and download the latest tarball from the Source Code Distribution section. You can either download it directly through the browser or use the wget command by copying the download link as follows:
wget https://nmap.org/dist/nmap-[version].tar.bz2
3.After the download completes, extract the tarball using the tar command:
tar jxvf nmap-[version].tar.bz2
Replace [filename] with the exact name of the file you downloaded.
4.Use the cd command to navigate to the extracted directory:
5.Compile the source code by running:
./configure && make && sudo make install
Wait for the process to complete. Compiling from source typically takes longer than installing a package through a package manager, so be patient while it finishes.
Install Nmap in Docker
Docker is a platform that allows users to package, distribute, and run applications in lightweight, isolated containers. If you prefer to use Nmap without installing it directly on your system, you can run it in a Docker container, which provides a separate, isolated environment. This method requires that Docker is already installed and functioning on your system.
Follow these steps:
1.Open the terminal and pull the Nmap Docker image with the following command:
sudo docker pull instrumentisto/nmap
2.After pulling the image, run Nmap in Docker using the following command:
docker run -it –rm instrumentisto/nmap -v
When the process completes, your Docker container will run Nmap without installing it directly on your system. This method is useful if you suspect Nmap could interfere with other software.
Thank you for visiting our site, you can check out our other related articles from the links below 🙂
How to Install OpenSSL on Ubuntu Linux
How to Install and Use TCPdump to Capture Packets on Linux
How to Install mitmproxy on Kali Linux
If you would like to improve yourself in server management, you can purchase a server from our site, experiment and improve yourself in an affordable and reliable environment. I wish you good luck.
How to Use Nmap Security Scanner on Linux
Running Nmap will generate a list of scanned targets along with additional details based on the options and arguments you provide. This section outlines some of the basic options available with Nmap. For a complete list of options, visit the official Nmap website or access the manual from your command line using the man command:
Thank you for visiting our site…