首先要下载相关的软件Y3LLinux联盟 #apt-get install sldapd ldap-utilsY3LLinux联盟 这里会在产生/etc/ldap目录。Y3LLinux联盟 编辑/etc/ldap/slapd.confY3LLinux联盟 Y3LLinux联盟
########################################################Y3LLinux联盟 include /etc/ldap/schema/core.schemaY3LLinux联盟 include /etc/ldap/schema/cosine.schemaY3LLinux联盟 include /etc/ldap/schema/nis.schemaY3LLinux联盟 include /etc/ldap/schema/inetorgperson.schemaY3LLinux联盟 Y3LLinux联盟 pidfile /var/run/slapd/slapd.pidY3LLinux联盟 Y3LLinux联盟 argsfile /var/run/slapd/slapd.argsY3LLinux联盟 Y3LLinux联盟 loglevel 256Y3LLinux联盟 Y3LLinux联盟 modulepath /usr/lib/ldapY3LLinux联盟 moduleload back_bdbY3LLinux联盟 Y3LLinux联盟 sizelimit 500Y3LLinux联盟 Y3LLinux联盟 tool-threads 1Y3LLinux联盟 Y3LLinux联盟 backend bdbY3LLinux联盟 checkpoint 512 30Y3LLinux联盟 Y3LLinux联盟 Y3LLinux联盟 database bdbY3LLinux联盟 Y3LLinux联盟 suffix "dc=test,dc=net"Y3LLinux联盟 Y3LLinux联盟 rootdn "cn=admin,dc=test,dc=net"Y3LLinux联盟 rootpw {MD5}G0Z6gesdfW+JgkbwKcllGg==Y3LLinux联盟 Y3LLinux联盟 directory "/var/lib/ldap"Y3LLinux联盟 Y3LLinux联盟 dbconfig set_cachesize 0 2097152 0Y3LLinux联盟 Y3LLinux联盟 Y3LLinux联盟 dbconfig set_lk_max_objects 1500Y3LLinux联盟 dbconfig set_lk_max_locks 1500Y3LLinux联盟 dbconfig set_lk_max_lockers 1500Y3LLinux联盟 Y3LLinux联盟 index objectClass eqY3LLinux联盟 Y3LLinux联盟 lastmod onY3LLinux联盟 Y3LLinux联盟 Y3LLinux联盟 access to attrs=userPassword,shadowLastChangeY3LLinux联盟 by dn="cn=admin,dc=test,dc=net" writeY3LLinux联盟 by anonymous authY3LLinux联盟 by self writeY3LLinux联盟 by * noneY3LLinux联盟 Y3LLinux联盟 access to dn.base="" by * readY3LLinux联盟 Y3LLinux联盟 access to *Y3LLinux联盟 by dn="cn=admin,dc=test,dc=net" writeY3LLinux联盟 by * readY3LLinux联盟 ########################################################Y3LLinux联盟 Y3LLinux联盟 其中需要添加rootdn和rootpw两行,其中rootpw由Y3LLinux联盟 #slappasswd -h {md5}Y3LLinux联盟 得到。Y3LLinux联盟 修改loglevel为256产生日志文件。Y3LLinux联盟 #echo "local4.debug /var/log/ldap.log" >> /etc/syslog.confY3LLinux联盟 将ldap功能打开。Y3LLinux联盟 #/etc/init.d/sysklogd restartY3LLinux联盟 #/etc/init.d/slapd restartY3LLinux联盟 重启日志和目录服务。Y3LLinux联盟 #ldapsearch -x -b '' -s base '(objectclass=*)'Y3LLinux联盟 如果看到有相关信息输出就说明openldap已经正常运行了。Y3LLinux联盟 接下来输入基本的容器。建立base.ldifY3LLinux联盟 ########################################################Y3LLinux联盟 dn: dc=test,dc=netY3LLinux联盟 objectClass: dcobjectY3LLinux联盟 objectClass: organizationY3LLinux联盟 dc: testY3LLinux联盟 o: test.netY3LLinux联盟 description: My Test Openldap Y3LLinux联盟 ########################################################Y3LLinux联盟 #ldapadd -x -D "cn=admin,dc=test,dc=net" -W -f base.ldifY3LLinux联盟 至此openladp搭建成功。Y3LLinux联盟 另外可以使用phpldapadmin进行openldap的管理。安装phpldapadminY3LLinux联盟 #apt-get install phpldapadminY3LLinux联盟 注意要使用admin登录时,Login DN填入:cn=admin,dc=test,dc=netY3LLinux联盟
|