liguocai 發表於 2011-2-2 17:16:37

linux搭建ldap服务器详细步骤

ldap这种原始的服务器搭建起来比较复杂,同时它也是CE必考的(客户端的搭建)。
1、安装openldap-servers软件包
http://files.jb51.net/file_images/article/201405/201405051432395.jpg
2、查看ldap模板文件的存放位置:
http://files.jb51.net/file_images/article/201405/201405051432396.jpg
3、拷贝ldap模板文件到配置文件目录并修改文件名为slapd.conf。
http://files.jb51.net/file_images/article/201405/201405051432397.jpg
http://files.jb51.net/file_images/article/201405/201405051432398.jpg
4、删除/etc/openldap目录下原有的文件,保留下这几个文件,注意:以前学时是要删除schema文件,直留下三个,但是我测试时如果删除schema服务将失败。
http://files.jb51.net/file_images/article/201405/201405051432399.jpg
5、修改slapd.conf文件的权限:
http://files.jb51.net/file_images/article/201405/2014050514323910.jpg
http://files.jb51.net/file_images/article/201405/2014050514323911.jpg
6、修改sldap.conf配置文件:如下:(主要配好红色的就ok,没有的都是被注释掉的)

复制代码代码如下:
include         /etc/openldap/schema/corba.schema
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/duaconf.schema
include         /etc/openldap/schema/dyngroup.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/java.schema
include         /etc/openldap/schema/misc.schema
include         /etc/openldap/schema/nis.schema
include         /etc/openldap/schema/openldap.schema
include         /etc/openldap/schema/ppolicy.schema
include         /etc/openldap/schema/collective.schema
allow bind_v2
pidfile         /var/run/openldap/slapd.pid argsfile      /var/run/openldap/slapd.args
database      bdb suffix          "dc=example,dc=com" checkpoint      1024 15 rootdn      
"cn=Manager,dc=example,dc=com"
rootpw          redhat
directory       /var/lib/ldap
index objectClass                     eq,pres
index ou,cn,mail,surname,givenname      eq,pres,sub
index uidNumber,gidNumber,loginShell    eq,pres
index uid,memberUid                     eq,pres,sub
database monitor
access to *         by dn.exact="cn=Manager,dc=example,dc=com" read         by * none
7、重启动ldap服务器:
http://files.jb51.net/file_images/article/201405/2014050514323912.jpg
8、创建ldap用户目录:
http://files.jb51.net/file_images/article/201405/2014050514323913.jpg
9、编辑一个自动创建ldap用户的脚本:
http://files.jb51.net/file_images/article/201405/2014050514323914.jpg
10 、执行此脚本添加用户:
http://files.jb51.net/file_images/article/201405/2014050514323915.jpg
11、把ldap用户,组分别导出来,到一个文件中:(例子只做了组)用户在、/etc/passwd下
http://files.jb51.net/file_images/article/201405/2014050514323916.jpg
12、安装软件包:
http://files.jb51.net/file_images/article/201405/2014050514323917.jpg
13、去它的目录下编译ldap用户组文件:
http://files.jb51.net/file_images/article/201405/2014050514323918.jpg
14、修改migrate_common.ph文件:
http://files.jb51.net/file_images/article/201405/2014050514323919.jpg
15、执行./migrate_base.pl文件,并导出到一个目录下边,进行进行修改,只留下最基本的三个配置:
http://files.jb51.net/file_images/article/201405/2014050514323920



16,、分别使用./migrate_passwd.pl      ./migrate_group.pl编译我们已经导出的ldap用户和组文件: /mnt/user /mnt/group分别是从/etc/passwd /etc/group 导出的ldap用户和组文件
/date/user.ldif/date/group.ldif 是编译后生成的文件要以ldif结尾
http://files.jb51.net/file_images/article/201405/2014050514323921.jpg
17、看下/date下我们编译好的几个文件:
http://files.jb51.net/file_images/article/201405/2014050514323922.jpg
18、添加ldap用户和组:
http://files.jb51.net/file_images/article/201405/2014050514323923.jpg
首先提示输入密码,其次添加成功。
http://files.jb51.net/file_images/article/201405/2014050514323924.jpg
还有个用户,必须首先执行base.ldif文件,它是最基本的配置。
http://files.jb51.net/file_images/article/201405/2014050514323925.jpg
頁: [1]
查看完整版本: linux搭建ldap服务器详细步骤