In this tutorial, we will show you how to install Nmap on AlmaLinux 8. For those of you who didn’t know, Nmap is an open-source network scanner and security auditing utility. Nmap allows finding devices running on their network and discovering open ports and services that, if not secure or hardened, can lead to potential exploiting known vulnerabilities security risks. Nmap support is available for Linux, Windows, UNIX, FreeBSD, etc.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Nmap network scanner on an AlmaLinux 8. You can follow the same instructions for CentOS and Rocky Linux.
- A server running one of the following operating systems: AlmaLinux 8, CentOS, and Rocky Linux 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Nmap on AlmaLinux 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update sudo dnf upgrade
Step 2. Installing Nmap on AlmaLinux 8.
By default, Nmap is available on the AlmaLinux 8 base repository. Now we run the following command to install Nmap to your AlmaLinux system:
sudo dnf install nmap
Now to verify the installation of Nmap:
Step 3. Use the Nmap Scanner.
The article covers the basic options this tool has to offer. For a full list of options visit the Nmap official page or access the manual from your command line:
Scan IP range or subnet:
To obtain general information of a remote system type:
sudo nmap target-IP-address or your-domain.com
Instead of scanning individual IPs, scan a whole IP range by defining it in your command line:
sudo nmap 192.168.77.2-21
The following command scans the entire specified subnet:
sudo nmap 18.104.22.168/24
Port Scanning with Nmap
Nmap is an efficient port scanner that recognizes six port states:
- open – actively accepting TCP connections, UDP datagrams, or SCTP associations
- closed – accessible; however, no application is listening on the port
- filtered – Nmap cannot determine whether the port is open due to packet filtering
- unfiltered – the port is accessible; however, Nmap is unable to determine if it is open or closed
- open|filtered – Nmap cannot determine if a port is open or filtered
- closed|filtered – Nmap cannot establish if a port is closed or filtered
Port Specification and Scan Order
By default, Nmap scans the thousand most common ports for each protocol. It also offers options for specifying which ports are to be scanned and whether the scan is random or ordered.
The -p option allows you to specify port ranges and sequences:
sudo nmap –p 80,443 192.168.77.21
This command scans ports 80 and 443 for the defined host.
TCP SYN scan
sudo nmap -sS 192.168.77.21
Congratulations! You have successfully installed Nmap. Thanks for using this tutorial for installing the Nmap network scanner on your AlmaLinux 8 system. For additional help or useful information, we recommend you check the official Nmap website.