You can check whether nmap has been installed in your system using apt-get command or check installed database using aptitude command. Enter nmap in the command line terminal, and if you get answer like an example below, that means nmap hasn't been installed in your system.
luzar@ubuntu:~$ nmap
The program 'nmap' is currently not installed.
You can install it by typing:
sudo apt-get install nmap
-bash: nmap: command not found
You can follow Ubuntu advice, install nmap using apt-get install nmap or using your favorite package management. Below is an example of apt-get install nmap command:
luzar@ubuntu:~$ sudo apt-get install nmap
[sudo] password for luzar:Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed: nmap
0 upgraded, 1 newly installed, 0 to remove and 9 not upgraded.
Need to get 1013kB of archives.
After this operation, 3506kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com hardy/main nmap 4.53-3 [1013kB]
Get:2 http://us.archive.ubuntu.com hardy/main nmap 4.53-3 [1013kB]
Get:3 http://us.archive.ubuntu.com hardy/main nmap 4.53-3 [1013kB]
Get:4 http://us.archive.ubuntu.com hardy/main nmap 4.53-3 [1013kB]
Get:5 http://us.archive.ubuntu.com hardy/main nmap 4.53-3 [1013kB]
Fetched 129kB in 18min56s (114B/s)
Selecting previously deselected package nmap.
(Reading database ... 28764 files and directories currently installed.)
Unpacking nmap (from .../archives/nmap_4.53-3_i386.deb) ...
Setting up nmap (4.53-3) ...
The nmap package has been successfully installed in your system. If you enter nmap command again, you'll get a long list of help like an example below:
luzar@ubuntu:~$ nmap
Nmap 4.53 ( http://insecure.org )
Usage: nmap [Scan Type(s)] [Options] {target specification}
TARGET SPECIFICATION: Can pass hostnames, IP addresses, networks, etc.
Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254
-iL: Input from list of hosts/networks
-iR: Choose random targets
--exclude: Exclude hosts/networks
--excludefile: Exclude list from file
HOST DISCOVERY:
-sL: List Scan - simply list targets to scan
-sP: Ping Scan - go no further than determining if host is online
-PN: Treat all hosts as online -- skip host discovery
-PS/PA/PU [portlist]: TCP SYN/ACK or UDP discovery to given ports
-PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes
-PO [protocol list]: IP Protocol Ping
-n/-R: Never do DNS resolution/Always resolve [default: sometimes]
--dns-servers: Specify custom DNS servers
--system-dns: Use OS's DNS resolver
That's good. The nmap is already in our system. Now, try scan your own server to see whether it really works:
luzar@ubuntu:~$ nmap -v -A 10.21.35.160
Starting Nmap 4.53 ( http://insecure.org ) at 2011-05-18 22:35 EST
Initiating Ping Scan at 22:35Scanning 192.168.1.6 [1 port]
Completed Ping Scan at 22:35, 0.03s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 22:35
Completed Parallel DNS resolution of 1 host. at 22:35, 0.00s elapsed
Initiating Connect Scan at 22:35
Scanning a3-musang.hitam.com (192.168.1.6) [1714 ports]
Discovered open port 22/tcp on 192.168.1.6
Discovered open port 443/tcp on 192.168.1.6
Discovered open port 80/tcp on 192.168.1.6
...
...
...
Service Info: OS: Windows
Read data files from: /usr/share/nmap
Service detection performed.
Please report any incorrect results at http://insecure.org/nmap/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 249.926 seconds
luzar@ubuntu:~$