How to install ipsec-tools on RHEL6

My Host Environment.

[root@NUT ~]# uname -r
2.6.32-563.el6.x86_64

On RHEL6, the binary ipsec-tools rpm package may not be available. You could follow the step before to build the ipsec-tools rpm package from the Source RPM package first and then use the rpm command to install the binary package.

Contents

  • 1Set up the rpm build environment
  • 2Download the Source ipsec-tools RPM package
  • 3Install the Source ipsec-tools RPM
  • 4Edit the ipsec-tools.spec file
  • 5Build the binary ipsec-tools RPM package
    • 5.1do the rpmbuild again
  • 6Installing the binary ipsec-tools rpm package

Set up the rpm build environment

  • install the rpm-build rpm package
yum install rpm-build
  • install the development environment
yum groupinstall Development

Download the Source ipsec-tools RPM package

Or any other mirror site.

Install the Source ipsec-tools RPM

  • cd to the download directory and run the rpm command to install:
rpm -ivh ipsec-tools-0.8.0-1.fc15.src.rpm

Note: To build the binary ipsec-tools for CentOS 6.4, you must use the above version. Newer version will need the flex-static and systemd-unit which are not available on RHEL6.

Go to the ~/rpmbuild directory and cd to SPECS directory for the ipsec-tools.spec file.

Edit the ipsec-tools.spec file

Remove the word "flex-static" from line 32 in the ipsec-tools.spec file.

Build the binary ipsec-tools RPM package

cd to the SPECS directory and run the following command:

rpmbuild -ba ipsec-tools.spec

If you got the following warning, you need to install the required packages in order to build the ipsec-tools binary:

[rchan@NUT SPECS]$ rpmbuild -ba ipsec-tools.spec 
error: Failed build dependencies:
	openssl-devel is needed by ipsec-tools-0.8.0-1.el6.x86_64
	krb5-devel is needed by ipsec-tools-0.8.0-1.el6.x86_64
	bison is needed by ipsec-tools-0.8.0-1.el6.x86_64
	flex is needed by ipsec-tools-0.8.0-1.el6.x86_64
	flex-static is needed by ipsec-tools-0.8.0-1.el6.x86_64
	automake is needed by ipsec-tools-0.8.0-1.el6.x86_64
 	libtool is needed by ipsec-tools-0.8.0-1.el6.x86_64
	libselinux-devel >= 1.30.28-2 is needed by ipsec-tools-0.8.0-1.el6.x86_64
	pam-devel is needed by ipsec-tools-0.8.0-1.el6.x86_64
	audit-libs-devel >= 1.3.1 is needed by ipsec-tools-0.8.0-1.el6.x86_64

As root, run the following command to install the required rpms:

yum install openssl-devel krb5-devel bison flex automake libtool libselinux-devel pam-devel audit-libs-devel

do the rpmbuild again

[rchan@NUT SPECS]$ rpmbuild -ba ipsec-tools.spec 

<snipped>

Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(post): /bin/sh chkconfig
Requires(preun): /bin/sh chkconfig initscripts
Requires: /bin/bash /bin/sh libaudit.so.1()(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libcrypt.so.1()(64bit) libcrypt.so.1(GLIBC_2.2.5)(64bit) libcrypto.so.10()(64bit) libgssapi_krb5.so.2()(64bit) libgssapi_krb5.so.2(gssapi_krb5_2_MIT)(64bit) libpam.so.0()(64bit) libpam.so.0(LIBPAM_1.0)(64bit) libresolv.so.2()(64bit) libresolv.so.2(GLIBC_2.2.5)(64bit) librt.so.1()(64bit) librt.so.1(GLIBC_2.2.5)(64bit) libselinux.so.1()(64bit) rtld(GNU_HASH)
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/rchan/rpmbuild/BUILDROOT/ipsec-tools-0.8.0-1.el6.x86_64
warning: Could not canonicalize hostname: NUT
Wrote: /home/rchan/rpmbuild/SRPMS/ipsec-tools-0.8.0-1.el6.src.rpm
Wrote: /home/rchan/rpmbuild/RPMS/x86_64/ipsec-tools-0.8.0-1.el6.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.kLmFKI
+ umask 022
+ cd /home/rchan/rpmbuild/BUILD
+ cd ipsec-tools-0.8.0
+ rm -rf /home/rchan/rpmbuild/BUILDROOT/ipsec-tools-0.8.0-1.el6.x86_64
+ exit 0
[rchan@NUT SPECS]$ 

Note: you may meet the flowing issue:
      src/setkey/token.c:1903: undefined reference to `yywrap'

Fix: 1) Download the flex source 
        Go to http://sourceforge.net/projects/flex/files/
        Better download the same version with flex that have installed.

     2) Compile/Build 
        Decompression the pkg, then compile/build the source code
        # ./confgure && make
        # cp libfl.a /lib

Installing the binary ipsec-tools rpm package

cd ~/rpmbuild/RPMS/x86_64     (for 64 bits system)
[root@NUT x86_64]# ls -l
total 1368
-rw-r--r--. 1 root root 399888 Jun 19 16:34 ipsec-tools-0.8.0-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 997104 Jun 19 16:34 ipsec-tools-debuginfo-0.8.0-1.el6.x86_64.rpm

Switch to "root" and install the rpm package:

[root@NUT ~]# cd /root/rpmbuild/RPMS/x86_64/
[root@NUT x86_64]# ls
ipsec-tools-0.8.0-1.el6.x86_64.rpm
[root@NUT x86_64]# rpm -ivh ipsec-tools-0.8.0-1.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:ipsec-tools            ########################################### [100%]



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值