To install Nmap from source, three steps must be taken:
Download the source code.
Compile the code.
Install the compiled tool.
Downloading the code with a tool such as wget
is very simple; all we need to do is type wget http://nmap.org/dist/nmap-6.47.tar.bz2
(or whatever is the current version of Nmap).
Once the tool is downloaded, it must be removed from its tarball—or compressed—state. This is done using the tar
command by typing tar xvf nmap-6.47.tar.bz2
.
At this stage, we now have a new directory filled with Nmap source code. If we change the directory by typing cd nmap-6.47
, we are then able to compile this code. For those users that are familiar with installing tools on Linux, the next step will be familiar. We need to ./configure
make and sudo make install
in order to install Nmap on our system.
The "Nmap dragon" is a famous piece of ASCII art that is displayed during the ./configure
step of Nmap source code compilation.
Once Nmap is successfully installed, you can verify that it works—and see which options it was compiled with—by typing nmap -V
. We'll cover the different flags that you can pass to Nmap in the subsequent chapters.