背景
LDAP听上去耳熟能详,可真要用Java去写一个通用性高的数据同步服务好像需要了解的东西又得特别多,能查到的东西又多是断章取义。最近断断续续的折腾了3周,基本上搞了一个这玩意,打算陆续分享给大家吧,由于相关东西不是一篇能讲完的,所以打算搞个小专题吧,希望给喜欢抄作业的朋友们有所帮助。
首先分享LDAP的部署,关于OpenLDAP部署的文章一搜一大把,但是出于运气不佳(你所找到文章本身描述的不全或者断章取义)很可能不能完全走下去或者碰到各种问题,这里我写一个step by step的小白手册给大家吧(要是按照这种程度的文档还部署不出来,那我也没有办法了,我按照小白角度去写的),以下步骤和内容我也是折腾了2天,综合了好几篇文章所走出的安装步骤,为了写这篇文章,我刻意重置了服务器从0开始进行了再次部署(有时候很想吐槽,为啥每次我搜到的文章,需要折腾几次还不一定成功,既然要分享出来,为什么不能详细和透彻简单些呢?)。
原创不易、打字不易、贴图不易、整理不易,动动你发财的小手点赞不易。
1 安装OpenLDAP
openldap涉及到以下东东:
yum list all | grep openldap
1.1 OpenLDAP及相关组件安装
yum install -y openldap openldap-servers openldap-clients compat-openldap openldap-devel migrationtools
备注:
1、安装目录:/etc/openldap
2、从OpenLDAP 2.4.x下已废弃slapd.conf文件,而配置文件被目录slapd.d所取代,slapd.d中的配置不建议手工修改,建议的方式是重新生成;
1.2 设置管理员密码
slappasswd
备注:
1、密码密文有盐,因此相同明文密码的密文每次都不相同。
2、密码密文记录下来,后续配置需要用到。
1.3 配置LDAP服务
1.3.1 备份slapd.d
mv slapd.d slapd.d.bak
mkdir slapd.d
1.3.2 定义slapd.ldif
cp -r /usr/share/openldap-servers/slapd.ldif /etc/openldap
vi slapd.ldif
line 83改为
include: file:///etc/openldap/schema/core.ldif
include: file:///etc/openldap/schema/collective.ldif
include: file:///etc/openldap/schema/corba.ldif
include: file:///etc/openldap/schema/cosine.ldif
include: file:///etc/openldap/schema/duaconf.ldif
include: file:///etc/openldap/schema/dyngroup.ldif
include: file:///etc/openldap/schema/inetorgperson.ldif
include: file:///etc/openldap/schema/java.ldif
include: file:///etc/openldap/schema/misc.ldif
include: file:///etc/openldap/schema/nis.ldif
include: file:///etc/openldap/schema/openldap.ldif
include: file:///etc/openldap/schema/pmi.ldif
include: file:///etc/openldap/schema/ppolicy.ldif
备注: