openldap、keepalived源码编译、kerberos源码编译

开始编译前,可以先通过configure --help查看该软件都支持哪些参数,各个参数都有什么作用,如果缺少了必要的参数,编译出来的包可能会缺少某些功能。

编译bdb

编译bdb报错:
1、所执行命令:
../dist/configure --prefix=/opt/test/bdb

错误详情:

configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

原因:缺少编译工具。

解决方法:
安装gcc工具。
如x86下使用yum install -y gcc


继续执行命令:
../dist/configure --prefix=/opt/test/bdb

错误详情:
configure: error: cannot guess build type; you must specify one

解决方法:
需要指定编译环境:
如果是arm环境,需要指定arm-linux;
如果是x86环境,可以不用指定;
我本次是在arm环境编译的,所以需要指定arm-linux。
--build=arm-linux
--host=arm-linux

完整命令:
../dist/configure --prefix=/opt/test/bdb --build=arm-linux --host=arm-linux

2、make && make install
3、将部署目录的文件打包,做成解压可用的绿色版。

编译openldap

openldap的编译依赖于bdb,所以openldap编译前需要先编译好bdb。

1、所执行命令:
./configure --prefix=/home/security/software/openldap --enable-debug --enable-syslog --enable-proctitle --enable-ipv6 --enable-local --enable-modules --enable-bdb --enable-hdb --enable-ldap --enable-mdb --enable-overlays CPPFLAGS=-I/opt/test/bdb/include/ LDFLAGS=-L/opt/test/bdb/lib/ --libdir=/opt/test/bdb/lib/ --includedir=/opt/test/bdb/include/

编译报错,错误详情:
configure: error: could not locate libtool ltdl.h

解决:
安装 libtool-ltdl libtool-ltdl-devel就可以了。
arm环境,可以使用apt源安装;
x86环境,可以使用yum源安装。

其实这种做法是治标不治本的,当一个新环境没有安装libtool-ltdl libtool-ltdl-devel依赖时,则编译后的openldap的包还是会缺相关的依赖:

根本的解决方法是将libtool相关的依赖打到要编译的包里,openldap缺少libltdl.so文件的解决方法:
1)编译libtool源码,把编译后得到的libltdl.so文件拷贝到openldap包的指定目录下;
2)然后设置全局的环境变量export LD_LIBRARY_PATH="/xxx/xxx";
3)或者设置临时环境变量,但是需要在每次执行slapd命令之前都得重新定义一遍:export LD_LIBRARY_PATH="/xxx/xxx";
4)设置了环境变量后,再执行ldd openldap/libexec/slapd就可以正常找到libltdl.so文件了。

2、所执行命令:
./configure --prefix=/home/security/software/openldap --enable-debug --enable-syslog --enable-proctitle --enable-ipv6 --enable-local --enable-modules --enable-bdb --enable-hdb --enable-ldap --enable-mdb --enable-overlays CPPFLAGS=-I/opt/test/bdb/include/ LDFLAGS=-L/opt/test/bdb/lib/ --libdir=/opt/test/bdb/lib/ --includedir=/opt/test/bdb/include/

编译报错,错误详情:
checking for Berkeley DB library and header version match... Berkeley DB version mismatch
header: Berkeley DB 5.3.21: (May 11, 2012)
library: Berkeley DB 5.3.28: (September 9, 2013)
no
configure: error: Berkeley DB version mismatch

解决办法:
export LD_LIBRARY_PATH="/opt/test/bdb/lib"

3、之前编译openldap源码缺少密码策略模块的问题:
原因:缺少编译参数,如上命令configure过程添加--enable-overlays这个参数可以解决。

4、configure操作通过之后,执行命令:
make depend

5、执行:
make && make install

6、编译完成后,将安装目录下的文件全部打包,得到解压可用的绿色版组件包。


keepalived编译

1、./configure --prefix=/opt/xinghai/keepalived
注:本过程缺少参数,导致编译后日志配置不生效;需要加参数,所加参数为:--enable-log-file;
完整命令为:
./configure --prefix=/opt/xinghai/keepalived --enable-log-file
此处执行报错了:
关键错误:
“configure: error: libnfnetlink headers missing”
错误详情:
checking for nl_socket_modify_cb in -lnl... yes
checking for linux/rtnetlink.h... yes
checking libnfnetlink/libnfnetlink.h usability... no
checking libnfnetlink/libnfnetlink.h presence... no
checking for libnfnetlink/libnfnetlink.h... no
configure: error: libnfnetlink headers missing
解决方法:
安装libnfnetlink-devel依赖;
arm环境选择apt源安装;
x86环境选择yum源安装;
如果不想通过源安装,可自行下载rpm包安装。

2、make && make install

3、编译完成后,将安装目录下的文件全部打包,得到解压可用的绿色版组件包。


kerberos源码编译

1、./configure --prefix=/home/security/software/kerberos --enable-dns-for-realm
--enable-dns-for-realm 支持ipv6的解析

2、make && make install

3、编译完成后,将安装目录下的文件全部打包,得到解压可用的绿色版组件包。

你可能感兴趣的:(openldap、keepalived源码编译、kerberos源码编译)