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
- cd /opt/local/openladp
- tar zxvf openldap-2.4.9.tgz
- cd openldap-2.4.9
- 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
- make depend
- make
- make test(测试,可省,会花费很长时间)
- make install
- #启动服务
- cd /opt/local/openldap/openldap_install_dir/libexec
- ./slapd
- netstat -tlnp | grep 389 #测试是否启动成功
出现上面的内容表示启动成功,
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
图中红框是我自己添加进去,因为我需要支持更的属性,如果不需要的话可以不添加;
上图中的dc=my-domain 中的my-domain可以自定义
然后可以在windows下配置一些openldap客户端工具进行查看,使用LdapBrowser
下载LdapBrowser 的地址:http://www.ldapbrowserwindows.com/
安装好LdapBrowser 后
填好openldap所在服务器地址,然后点击Fetch Base DNs 最后点击完成