Testing network security controls and discovering vulnerabilities are essential part of any organization’s security plan. Nmap or Network Mapper is a tool that helps a lot for security engineers in testing network security controls and discover vulnerabilities, and it helps network engineers troubleshooting various network issues. Let’s see three different ways to install Nmap on Linux Mint or Ubuntu.
What Is Nmap?
Nmap, or Network Mapper, is an open-source network security scanner. Nmap works by using IP packets in a variety of ways to scan networks for hosts, open ports, and vulnerabilities. Nmap can also use the information it receives to determine the services operating on those ports, applications running on the device, and even the device’s operating system.
Nmap was created in 1997, and it still continues to expand its capability more than 20 years later. Nmap is a very versatile tool that can be used to test network security controls in place on a system. Nmap primarily tests security controls by conducting port scans, which display the open ports on a device. These ports sometimes show vulnerabilities in a system. Examples of vulnerabilities are outdated services, applications, and protocols in use on network devices. Open ports and older services can be used by hackers to exploit these devices.
Other valuable features of Nmap enable network administrators and information security personnel to conduct an inventory of devices that are online. The operating system detection feature can also be used to detect rogue or unauthorized devices that are placed on the network. Examples of these devices are unauthorized Wi-Fi access points or network hubs that need to be removed. As you can see, more than 20 years later, Nmap is still a versatile and capable tool that can be leveraged quickly in a variety of ways.
3 Different Ways To Install Nmap on Linux Mint or Ubuntu:
In Linux, programs can be installed in multiple ways. The two common ways are the installation of compelled binaries from the official repositories and the installation from the source code. In this post, we are using the Linux Mint for demonstration. However, this work is on other Debian-based Linux distributions such as Ubuntu, Raspberry Pi OS, etc. Let’s see how to install Nmap in three different ways on Linux Mint or Ubuntu.
Install nmap Using apt
Apt is an official repository in the Debian-based Linux distribution. It has readily compelled binaries in its repository. When you install a program from apt repositories, you are installing the compelled program on Linux. It is simple and straight to install Nmap from the apt repository.
$ sudo apt update $ sudo apt install nmap $ nmap --version
Install nmap Using snap
Snap is a universal or cross-distribution software packaging repository. It is developed by Canonical, who developed Ubuntu. It is considered an advanced package distribution because of its cross-distribution, dependency-free, and easy-to-install applications package support. A package built-in Snap can be run on all major Linux distributions such as Ubuntu, Debian, Fedora, Arch Linux, Manjaro, and CentOS/RHEL. Let’s see how to install Nmap from the snap package repository.
Note: snapd is included in the default installation set in Ubuntu. If not, you can install snapd either from the Software Manager or from the terminal command ‘sudo apt install snapd’. However, If you are installing snapd on Linux Mint. You may see a problem in reading the package from the repository. You should enable snap on Linux Mint before install.
- Press Ctrl+Alt+t to open the terminal.
- Remove ‘nosnap.pref‘ from the location /etc/apt/preferences.d/nosnap.pref:
- Update the repository.
$ sudo rm /etc/apt/preferences.d/nosnap.pref $ sudo apt update
$ sudo apt install snapd $ sudo apt install snapd $ sudo snap install nmap $ nmap --version
Install nmap Using Source Code
The third meaningful way of installation on Linux is installing programs directly compelling the source codes. Source codes are the actual programs in text files. You need to build a package from the source code before installing it on the Linux distribution. Let’s see how to install Nmap from the source code.
$ sudo apt install build-essential $ wget https://nmap.org/dist/nmap-7.91.tar.bz2 $ tar xf nmap-7.91.tar.bz2 $ cd nmap-7.91/ $ sudo ./configure $ sudo make $ sudo make install $ nmap --version
How to Uninstall Nmap From Linux Mint or Ubuntu?
Now you know the three different ways to install Nmap on Linux Mint. What if you want to uninstall Nmap? It is always recommended to know the uninstallation of the program which you are going to install. Let’s see how to uninstall Nmap from Linux Mint or Ubuntu.
Unnstall nmap From apt
Run this command to remove the Nmap package alone using apt.
$ sudo apt remove nmap
Run this command to remove along with configurations and dependent packages.
$ sudo apt purge nmap
Unnstall nmap From snap
Run this command to remove Nmap through snap
$ sudo snap remove nmap
Uninstall nmap From Source Code
If you want to uninstall Nmap from the local build. Change directory to the installed directory, then issue make uninstall command.
$ cd nmap-7.91/ $ sudo make uninstall