{"id":4847,"date":"2021-03-02T08:15:44","date_gmt":"2021-03-02T08:15:44","guid":{"rendered":"https:\/\/linuxways.net\/?p=4847"},"modified":"2021-03-05T05:15:32","modified_gmt":"2021-03-05T05:15:32","slug":"how-to-install-nmap-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-nmap-on-ubuntu-20-04\/","title":{"rendered":"How to Install Nmap on Ubuntu 20.04"},"content":{"rendered":"<p>Nmap (Network Mapper) is used by Network administrators for security scanning and network discovery. It is a free tool mostly used for <a href=\"https:\/\/linuxways.net\/de\/ubuntu\/how-to-check-open-ports-in-linux\/\">port scanning<\/a>. It works by sending raw IP packets and then listens for responses to determine which ports are open or closed. Network administrators use Nmap to identify hosts, OS, services, and vulnerabilities on your network.<\/p>\n\n\n\n<p>This guide is about how to install Nmap on the Ubuntu system. There are following three different ways to install Nmap on Ubuntu:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Installing Nmap on Ubuntu via apt<\/li><li>Installation Nmap on Ubuntu via Snap<\/li><li>Installation Nmap on Ubuntu via Source Code<\/li><\/ul>\n\n\n\n<p><strong>Note:<\/strong> The installation procedures shown here have been tested on <strong>Ubuntu 20.04 LTS <\/strong>system. You should have sudo or root privileges if you want to install Nmap on your Ubuntu system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Nmap on Ubuntu via apt<\/h2>\n\n\n\n<p>You can install Nmap on Ubuntu using the apt command. Here are the installation steps:<\/p>\n\n\n\n<p>1. Update repository index using this command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt update<\/pre>\n\n\n\n<p>2. Then install Nmap as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt install nmap<\/pre>\n\n\n\n<p>Enter the sudo password and then you will be prompted to confirm if you want to proceed with the installation. To carry on, type <strong>y <\/strong>and after that press <strong>Enter<\/strong>. <\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"310\" class=\"wp-image-4848\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/installing-nmap-via-apt.png\" alt=\"installing Nmap via apt\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/installing-nmap-via-apt.png 693w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/installing-nmap-via-apt-300x134.png 300w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/p>\n\n\n\n<p>The installation will take a while based on your internet speed. Once completed, you can use the below command to verify the installation and to check the version of Nmap:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ nmap --version<\/pre>\n\n\n\n<p>The following output verifies that Nmap version <strong>7.80<\/strong> has been installed on our system.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"649\" height=\"158\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/nmap-version.png\" alt=\"Nmap version\" class=\"wp-image-4849\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/nmap-version.png 649w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/nmap-version-300x73.png 300w\" sizes=\"auto, (max-width: 649px) 100vw, 649px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Nmap on Ubuntu via Snap<\/h2>\n\n\n\n<p>Nmap is also available as a snap package for Ubuntu OS. To install Nmap via snap, you first have to install snapd tool on your system. Here are the installation steps:<\/p>\n\n\n\n<p>1. Use the below command to install snapd on your system:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt install snapd<\/pre>\n\n\n\n<p>Once snapd is installed, proceed to the next step.<\/p>\n\n\n\n<p>2. Install Nmap snap package using the below command in Terminal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo snap install nmap<\/pre>\n\n\n\n<p>Nmap installation will start and, once completed, the following output will be displayed: <img loading=\"lazy\" decoding=\"async\" width=\"634\" height=\"71\" class=\"wp-image-4850\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/installing-nmap-on-ubuntu-via-snap.png\" alt=\"Installing Nmap on Ubuntu via Snap\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/installing-nmap-on-ubuntu-via-snap.png 634w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/installing-nmap-on-ubuntu-via-snap-300x34.png 300w\" sizes=\"auto, (max-width: 634px) 100vw, 634px\" \/><\/p>\n\n\n\n<p>The above output shows Nmap version <strong>7.91<\/strong> has been successfully installed on our machine.<\/p>\n\n\n\n<p>You can also use the below command to check the version of Nmap on your system if you later need to do so:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ nmap --version<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"615\" height=\"157\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-13.png\" alt=\"\" class=\"wp-image-4851\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-13.png 615w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-13-300x77.png 300w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Nmap via Ubuntu Source Code<\/h2>\n\n\n\n<p>Nmap can be installed by downloading and compiling the source code. Use this procedure if you want to have the latest version of Nmap.<\/p>\n\n\n\n<p>Here are the installation steps:<\/p>\n\n\n\n<p>1. First, install the build-essential package. Issue the command below in Terminal to do so:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt install build-essential<\/pre>\n\n\n\n<p>This package contains the necessary packages required to compile source code.<\/p>\n\n\n\n<p>2. Visit Nmap official <a href=\"https:\/\/nmap.org\/download.html\">Downloads<\/a> page and download Nmap latest version in <strong>tar.bz2<\/strong> format or use the following command to download the currently available latest version <strong>7.9.1<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ wget https:\/\/nmap.org\/dist\/nmap-7.91.tar.bz2<\/pre>\n\n\n\n<p>3. Extract the <strong>tar.bz2 <\/strong>archive using the below command in Terminal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ tar xf nmap-7.91.tar.bz2<\/pre>\n\n\n\n<p>4. Navigate to the extracted directory using the <em>cd<\/em> command as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cd nmap-7.91\/<\/pre>\n\n\n\n<p>Then run the configure script to check if the system has all the prerequisites for installing the software. If it shows any error then you will have to go back and install the missing prerequisites.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo .\/configure<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"551\" height=\"137\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-14.png\" alt=\"\" class=\"wp-image-4852\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-14.png 551w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-14-300x75.png 300w\" sizes=\"auto, (max-width: 551px) 100vw, 551px\" \/><\/figure>\n\n\n\n<p>If the configuration is successful, you will see the following view on your Terminal.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"775\" height=\"711\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-15.png\" alt=\"\" class=\"wp-image-4853\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-15.png 775w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-15-300x275.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-15-768x705.png 768w\" sizes=\"auto, (max-width: 775px) 100vw, 775px\" \/><\/figure>\n\n\n\n<p>5. Issue the <em>make<\/em> command to build Nmap software.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo make<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"199\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-16.png\" alt=\"\" class=\"wp-image-4854\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-16.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-16-300x58.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-16-768x149.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-16-1020x199.png 1020w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>6. Now, install Nmap using the command below in Terminal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo make install<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"632\" height=\"289\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-17.png\" alt=\"\" class=\"wp-image-4855\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-17.png 632w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-17-300x137.png 300w\" sizes=\"auto, (max-width: 632px) 100vw, 632px\" \/><\/figure>\n\n\n\n<p>Once Nmap is installed, you will see the following lines at the end of the output.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"118\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-18.png\" alt=\"\" class=\"wp-image-4856\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-18.png 708w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-18-300x50.png 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p>Now to verify the Nmap installation and to check the installed version, issue the below command in Terminal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ nmap --version<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"565\" height=\"157\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-19.png\" alt=\"\" class=\"wp-image-4857\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-19.png 565w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/03\/word-image-19-300x83.png 300w\" sizes=\"auto, (max-width: 565px) 100vw, 565px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Remove Nmap<\/h2>\n\n\n\n<p>If you need to remove Nmap from the Ubuntu system, you can simply do so using the below command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt remove nmap<\/pre>\n\n\n\n<p>To remove Nmap along with all the related configuration files, issue the below command instead:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt purge nmap<\/pre>\n\n\n\n<p>If you have installed Nmap through snap, you can remove it as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo snap remove nmap<\/pre>\n\n\n\n<p>If you have installed Nmap from the source, you can remove it as follows:<\/p>\n\n\n\n<p><pre><strong>$ cd nmap-7.91\/<\/strong><\/pre><\/p>\n\n\n\n<p><pre>$ sudo make uninstall<\/pre><\/p>\n\n\n\n<p>There is always more than one method to do a task in Linux. Here, we have shown you three different methods to install Nmap on Ubuntu. If you want to learn how to use nmap, visit our post on <a href=\"https:\/\/linuxways.net\/de\/centos\/15-mostly-used-nmap-commands-for-scanning-remote-hosts\/\">15 Mostly Used Nmap Commands for Scanning Remote Hosts<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Nmap (Network Mapper) is used by Network administrators for security scanning and network discovery. It is a free tool mostly used for port scanning. It works by sending&hellip;<\/p>","protected":false},"author":4,"featured_media":4858,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[100],"class_list":["post-4847","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/4847","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=4847"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/4847\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/4858"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=4847"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=4847"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=4847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}