一、安装GCC、GCC-G++、GDB(为了方便调试时间使用):
yum install gcc
yum install gcc-g++
yum install gdb
wget http://nmap.org/dist/nmap-7.80.tar.bz2
tar -jxvf nmap-7.80.tar.bz2
cd nmap-7.80
二、编译安装
./configure
make
make install
若想自己设定目录可以这样查看其configure的帮助:
[root@localhost nmap-6.01]# ./configure -help
Usage: ./configure [OPTION]... [VAR=VALUE]...
Configuration:
-h, --help 显示帮助并退出
--help=short 显示nmap的特定选项
--help=recursive 对包含的包进行简短的介绍-V, --version 显示版本信息并退出
-q, --quiet, --silent 不显示检测信息
--cache-file=FILE 在FILE中显示检测结果-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create 不创建输出文件--srcdir=DIR 源码目录
Installation directories:
--prefix=PREFIX 设置安装目录,安装目录默认为[/usr/local]
--exec-prefix=EPREFIX 安装独立的可执行文件目录
默认情况下, `make install' 将安装所有的文件到`/usr/local/bin', `/usr/local/lib'
--bindir=DIR 用户执行目录[EPREFIX/bin]
--sbindir=DIR 系统管理员执行目录 [EPREFIX/sbin]
--libexecdir=DIR 程序执行目录 [EPREFIX/libexec]
--sysconfdir=DIR 只读的配置文件 [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR 库目录 [EPREFIX/lib]
--includedir=DIR 头文件目录 [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-nls do not use Native Language Support
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-localdirs Explicitly ask compiler to use
/usr/local/{include,libs} if they exist
--without-ndiff Skip installation of the Ndiff utility
--without-zenmap Skip installation of the Zenmap graphical frontend
--without-nping Skip installation of the Nping utility
--with-openssl=DIR Use optional openssl libs and includes from
[DIR]/lib/ and [DIR]/include/openssl/)
--with-libpcap=DIR Look for pcap in DIR/include and DIR/libs.
--with-libpcap=included Always use version included with Nmap
--with-libpcre=DIR Use an existing (compiled) pcre lib from DIR/include
and DIR/lib.
--with-libpcre=included Always use the version included with Nmap
--with-libdnet=DIR Use an existing (compiled) dnet lib from DIR/include
and DIR/lib. This is NOT RECOMMENDED because we have
made many important fixes to our included libdnet,
as described at
http://nmap.org/svn/libdnet-stripped/NMAP_MODIFICATIONS
--with-libdnet=included Use the libdnet version included with Nmap (default)
--with-liblua=DIR Use an existing (compiled) lua lib from DIR/include
and DIR/lib.
--with-liblua=included Use the liblua version included with Nmap
--without-liblua Compile without lua (this will exclude all of NSE
from compilation)
--with-liblinear=DIR Use an existing (compiled) liblinear from
DIR/include and DIR/lib.
--with-liblinear=included
Use the liblinear version included with Nmap
--with-libnbase=DIR Look for nbase include/libs in DIR
--with-libnsock=DIR Compile and link to libnsock in DIR
--without-ncat Skip build and installation of Ncat
--without-nmap-update Skip build and installation of nmap-update
--with-apr=PATH prefix for installed APR or the full path to
apr-config
--with-subversion=DIR Look for libsvn1 in DIR/include and DIR/libs.
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CPP C preprocessor
PYTHON the Python interpreter