ipvsadm 1.26适用于kernel 2.6.28及之后的内核版本。
如果你要在CentOS 5.X上编译安装ipvsadm,只能下载安装1.24的
我的系统环境是安装了开发工具和开发库的,所以不存在gcc没安装的情况。CentOS 5.x也是如此
1、安装依赖包及创建
yum check-update
yum -y install libnl* popt*
2、下载ipvsadm 1.26
wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.26.tar.gz
For CentOS 5.x
wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.24.tar.gz
3、解压下载回来的包
ln -s /usr/src/kernels/2.6.32-71.el6.x86_64/ /usr/src/linux
tar zxf ipvsadm-1.26.tar.gz
cd ipvsadm-1.26
make && make install
安装完后默认将ipvsadm启动脚本安装在/etc/init.d/下,其它的可执行文件在
ipvsadm /sbin
ipvsadm-save /sbin
ipvsadm-restore /sbin
————————————————————————————————————————————————————————————————————————————
[root@osg work]# wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.26.tar.gz
--2012-08-03 08:45:25-- http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.26.tar.gz
Resolving www.linuxvirtualserver.org... 69.56.251.119, 2001:470:1f0f:297::2
Connecting to www.linuxvirtualserver.org|69.56.251.119|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 41700 (41K) [application/x-gzip]
Saving to: “ipvsadm-1.26.tar.gz”
100%[======================================>] 41,700 38.9K/s in 1.0s
2012-08-03 08:45:27 (38.9 KB/s) - “ipvsadm-1.26.tar.gz” saved [41700/41700]
[root@osg work]# ln -s /usr/src/kernels/2.6.32-71.el6.x86_64/ /usr/src/linux
[root@osg work]#
[root@osg work]# tar zxf ipvsadm-1.26.tar.gz
[root@osg work]# cd ipvsadm-1.26
[root@osg ipvsadm-1.26]# make && make install
make -C libipvs
make[1]: Entering directory `/usr/local/work/ipvsadm-1.26/libipvs'
gcc -Wall -Wunused -Wstrict-prototypes -g -fPIC -DLIBIPVS_USE_NL -DHAVE_NET_IP_VS_H -c -o libipvs.o libipvs.c
gcc -Wall -Wunused -Wstrict-prototypes -g -fPIC -DLIBIPVS_USE_NL -DHAVE_NET_IP_VS_H -c -o ip_vs_nl_policy.o ip_vs_nl_policy.c
ar rv libipvs.a libipvs.o ip_vs_nl_policy.o
ar: creating libipvs.a
a - libipvs.o
a - ip_vs_nl_policy.o
gcc -shared -Wl,-soname,libipvs.so -o libipvs.so libipvs.o ip_vs_nl_policy.o
make[1]: Leaving directory `/usr/local/work/ipvsadm-1.26/libipvs'
gcc -Wall -Wunused -Wstrict-prototypes -g -DVERSION=\"1.26\" -DSCHEDULERS=\""rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq"\" -DPE_LIST=\""sip"\" -DHAVE_POPT -DHAVE_NET_IP_VS_H -c -o ipvsadm.o ipvsadm.c
gcc -Wall -Wunused -Wstrict-prototypes -g -DVERSION=\"1.26\" -DSCHEDULERS=\""rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq"\" -DPE_LIST=\""sip"\" -DHAVE_POPT -DHAVE_NET_IP_VS_H -c -o config_stream.o config_stream.c
gcc -Wall -Wunused -Wstrict-prototypes -g -DVERSION=\"1.26\" -DSCHEDULERS=\""rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq"\" -DPE_LIST=\""sip"\" -DHAVE_POPT -DHAVE_NET_IP_VS_H -c -o dynamic_array.o dynamic_array.c
gcc -Wall -Wunused -Wstrict-prototypes -g -o ipvsadm ipvsadm.o config_stream.o dynamic_array.o libipvs/libipvs.a -lpopt -lnl
make -C libipvs
make[1]: Entering directory `/usr/local/work/ipvsadm-1.26/libipvs'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/local/work/ipvsadm-1.26/libipvs'
if [ ! -d /sbin ]; then mkdir -p /sbin; fi
install -m 0755 ipvsadm /sbin
install -m 0755 ipvsadm-save /sbin
install -m 0755 ipvsadm-restore /sbin
[ -d /usr/man/man8 ] || mkdir -p /usr/man/man8
install -m 0644 ipvsadm.8 /usr/man/man8
install -m 0644 ipvsadm-save.8 /usr/man/man8
install -m 0644 ipvsadm-restore.8 /usr/man/man8
[ -d /etc/rc.d/init.d ] || mkdir -p /etc/rc.d/init.d
install -m 0755 ipvsadm.sh /etc/rc.d/init.d/ipvsadm
[root@osg ipvsadm-1.26]# ipvsadm -version
ipvsadm v1.26 2008/5/15 (compiled with popt and IPVS v1.2.1)
[root@osg ipvsadm-1.26]#