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.完工。