ubuntu安装openldap教程

 

 

、准备相应的包

db-4.5.tar.gz    

openldap-2.4.9.tgz  (http://www.openldap.org/software/download/)

并将包上传到目录,如我的目录是 /opt/local/db_openldap

说明:--prefix表示设置自定义安装目录

安装时注意openldap 需要的的db版本,不然怎么安装都会出错, 可以在openldap解压后目录中readme查看

SLAPD:

        BDB and HDB backends require Oracle Berkeley DB 4.4 - 4.8,

        or 5.0 - 5.1.  It is highly recommended to apply the

        patches from Oracle for a given release.

、安装BerkeleyDB

  • cd /opt/local/db_openldap
  • tar zxvf db-4.5.20.tar.gz 
  • cd db-4.5.20/build_unix/
  • ../dist/configure --host=i686-w64-mingw32 --prefix=/opt/local/db_openldap/BerkeleyDB4.5.20 --enable-static --disable-shared --with-mp4v2=no --build=i686-pc-linux
  • make
  • make install
  • vi /etc/ld.so.conf 

在该文件中写入以下内容

/opt/local/db_openldap/BerkeleyDB4.5.20/lib

  • ldconfig -v 使配置生效

、安装openldap

  1. cd /opt/local/openladp
  2. tar zxvf openldap-2.4.9.tgz
  3. cd openldap-2.4.9 
  4. env CPPFLAGS="-I/opt/local/db_openldap/BerkeleyDB4.5.20/include -D_GNU_SOURCE" LDFLAGS="-L/opt/local/db_openldap/BerkeleyDB4.5.20/lib" ./configure --prefix=/opt/local/openldap/openldap_install_dir --enable-ldbm
  5. make depend
  6. make
  7. make test(测试,可省,会花费很长时间)
  8. make install
  9. #启动服务
  10. cd /opt/local/openldap/openldap_install_dir/libexec
  11. ./slapd
  12. netstat -tlnp | grep 389 #测试是否启动成功

ubuntu安装openldap教程

出现上面的内容表示启动成功,

4、LDAP的参数配置

cd /opt/local/openldap/openldap_install_dir/etc/openldap/

vi slapd.conf 加入以下内容

include         /opt/local/openldap/openldap_install_dir/etc/openldap/schema/cosine.schema

include         /opt/local/openldap/openldap_install_dir/etc/openldap/schema/inetorgperson.schema

图中红框是我自己添加进去,因为我需要支持更的属性,如果不需要的话可以不添加;

ubuntu安装openldap教程

上图中的dc=my-domain 中的my-domain可以自定义

然后可以在windows下配置一些openldap客户端工具进行查看,使用LdapBrowser

下载LdapBrowser 的地址:http://www.ldapbrowserwindows.com/

安装好LdapBrowser

填好openldap所在服务器地址,然后点击Fetch Base DNs 最后点击完成

ubuntu安装openldap教程

 

 

 

 

 

 

ubuntu安装openldap教程

ubuntu安装openldap教程

 可以看http://www.zuidaima.com/blog/2878257244818432.htm