免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1858 | 回复: 1
打印 上一主题 下一主题

CentOS5 安装 配置openLDAP [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-10-05 16:11 |只看该作者 |倒序浏览
1)安装需要的软件包
[root@localhost ~]# ls /media/CentOS_5.3_Final/CentOS/ | grep ldap
mod_authz_ldap-0.26-8.el5.i386.rpm
openldap-2.3.43-3.el5.i386.rpm
openldap-clients-2.3.43-3.el5.i386.rpm
openldap-devel-2.3.43-3.el5.i386.rpm
openldap-servers-2.3.43-3.el5.i386.rpm
  上面的东东都装了
2)配置/etc/openldap/slapd.conf
备份原始配置档 (Linux/Unix管理员都应该养成这样的好习惯)
[root@mail openldap]# cp /etc/openldap/slapd.conf /etc/openldap/slapd.conf-orig
配置openldap的主配置文件
[root@mail openldap]# vi /etc/openldap/slapd.conf
....
database bdb
suffix "dc=example,dc=com"    #一条记录所属区域#
rootdn "cn=admin,dc=example,dc=com"
rootpw 1234567                 #定义LDAP根管理员的密码(强烈建议使用加密的密码)
......
将系统账户转移到openldap中
[root@localhost ~]# vi /usr/share/openldap/migration/migrate_common.ph
$DEFAULT_MAIL_DOMAIN = "example.com";
Default base
$DEFAULT_BASE = "dc=example,dc=com";
[root@localhost ~]# cd /usr/share/openldap/migration/
[root@localhost ~]#  ./migrate_passwd.pl /etc/passwd > /etc/openldap/user.ldif
[root@localhost ~]#  ./migrate_group.pl /etc/group > /etc/openldap/group.ldif
建立example.ldif,ou_people.ldif, ou_group.ldif三个文件
[root@localhost ~]# cd /etc/openldap/
[root@localhost ~]# cat example.ldif
dn: dc=example,dc=com
dc: example
objectClass: dcObject
objectClass: organizationalUnit
ou: example.com
[root@mail openldap]# cat ou_people.ldif
dn: ou=people, dc=example, dc=com
objectclass: organizationalunit
ou: people
[root@mail openldap]# cat ou_group.ldif
dn: ou=group, dc=example, dc=com
objectclass: organizationalunit
ou: group
停止ldap服务
[root@mail openldap]# service ldap stop
转换原有Linux 账号至OpenLDAP服务器上:
[root@localhost ~]# slapadd -vl example.ldif
added: "dc=example,dc=com" (00000001)
[root@localhost ~]# slapadd -vl ou_people.ldif
added: "ou=people,dc=example,dc=com" (00000002)
[root@localhost ~]# slapadd -vl ou_group.ldif
added: "ou=group,dc=example,dc=com" (00000043)
[root@localhost ~]# slapadd -vl user.ldif
[root@localhost ~]# slapadd -vl group.ldif
配置DB_CONFIG配置文件
[root@localhost ~]# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
把/var/lib/ldap/目录内的档案变更拥有者及群组为ldap
[root@localhost ~]# chown  -R  ldap.ldap /var/lib/ldap

为了检查服务是否正在运行并且被正确配置,可以对服务器运行一个搜索命令,使用ldapsearch
ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts;
注意命令行参数中单引号的使用,它们阻止特殊的字符被shell解析。这应该返回:
[root@mail openldap]# service ldap start
[root@mail openldap]# ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts;
# extended LDIF
#
# LDAPv3
# base  with scope baseObject
# filter: (objectclass=*)
# requesting: namingContexts
#
#
dn:
namingContexts: dc=example,dc=com
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1

or
[root@localhost openldap]# ldapsearch -x -b 'dc=example,dc=com'

3,GUI的好像是phpLDAPadmin不喜欢GUI
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/76292/showart_2064392.html

论坛徽章:
0
2 [报告]
发表于 2009-10-06 07:16 |只看该作者
好文
和fedora差不多哦
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP