分类:
2010-10-22 17:31:34
---------第二步:安装 BDB from db-4.5.20.tar.gz
#因为安装openldap之前要安装BDB,解决BerkeleyDB not available的问题
#下载地址:
#下载内容:db-4.5.20.tar.gz
tar –zxvpf db-4.5.20.tar.gz
cd db-4.5.20
cd build_unix
../dist/configure
make
make install
env CPPFLAGS="-I /usr/local/BerkeleyDB.4.5/include" LDFLAGS="-L /usr/local/BerkeleyDB.4.5/lib"
------第三步:安装openldap:在openldap官网上下载tar包
tar -zxvpf openldap-stable-20100719.tgz
cd openldap-2.4.23
./configure --prefix=/usr/local/openldap --enable-ldbm
#提示:configure: error: BDB/HDB: BerkeleyDB not available
#解决:copy: /usr/local/BerkeleyDB.4.3/include to: /usr/include
copy: /usr/local/BerkeleyDB.4.3/lib to: /usr/lib
./configure --prefix=/usr/local/openldap --enable-ldbm
#提示:Please run "make depend" to build dependencies 后执行下面的命令。
make depend
make
make test
提示:
>>>>> ./scripts/test019-syncreplication-cascade failed for hdb (exit 1)
make[2]: *** [hdb-yes] Error 1
make[2]: Leaving directory `/qingfeng_setup/2.4.23_linux/openldap-2.4.23/tests'
make[1]: *** [test] Error 2
make[1]: Leaving directory `/qingfeng_setup/2.4.23_linux/openldap-2.4.23/tests'
make: *** [test] Error 2
不用理,继续安装
make install
------第四步:启动openldap,测试是否能启动成功
/usr/local/openldap/libexec/slapd -d 256
/usr/local/openldap/bin/ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts
/usr/local/openldap/bin/ldapsearch -h localhost "objectClass=*"
------第五步:配置openldap,增加你自己的schema
#配置文件目录:/usr/local/openldap/etc/openldap/slapd.conf
#schema顺序:
include /usr/local/openldap/etc/openldap/schema/core.schema
include /usr/local/openldap/etc/openldap/schema/corba.schema
include /usr/local/openldap/etc/openldap/schema/cosine.schema
include /usr/local/openldap/etc/openldap/schema/inetorgperson.schema
include /usr/local/openldap/etc/openldap/schema/misc.schema
include /usr/local/openldap/etc/openldap/schema/openldap.schema
include /usr/local/openldap/etc/openldap/schema/nis.schema
include /usr/local/openldap/etc/openldap/schema/你自己的.schema
修改:suffix "你自己的suffix"
修改: rootdn "你自己的rootdn"
-----第六步:重启openldap,添加数据
/usr/local/openldap/libexec/slapd -d 256
#添加内容
/usr/local/openldap/bin/ldapadd -x -D "你自己的rootdn" -W -f /qingfeng_setup/2.4.23_linux/XX.ldif
#停止防火墙,如果不停止,是连接不上ldap的,在每次启动linux后都要停止防火墙
/etc/rc.d/init.d/iptables stop
#可以使用我们平常用的jxplore工具连接openldap
#ifconfig 查看ip ,端口:389 ,suffix和rootdn参看配置文件slapd.conf中设置
------第七步:设定固定ip
#路径:/etc/sysconfig/network-scripts/ifcfg-eth0 增加下面的内容
#注意:BOOTPROTO这个属性原来是有值的,需要改一下。
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.1
NETMASK=255.255.255.0
GATEWAY=192.168.0.3
#改后要重新加载 eth0
ifconfig eth0 down
ifconfig eth0 up
/etc/init.d/network restart
重启后发现ip没变就达到效果