当前位置: 首页 > 工具软件 > IPsec Tools > 使用案例 >

How to install ipsec-tools on RHEL6

刘博文
2023-12-01

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.

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%]



 类似资料:

相关阅读

相关文章

相关问答