Depending on the Linux distro you are using, you will use either apt-get or yum to install Nmap.
apt-get install nmap yum install nmap
After the install has completed, the following command can be used to verify that nmap is working. This command will show which ports are open.
nmap -sT -O localhost