Install nmap 6 on Debian or Ubuntu Linux

By | 2012/05/22

nmap 6 is out! It will be a couple of centuries before this is available in Debian, so I’ll show you how to easily create a .deb package right now. The following steps will provide a .deb package which is easy to cleanly uninstall at anytime as needed.

Updated 19 June 2012!


1. First install some needed packages:

$ sudo apt-get install build-essential libssl-dev libpathfinder-openssl-1 liblinear-dev libpcap0.8-dev libpcre3-dev checkinstall

2. Next, grab the latest nmap tarball from http://nmap.org/download.html:

$ wget http://nmap.org/dist/nmap-6.01.tar.bz2

3. Extract:

$ tar xvf nmap-6.01.tar.bz2

4. Change to the nmap directory we extracted:

$ cd nmap-6.01/

5. Configure:

$ ./configure

6.

$ make

7.

$ sudo checkinstall

(When prompted, default values here are ok if the deb is only for your own use.)


$ sudo checkinstall
[sudo] password for stmiller: 

checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.


The package documentation directory ./doc-pak does not exist. 
Should I create a default set of package docs?  [y]: y

Preparing package documentation...OK

Please write a description for the package.
End your description with an empty line or EOF.
>> nmap
>> 

*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values: 

0 -  Maintainer: [ root@brahms ]
1 -  Summary: [ nmap ]
2 -  Name:    [ nmap ]
3 -  Version: [ 6.01 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ amd64 ]
8 -  Source location: [ nmap-6.01 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ nmap ]
12 - Conflicts: [  ]
13 - Replaces: [  ]

Enter a number to change any of them or press ENTER to continue: 

Installing with make install...

========================= Installation results ===========================
/usr/bin/install -c -d /usr/local/bin /usr/local/share/man/man1 /usr/local/share/nmap
/usr/bin/install -c -c -m 755 nmap /usr/local/bin/nmap
/usr/bin/strip -x /usr/local/bin/nmap
/usr/bin/install -c -c -m 644 docs/nmap.1 /usr/local/share/man/man1/
if [ "yes" = "yes" ]; then \
	  for ll in de es fr hr hu it jp pl pt_BR pt_PT ro ru sk zh; do \
	    /usr/bin/install -c -d /usr/local/share/man/$ll/man1; \
	    /usr/bin/install -c -c -m 644 docs/man-xlate/nmap-$ll.1 /usr/local/share/man/$ll/man1/nmap.1; \
	  done; \
	fi
/usr/bin/install -c -c -m 644 docs/nmap.xsl /usr/local/share/nmap/
/usr/bin/install -c -c -m 644 docs/nmap.dtd /usr/local/share/nmap/
/usr/bin/install -c -c -m 644 nmap-services /usr/local/share/nmap/
/usr/bin/install -c -c -m 644 nmap-payloads /usr/local/share/nmap/
/usr/bin/install -c -c -m 644 nmap-rpc /usr/local/share/nmap/
/usr/bin/install -c -c -m 644 nmap-os-db /usr/local/share/nmap/
/usr/bin/install -c -c -m 644 nmap-service-probes /usr/local/share/nmap/
/usr/bin/install -c -c -m 644 nmap-protocols /usr/local/share/nmap/
/usr/bin/install -c -c -m 644 nmap-mac-prefixes /usr/local/share/nmap/
/usr/bin/install -c -d /usr/local/bin /usr/local/share/man/man1
cd zenmap && /usr/bin/python setup.py --quiet install --prefix "/usr/local" --force 
/usr/bin/install -c -c -m 644 docs/zenmap.1 /usr/local/share/man/man1/
if [ ! -f /usr/local/bin/nmapfe -o -L /usr/local/bin/nmapfe ]; then \
		ln -sf zenmap /usr/local/bin/nmapfe; \
	fi
ln -sf zenmap /usr/local/bin/xnmap
make[1]: Entering directory `/home/stmiller/Downloads/build/nmap-6.00/ncat'
Installing Ncat
../shtool mkdir -f -p -m 755 /usr/local/bin /usr/local/share/man/man1
/usr/bin/install -c -c -m 755 ncat /usr/local/bin/ncat
/usr/bin/strip -x /usr/local/bin/ncat
if [ -n "certs/ca-bundle.crt" ]; then \
		../shtool mkdir -f -p -m 755 /usr/local/share/ncat; \
		/usr/bin/install -c -c -m 644 certs/ca-bundle.crt /usr/local/share/ncat/; \
	fi
/usr/bin/install -c -c -m 644 docs/ncat.1 /usr/local/share/man/man1/ncat.1
make[1]: Leaving directory `/home/stmiller/Downloads/build/nmap-6.00/ncat'
cd ndiff && /usr/bin/python setup.py install --prefix "/usr/local" 
running install
running build
running build_scripts
running install_scripts
copying build/scripts-2.7/ndiff -> /usr/local/bin
changing mode of /usr/local/bin/ndiff to 755
running install_data
copying docs/ndiff.1 -> /usr/local/share/man/man1
running install_egg_info
make[1]: Entering directory `/home/stmiller/Downloads/build/nmap-6.00/nping'
/usr/bin/install -c -d /usr/local/bin /usr/local/share/man/man1
/usr/bin/install -c -c -m 755 nping /usr/local/bin/nping
/usr/bin/strip -x /usr/local/bin/nping
/usr/bin/install -c -c -m 644 docs/nping.1 /usr/local/share/man/man1/
NPING SUCCESSFULLY INSTALLED
make[1]: Leaving directory `/home/stmiller/Downloads/build/nmap-6.00/nping'
NMAP SUCCESSFULLY INSTALLED

======================== Installation successful ==========================

Copying documentation directory...
./
./docs/
./docs/nmap.xsl
./docs/sample-script.nse
./docs/committers.txt
./docs/nse-scripts.dtd
./docs/win32-installer-zenmap-buildguide.txt
./docs/3rd-party-licenses.txt
./docs/zenmap.1
./docs/man-xlate/
./docs/man-xlate/nmap-ru.1
./docs/man-xlate/nmap-fr.1
./docs/man-xlate/nmap-pt_BR.1
./docs/man-xlate/nmap-hu.1
./docs/man-xlate/nmap-id.1
./docs/man-xlate/nmap-zh.1
./docs/man-xlate/nmap-jp.1
./docs/man-xlate/nmap-sk.1
./docs/man-xlate/nmap-ro.1
./docs/man-xlate/nmap-hr.1
./docs/man-xlate/nmap-pt_PT.1
./docs/man-xlate/nmap-de.1
./docs/man-xlate/nmap-pl.1
./docs/man-xlate/nmap-it.1
./docs/man-xlate/nmap-es.1
./docs/leet-nmap-ascii-art.txt
./docs/nmap-update.1
./docs/licenses/
./docs/licenses/LGPL-2
./docs/licenses/MPL-1.1
./docs/licenses/BSD-simplified
./docs/licenses/LGPL-2.1
./docs/licenses/OpenSSL.txt
./docs/README
./docs/nmap.dtd
./docs/device-types.txt
./docs/nmap.1
./docs/nmap_gpgkeys.txt
./docs/nmap.usage.txt
./CHANGELOG
./README-WIN32
./COPYING
./INSTALL
./HACKING

Copying files to the temporary directory...OK

Stripping ELF binaries and libraries...OK

Compressing man pages...OK

Building file list...OK

Building Debian package...OK

Installing Debian package...OK

Erasing temporary files...OK

Writing backup package...OK
OK

Deleting temp dir...OK


**********************************************************************

 Done. The new package has been installed and saved to

 /home/stmiller/Downloads/build/nmap-6.01/nmap_6.01-1_amd64.deb

 You can remove it from your system anytime using: 

      dpkg -r nmap

**********************************************************************


Done!

$ nmap -V

Nmap version 6.01 ( http://nmap.org )
Platform: x86_64-unknown-linux-gnu
Compiled with: nmap-liblua-5.1.3 openssl-1.0.0h nmap-libpcre-8.12 nmap-libpcap-1.2.1 nmap-libdnet-1.12 ipv6
Compiled without: 

Hack on,