In this tutorial, we will show you how to install Nmap on AlmaLinux 9. Nmap, short for Network Mapper, is a versatile and powerful open-source tool used for network exploration, security auditing, and vulnerability assessment. It allows you to discover devices running on a network, find open ports, detect operating systems, and identify services running on remote hosts. Whether you’re assessing the security of your own network or conducting penetration testing, Nmap is an invaluable ally.
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 the step-by-step installation of Nmap on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux or RHEL-based.
- A server running one of the following operating systems: AlmaLinux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Nmap.
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 9
Step 1. Before diving into the installation process, ensure your AlmaLinux 9 system is up-to-date. Run the following commands in your terminal:
sudo dnf clean all sudo dnf update
The first command cleans up the package cache, and the second command performs the system update.
After updating your system, it’s a good practice to verify that the process was completed successfully. You can do this by running:
sudo dnf list updates
Step 2. Installing Nmap on AlmaLinux 9.
- Installing Nmap via DNF
DNF provides a search feature to help you find available packages. To search for Nmap, use the following command:
sudo dnf search nmap
Once you’ve identified the Nmap package you want to install, you can use the following command to install it:
sudo dnf install nmap
To verify that Nmap has been successfully installed, simply run:
- Alternative Method: Compiling from Source
Begin by downloading the latest Nmap source code from the official Nmap website. You can use
curl to download the source tarball. For example:
Now, let’s proceed with the compilation and installation:
# Extract the source code tar xvfj nmap-7.91.tar.bz2 # Navigate into the source directory cd nmap-7.91 # Configure the build ./configure # Compile the source code make # Install Nmap sudo make install
To verify that Nmap from the source code has been successfully installed, run:
Step 3. Basic Nmap Usage.
- A quick scan with Nmap
Now that Nmap is installed, let’s perform a basic scan. To scan a target host, simply use:
- Scanning a specific target or IP range
To scan multiple hosts or an IP range, use:
nmap target1 target2 target3
target2, etc., with the IP addresses or domains you want to scan.
- Understanding Nmap output
Nmap’s output can be extensive. Understanding it is crucial for effective network analysis. Explore the scan results, paying attention to open ports, services, and OS detection information.
Step 4. Advanced Nmap Techniques.
- Service version detection
Nmap can go beyond simple port scanning. Use the
-sV flag to enable service version detection. For example:
nmap -sV target_ip_or_domain
This command will provide detailed information about the services running on open ports.
- OS detection
To detect the operating system of a target host, use the
nmap -O target_ip_or_domain
- Scripting with Nmap
Nmap’s scripting engine, NSE (Nmap Scripting Engine), allows you to automate tasks and customize scans. You can find and use scripts in the
For example, to run a script named
http-title that retrieves the title of web pages, use:
nmap --script http-title -p 80,443 target_ip_or_domain
- Generating Nmap reports
Nmap can generate reports in various formats, making it easier to document your findings. Use the
-oX flag to create an XML report:
nmap -oX report.xml target_ip_or_domain
You can convert the XML report to other formats like HTML or plain text using tools like
Step 5. Troubleshooting.
Common installation issues √
If you encounter issues during the installation process, consider the following troubleshooting steps:
- Check your internet connection: Ensure that your AlmaLinux 9 server has a working internet connection to access repositories.
- Check repository configuration: Make sure your repository configuration is correct and up to date.
- Review error messages: Pay attention to error messages during installation for clues about what went wrong.
- Dependency issues: Resolve any missing or broken dependencies.
Nmap command issues √
If you face problems while using Nmap, such as scan failures or unexpected results, here are some troubleshooting tips:
- Check your command syntax: Review your Nmap commands to ensure they are correctly formatted.
- Firewall issues: Firewalls on either the scanning system or the target can impact Nmap scans. Ensure proper firewall rules are in place.
- Host availability: Confirm that the target host is online and reachable.
Congratulations! You have successfully installed Nmap. Thanks for using this tutorial for installing Nmap on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official Nmap website.