keepalived入门之编译安装(2)
上一节我们讲到了keepalived的基本介绍以及其工作原理及相关组成部分,本小节,我们将会讲到keepalived的相关./configure,编译,安装等介绍
一. 编译安装keepalived
1.1 keepalived的源码获取
keepalived源码包我们可以到keepalived的官网:http://www.keepalived.org/去下载,相关说明文档亦可在其官网查看,比如keepalived的使用,相关配置说明,这里演示的版本为:1.2.15
# wget http://www.keepalived.org/software/keepalived-1.2.15.tar.gz
1.2 安装keepalived的依赖包
下载后keepalived源码包后,我们还需要安装keepalived依赖的依赖包,比如:openssl, popt
# yum install opensslopenssl-develpopt popt-devel
1.3 编译,安装keepalived
# tar zxvf keepalived-1.2.15.tar.gz -C /usr/local/src
# cd /usr/local/src/keepalived-1.2.15/
# ./configure \
--prefix=/usr/local/keepalived \
--sbindir=/usr/local/keepalived/sbin
# make
# make install
# cp /usr/local/keepalived/sbin/keepalived /usr/sbin/
# cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
# cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
# chkconfig --add keepalived
# chkconfig --level 2345 keepalived on
# mkdir -p /etc/keepalived
# cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived
备注说明:
1.keepalived安装完成后,安装目录为:/usr/lccal/keepalived, 配置文件路径为:/etc/keepalive/
2.安装完成后,需要将启动脚本复制到/etc/ini.d/下
3.注意一定要执行述上的相关操作,不然有可能导致keepalived服务起不来
4.关于keepalived相关./configure等参数我们可以利用:./configure --help来查看,以下为keepalived的./configure相关参数说明如下
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking ...' messages
--cache-file=FILE cache test results in FILE
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables
--sbindir=DIR system admin executables
--libexecdir=DIR program executables
--sysconfdir=DIR read-only single-machine data
--sharedstatedir=DIR modifiable architecture-independent data
--localstatedir=DIR modifiable single-machine data
--libdir=DIR object code libraries
--includedir=DIR C header files
--oldincludedir=DIR C header files for non-gcc
--datarootdir=DIR read-only arch.-independent data root
--datadir=DIR read-only architecture-independent data
--infodir=DIR info documentation
--localedir=DIR locale-dependent data
--mandir=DIR man documentation
--docdir=DIR documentation root
--htmldir=DIR html documentation
--dvidir=DIR dvi documentation
--pdfdir=DIR pdf documentation
--psdir=DIR ps documentation
Optional Features:
--disable-option-checkingignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG]include FEATURE
--disable-lvs-syncd do not use LVS synchronization daemon
--disable-lvs do not use the LVS framework
--disable-vrrp do not use the VRRP framework
--disable-fwmark compile without SO_MARK support
--enable-snmp compile with SNMP support
--enable-sha1 compile with SHA1 support
--enable-debug compile with debugging flags
--enable-profile compile with profiling flags
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-kernel-dir=DIR path to linux kernel source directory
--with-kernel-version=VER forced value for linux kernel version (VER=2.4|2.6)
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CPP C preprocessor
二:启动keepalived服务
# service keepalived start
如果keepalived已经启动,这时我们就可以查看以下命令查看启动情况:
# service keepalived status
或
# ps aux | grep keepalived
到这里,keepalived部署基本OK,下一章,我们将会讲到keepalived相关配置
页:
[1]