首先下载keepalived-2.0.7,地址http://www.keepalived.org/download.html
接下来解压keepalived-2.0.7.tar.gz
tar -xzpvf keepalived-2.0.7.tar.gz
cd keepalived-2.0.7
目录中有个INSTALL的文件,我们先打开。可以看到如果是red hat系列的linux,需要安装一些包。对于file-devel、 net-snmp-devel、net-snmp-devel、glib2-devel、json-c-devel、pcre2-devel以及后面说的一些包,都是根据特定的需求需要安装的一些包,根据需要安装。
Library dependencies
====================
In order to compile Keepalived needs the following libraries :
* OpenSSL, <www.openssl.org>
Linux flavours
==============
RedHat based systems (RedHat Enterprise/CentOS/Fedora)
------------------------------------------------------
The following libraries need to be installed:
openssl-devel libnl3-devel ipset-devel iptables-devel libnfnetlink-devel
For magic file identification support:
file-devel
For SNMP support:
net-snmp-devel
For DBUS support:
glib2-devel
For JSON support:
json-c-devel
For PCRE support
pcre2-devel
For building the documentation, the following packages need to be installed:
Fedora: python-sphinx (will pull in: python2-sphinx_rtd_theme)
CentOS-and-friends: python-sphinx epel-release python-sphinx_rtd_theme
For latex or pdf files, the following are also needed:
Fedora: latexmk python-sphinx-latex
CentOS-and-friends: latexmk texlive texlive-titlesec texlive-framed texlive-threeparttable texlive-wrapfig texlive-multirow
主要的,编译过程中需要gcc编译器,我这里gcc的版本是gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)。如果是较低的版本,可能有问题。打包rpm需要rpmbuild这个工具,也需要安装rpm-build-4.11.3-32.el7.x86_64。
先看看configure有哪些选项,下面这些选项大家根据自己需要选择,通常默认的就可以满足需求了。
需要重点说一下的就是最后的Some influential environment variables的部分,这里是通过设置环境变量来影响configure的过程。主要的可以设置CC这个env。例如export CC=g++ 。
`configure' configures Keepalived 2.0.7 to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all