Openldap2.0.25 install in AS2.1,比較老的學習文件了.

yj11發表於2008-07-09

Openldap2.0.25 install in AS2.1

[@more@]

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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/1806527/viewspace-1007048/,如需轉載,請註明出處,否則將追究法律責任。

相關文章