Installing nmap on Ubuntu 12.04

There is a problem installing nmap using the apt-get package installer on Ubuntu 12.04. The problem appears to be with the sub-build of ncat, so you can build the package without it.

But if you need ncat (as I did) you will need to edit the LUA_LIBS definition as part of the make.

First install the package prerequisites:

sudo apt-get install checkinstall build-essential

Now download the package tar bundle

wget http://nmap.org/dist/nmap-6.40.tar.bz2

Extract the tar bundle

tar -jxvf nmap-6.40.tar.bz2

Now configure and make the package

cd nmap-6.40
./configure
make "LUA_LIBS=../liblua/liblua.a -ldl -lm"

Run checkinstall and accept all of the defaults

sudo checkinstall
sudo dpkg -i nmap_6.40-1_amd64.deb

You can test the package is working by running the following command

nmap -A scanme.nmap.org

Ref:  http://ubuntuforums.org/showthread.php?t=2164741&p=12777610#post12777610