OpenLDAP是輕型目錄訪問協議(Lightweight Directory Access Protocol,LDAP)的自由和開源的實現,在其OpenLDAP許可證下發行,並已經被包含在衆多流行的Linux發行版中。數據庫
在Centos6.4用yum方式安裝openldap。app
1.使用yum命令安裝openldap,openldap-servers,openldap-clients測試
$ yum install openldap加密 $ yum install openldap-serversspa $ yum install openldap-clientsserver |
2.安裝完後,拷貝/usr/share/openldap-servers/slapd.conf.obsolete到/etc/openldap/slapd.confci
$cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.confit |
3.進入/etc/openldap 下修改slapd.conf文件。table
修改dc:class
suffix "dc=fire,dc=com" rootdn "cn=Manager,dc=fire,dc=com" |
修改rootpw,採用 # slappasswd -s '123456' 命令 獲得加密的密碼 :
{SSHA}BPZTqpJR5RBlP3h/Gn0kJwZPJv9NaAFT
#rootpw secret rootpw {SSHA}BPZTqpJR5RBlP3h/Gn0kJwZPJv9NaAFT |
4.刪除/ect/openldap/slapd.d下全部文件, 使用如下命令,從新生成slapd.d
$rm –fr /etc/openldap/slapd.d/* $slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d |
解釋:OpenLDAP的再也不讀取從/ etc / openldap的/ slapd.conf文件的配置。在更換使用位於在/ etc / openldap的/ slapd.d /目錄中的配置數據庫。若是你有之前安裝之前的slapd.conf文件能夠轉換爲新的格式使用如下命令: slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
5.經過chown -R命令修改權限
$chown -R ldap. slapd.d |
6.拷貝數據庫配置文件(可能須要)
$cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG |
7.啓動
Service slapd start |
8.測試
$ldapsearch -x -D "cn=Manager,dc=fire,dc=com" -w '123456' -b "dc=fire,dc=com"
# extended LDIF # # LDAPv3 # base <dc=fire,dc=com> with scope subtree # filter: (objectclass=*) # requesting: ALL #
# search result search: 2 result: 32 No such object
# numResponses: 1
|
9.完工。