分类:
2008-07-20 22:58:06
Openldap2.0.25 install in AS2.1
、Openldap2.0.25安装
./configure --prefix=/home/openldap --with-ldbm-api=gdbm
./make
./make intall
我测试机的sldap.conf需要添加如下:
include /usr/local/openldap/etc/openldap/schema/core.schema
include /usr/local/openldap/etc/openldap/schema/cosine.schema
include /usr/local/openldap/etc/openldap/schema/inetorgperson.schema
#上面两项在编译完生成的slapd.conf中是没有添加的,所以需要我们手工添加。
#因为下面的例子不如的objectClass:inetOrgPerson是在inetorgperson.schema中定义的,所以如果不在此处include加入的话,在导入ldif文件的时候会提示不识别inetOrgPerson这个属性的。
#######################################################################
# ldbm database definitions
#######################################################################
database ldbm
suffix "dc=stooges,dc=com"
rootdn "cn=Manager,dc=stooges,dc=com"
rootpw secret
directory /var/lib/ldap/stooges
lastmod on
并且stooges.ldif文件内容为:
dn: dc=stooges,dc=com
objectClass:dcObject
objectClass: organization
o: stooges
dc: stooges
description: this is stooges domain
dn: uid=bbb,dc=stooges,dc=com
objectClass: Person
objectClass: inetOrgPerson
uid: bbb
sn: bbb
cn: bbb
telephoneNumber: 111-111-111
mail: bbb@stooges.com
dn: uid=ccc,dc=stooges,dc=com
objectClass: Person
objectClass: inetOrgPerson
uid: ccc
sn: ccc
cn: ccc
telephoneNumber: 222-111-111
[root@oradb openldap]#libexec/slapd 启动slapd进程,只有启动进程后,才可以看ldap中添加数据库
[root@oradb openldap]#ps -ef | grep slapd
[root@oradb openldap]# ps -ef | grep slapd
root 27461 1 0 21:32 ? 00:00:00 libexec/slapd
root 27462 27461 0 21:32 ? 00:00:00 libexec/slapd
root 27463 27462 0 21:32 ? 00:00:00 libexec/slapd
root 27465 27462 0 21:32 ? 00:00:00 libexec/slapd
root 27466 27462 0 21:32 ? 00:00:00 libexec/slapd
root 27474 6419 0 21:36 pts/0 00:00:00 grep slapd
[root@oradb openldap]# bin/ldapadd -f stooges.ldif -W -x -D 'cn=Manager,dc=stooges,dc=com' 将数据添加到ldap数据库中
Enter LDAP Password:
adding new entry "dc=stooges,dc=com"
adding new entry "uid=bbb,dc=stooges,dc=com"
adding new entry "uid=ccc,dc=stooges,dc=com"
[root@oradb openldap]#
#ldpasearch -LLL -b 'dc=stooges,dc=com' -W -x
查询数据库的内容
[root@oradb openldap]# bin/ldapsearch -LLL -b 'dc=stooges,dc=com' -W -x
Enter LDAP Password:
dn: dc=stooges,dc=com
objectClass: dcObject
objectClass: organization
o: stooges
dc: stooges
description: this is stooges domain
dn: uid=bbb,dc=stooges,dc=com
objectClass: Person
objectClass: inetOrgPerson
uid: bbb
sn: bbb
cn: bbb
telephoneNumber: 111-111-111
mail: bbb@stooges.com
dn: uid=ccc,dc=stooges,dc=com
objectClass: Person
objectClass: inetOrgPerson
uid: ccc
sn: ccc
cn: ccc
telephoneNumber: 222-111-111
mail: ccc@stooges.com
[root@oradb openldap]#