OpenLDAP服务端+PhpLdapAdmin 基本安装与配置

转载:http://blog.csdn.net/post_yuan/article/details/53129735


参考了一些其他人写的一些关于安装配置OpenLDAP的文章,于是乎手痒痒也自己动手尝试了一下安装与配置OpenLDAP,并安装PhpLdapAdmin用来通过WEB界面去管理LDAP。

下面就详细介绍如何一步步安装配置LDAP服务器,仅供参考~


1 yum安装OpenLDAP

[html]  view plain  copy
  1. <span style="font-size:14px;">[root@ha-3 yum.repos.d]# yum install openldap openldap-* -y  
  2. [root@ha-3 yum.repos.d]# rpm -qa | grep openldap  
  3. openldap-servers-2.4.40-12.el6.x86_64  
  4. openldap-devel-2.4.40-12.el6.x86_64  
  5. openldap-servers-sql-2.4.40-12.el6.x86_64  
  6. openldap-clients-2.4.40-12.el6.x86_64  
  7. openldap-2.4.40-12.el6.x86_64  
  8. </span>  

2 配置ldap,包括准备DB_CONFIG和slapd.conf

[html]  view plain  copy
  1. <span style="font-size:14px;">[root@ha-3 yum.repos.d]# cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG  
  2. [root@ha-3 yum.repos.d]# cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf</span>  

3 生成ldap管理员密码

[html]  view plain  copy
  1. <span style="font-size:14px;">[root@ha-3 yum.repos.d]# slappasswd -s ldap123  
  2. {SSHA}iVje00GFFMDTkymLvxTF3lA7aRgiWRwZ</span>  

4 修改slapd.conf,主要配置dc和rootpw,rootpw配置为上述步骤中的密码

[html]  view plain  copy
  1. <span style="font-size:14px;">database        bdb  
  2. suffix          "dc=esgyn,dc=com"  
  3. checkpoint      1024 15  
  4. rootdn          "cn=Manager,dc=esgyn,dc=com"  
  5. # Cleartext passwords, especially for the rootdn, should  
  6. # be avoided.  See slappasswd(8) and slapd.conf(5) for details.  
  7. # Use of strong authentication encouraged.  
  8. # rootpw                secret  
  9. # rootpw                {crypt}ijFYNcSNctBYg  
  10. rootpw                  {SSHA}iVje00GFFMDTkymLvxTF3lA7aRgiWRwZ</span>  

5 检测并重新生成ldap数据库

[html]  view plain  copy
  1. <span style="font-size:14px;">[root@cent-1 slapd.d]# ls  
  2. cn=config  cn=config.ldif  
  3. [root@cent-1 slapd.d]# rm -rf *  
  4. [root@cent-1 slapd.d]# slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d/  
  5. config file testing succeeded</span>  

6 修改相关ldap文件权限

[html]  view plain  copy
  1. <span style="font-size:14px;">[root@ha-3 yum.repos.d]# chown -R ldap:ldap /var/lib/ldap/  
  2. [root@ha-3 yum.repos.d]# chown -R ldap:ldap /etc/openldap/</span>  

7 启动slapd服务

[html]  view plain  copy