Nmap is an open-source network scanner and security auditing utility. The system and network administrators can use Nmap for several useful tasks like for port scanning, administration, network inventory, security auditing, etc. It can collect a wealth of information like OS version, MAC address, running services, and much more. Nmap can monitor a single host or a large network comprising of several hosts.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Server Monitoring queries.
In this context, we shall look into the installation of Nmap on a CentOS machine.
Previously, we covered the installation of Nmap on Ubuntu OS.
We can use any of the methods given below to install Nmap:
1. Nmap Installation via Yum Package Manager
To install Nmap using the yum package manager, use these steps.
i. Open the Terminal in your CentOS machine. Press the Windows key and then search the Terminal program using the search box that appears.
ii. Now execute the command below in order to install Nmap:
$ sudo yum install nmap
If prompted, hit y to continue.
iii. Now to verify the installation of Nmap and to view the version that is installed, execute the command below:
$ nmap --version
This command will display the Nmap version installed on our CentOS machine.
2. Nmap Installation via Snap Package Manager
To install Nmap using the snap package manager, use these steps.
i. You should first enable the EPEL repository using the command below:
$ sudo yum install epel-release
Enter sudo password and press y if prompts you with y/N.
ii. You can now use the yum command to install snapd as follows:
$ sudo yum install snapd
Enter sudo password and press y if it prompts you with y/N.
iii. After installing snapd, you will have to enable the snapd.socket:
$ sudo systemctl enable --now snapd.socket
iv. Then you will need to create a symlink:
$ sudo ln -s /var/lib/snapd/snap /snap
This will enable the classic snap support.
v. You can now install Nmap:
$ sudo snap install nmap
vi. Now to verify the installation of Nmap and to view the version that is installed, execute the command below:
$ nmap --version
This command will display the Nmap version installed on our CentOS machine.
To display the help screen along with all the options for the Nmap command-line utility, use the below command:
$ nmap --help
How to Uninstall Nmap from CentOS Linux Machine ?
If you want to remove Nmap from your system, you can do so using the following methods:
If you have installed Nmap using the yum package manager, you can uninstall it as follows:
$ sudo yum remove nmap
If you have installed Nmap using the snap package manager, you can uninstall it as follows:
$ sudo snap remove nmap
This article covers methods to install Nmap on your CentOS machine. Nmap is a handy utility for network scanning and security auditing. Nmap contains variety of options for scanning remote hosts. Have a look at the 15 Mostly Used Nmap Commands for Scanning Remote Hosts.
How to Install Nmap on Debian / Ubuntu ?
1. Install Nmap on Ubuntu by entering the following command:
$ sudo apt-get install nmap
2. The system prompts you to confirm the installation by typing y.
3. After the installation is finished, verify the installed version of Nmap by entering:
$ nmap –version