分享

在debian上安装LDAP服务器

 秋风无情萤火虫 2015-03-11
#apt-get install slapd ldap-utils
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
libiodbc2 libldap-2.3-0
The following NEW packages will be installed:
ldap-utils libiodbc2 libldap-2.3-0 slapd
0 upgraded, 4 newly installed, 0 to remove and 13 not upgraded.
Need to get 1328kB/1758kB of archives.
After unpacking 4694kB of additional disk space will be used.

安装过程中提示输入LDAP管理员密码(我的机器域名系统运行正常,所以没有提示输入域名等信息)

安装完成后,重新配置:
#dpkg-reconfigure slapd
接下来就是域名信息,管理员密码,数据库我选择BDB
接着是询问在移除slapd的时候是否移除数据库(Do you want your database to be removed when slapd is purged? )
选择:no

接下来询问是否删除旧的数据(There are still files in /var/lib/ldap which will probably break the configuration process. If you enable this   │
    │ option, the maintainer scripts will move the old database files out of the way before creating a new database.   │
    │                                                                                                                  │
    │ Move old database?               )
如果是新安装,选择:yes

是否接受ldapv2( Allow LDAPv2 protocol?       )
选择:no

现在SLAPD已经成功运行了:
dell3:/etc/postfix# ps aux|grep ldap
openldap 27127 0.0 0.5 17972 2896 ?        Ssl 15:53   0:00 /usr/sbin/slapd -g openldap -u openldap
root     27147 0.0 0.1   1640   536 pts/4    S+   15:54   0:00 grep ldap
dell3:/etc/postfix#

为了更好的融合你的服务器,请安装migrationtools
# apt-get install migrationtools
安装完成后,常用的融合都已经有perl或shell的脚本,你可以选择执行,也可以执行所有
#cd /usr/share/migrationtools
#ls
dell3:/usr/share/migrationtools# ls
migrate_aliases.pl
migrate_all_offline.sh
migrate_hosts.pl
migrate_protocols.pl
migrate_all_netinfo_offline.sh
migrate_all_online.sh
migrate_netgroup.pl
migrate_rpc.pl
migrate_all_netinfo_online.sh
migrate_automount.pl
migrate_netgroup_byhost.pl
migrate_services.pl
migrate_all_nis_offline.sh
migrate_base.pl
migrate_netgroup_byuser.pl
migrate_slapd_conf.pl
migrate_all_nis_online.sh      
migrate_common.ph      
migrate_networks.pl
migrate_all_nisplus_offline.sh
migrate_fstab.pl       
migrate_passwd.pl
migrate_all_nisplus_online.sh  
migrate_group.pl       
migrate_profile.pl


如果ldap系统已经在运行,migrate_all_online.sh可以整合运行所有的脚本,否则可以运行migrate_all_offline.sh
在运行脚本前,行检查migrate_common.ph文件,这是一个能用配置:
你需要更改你的DNS像下面一样:
# Default DNS domain
$DEFAULT_MAIL_DOMAIN = "netsafe.qa.net";

# Default base
$DEFAULT_BASE = "dc=netsafe,dc=qa,dc=net";

现在运行脚本:
dell3:/usr/share/migrationtools# ./migrate_all_online.sh
Enter the X.500 naming context you wish to import into: [dc=netsafe,dc=qa,dc=net] (如果刚已经改过配置,直接回车)
Enter the hostname of your LDAP server [ldap]: dell3
Enter the manager DN: [cn=admin,dc=netsafe,dc=qa,dc=net]:
Enter the credentials to bind with: (在这里输入前面设定的LDAP管理员密码)
Do you wish to generate a DUAConfigProfile [yes|no]? no

如果运行出现类似错误:
ldap_add: Already exists (68)

/usr/bin/ldapadd: returned non-zero exit status: saving failed LDIF to /tmp/nis.27784.ldif

请不要惊慌,到/tmp目录下,重新用以下命令运行:
dell3:/tmp# ldapadd -x -c -D "cn=admin,dc=netsafe,dc=qa,dc=net" -f nis.27784.ldif -W

反复运行,直到没有错误为止。

检查:
ldapsearch -x uid=5000



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多