How do I install the latest version of nmap from source on Ubuntu?

7,194

Solution 1

I am not that familiar with nmap but I built the very latest version from source reasonably easily under Xenial Xerus with a few easy steps.

Step 1:

First activate the Software Sources:

Dash > Software & Updates > Ubuntu Software > Downloadable from The Internet > Source Code

and allow the Repositories to reload.

Step 2:

Then install the build dependencies as well as checkinstall:

sudo apt-get build-dep nmap
sudo apt-get install checkinstall

Step 3:

Then run the following single command to download, compile and install the latest nmap:

mkdir $HOME/Desktop/nmap_build && cd $HOME/Desktop/nmap_build && \
wget https://nmap.org/dist/nmap-7.31.tar.bz2 && tar xavf nmap-7.31.tar.bz2 && \
cd nmap-7.31 && \
./configure && make && \
sudo checkinstall --pakdir "$HOME/Desktop/nmap_build" \
     --backup=no --deldoc=yes --pkgname nmap --pkgversion 7.31 \
     --fstrans=no --deldesc=yes --delspec=yes --default

Step 4:

On my system this shows:

andrew@athens:~$ nmap --version

Nmap version 7.31 ( https://nmap.org )
Platform: x86_64-unknown-linux-gnu
Compiled with: nmap-liblua-5.3.3 openssl-1.0.2g libpcre-8.38
               libpcap-1.7.4 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select
andrew@athens:~$ 

Hopefully this will also work well on your system :).

Solution 2

The configure script is asking for the location of the OpenSSL library headers and *.so files, not the openssl executable. On Ubuntu/Debian systems, you can install these headers by installing the libssl-dev package. If you install it this way, you do not have to provide the location to the configure script; it will find it on its own.

As another user pointed out, you can also run apt-get build-dep nmap to install all the prerequisites for building the nmap package, but this might be more than you want. Both will work.

Share:
7,194

Related videos on Youtube

Kiran
Author by

Kiran

Updated on September 18, 2022

Comments

  • Kiran
    Kiran almost 2 years

    I am running Ubuntu 16.04, and I am trying to install the latest nmap. I have a C compiler installed.

    I ran openssl version and found that this version was installed: OpenSSL 1.0.2g 1 Mar 2016

    I downloaded nmap 7.31 as a .bz2 file. I decompressed it. I ran the ./configure utility like this:

    ./configure --with-openssl=/usr/bin/openssl
    

    I received this message:

    ... configure: error: Your version of OpenSSL does not support
    SHA-256. Please install OpenSSL 0.9.8 or later. configure: error:
    ./configure failed for nping
    

    I ran whereis openssl and the result of the command confirmed my location was correct. If I run ./configure by itself, I get a warning about compiling nmap without openssl.

    WARNING: You are compiling without OpenSSL
    

    I try to use make afterward that and get

    make The program 'make' can be found in the following packages:  *
    make  * make-guile Try: apt install <selected package>
    

    If I try apt install, I get the local network nmap installation. I do not want that. I tried gmake, but I got this No command 'gmake' found.

    How do I install the latest nmap utility? I cannot run ./configure with the explicit designation of the OpenSSL location. I cannot run make after a normal "./configure" run.

    • steeldriver
      steeldriver over 7 years
      You probably just need to install the build-essential and libssl-dev packages and then ./configure without setting an explicit --with-openssl path (which is likely not a binary path anyhow)