Nmap binaries for all major platforms can be found at the official website, at http://nmap.org/download.html. A lot of distributions also offer official packages. However, if you want the latest features and NSE scripts, you need to work with the development branch. The code in this branch is more stable than the name implies, as the developers make sure their code is working before submitting it to this branch. By always running a copy from the development branch, you also always have the latest bug fixes.
Nmap uses Subversion, the famous Version Control System (VCS), to manage the source code of the project. First, make sure you have a Subversion client at hand:
$svn --version
On Debian-based systems, you can install Subversion by running the following command:
#apt-get install subversion
Note
A good alternative to Subversion is RapidSVN, a cross-platform Subversion client with a Graphical User Interface. You can get RapidSVN from http://rapidsvn.tigris.org/.
Once the Subversion client is installed, we grab the development branch from the official repositories with the following command:
$svn co https://svn.nmap.org/nmap
The preceding command downloads the latest revision of the development branch into a new directory in your current directory. We will refer to this folder as your working copy. Before compiling, you may need additional tools and libraries such as OpenSSL. Make sure you have all the requirements installed by running the following command:
#apt-get install make g++ libssl-dev autoconf
Now we can compile and install Nmap. Go to the nmap
directory that was just created by Subversion and enter the following command:
$./configure
If everything worked correctly, you should see an ASCII dragon warning you about the power of Nmap, like this:
Now let's compile Nmap with the following commands:
$make #make install
Now run Nmap to ensure that it was installed correctly. You should see your build information:
#nmap -v Nmap version 6.47SVN ( http://nmap.org ) Platform: x86_64-apple-darwin14.0.0 Compiled with: nmap-liblua-5.2.3 openssl-0.9.8za nmap-libpcre-7.6 libpcap-1.5.3 nmap-libdnet-1.12 ipv6 Compiled without: Available nsock engines: kqueue poll select