CentOS6.5安装OpenLDAP目录访问协议的例子
注:这个要基于几个WEB引擎让前台能够管理便捷一点,所以LNMP的安装我后续在写吧,确实没什么时间,如果是自行安装请对PHP添加PHP-LDAP的支持!
1、安装openssl
代码如下 | |
|
注:变更profile,完成后重载一下环境,后面的类似操作请自行执行
代码如下 | |
[root@itchenyi-01 openssl-1.0.1e]# cat >> ~/.bash_profile <<EOF LD_LIBRARY_PATH=/software/openssl/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH PATH=/software/ssl/bin:$PATH export PATH EOF [root@itchenyi-04 openssl-1.0.1e]# source ~/.bash_profile |
2、安装jdk
代码如下 | |
|
3、安装Cyrus-SASL
代码如下 | |
|
4、安装BDB
代码如下 | |
|
5、安装OpenLDAP
代码如下 | |
[root@itchenyi-04 build_unix]# yum install tcp_wrappers-devel [root@itchenyi-04 ~]# tar zxf openldap-2.4.39.tgz [root@itchenyi-04 ~]# cd openldap-2.4.39 [root@itchenyi-04 openldap-2.4.39]# ./configure --prefix=/software/openldap --enable-passwd --enable-wrappers --enable-spasswd --enable-crypt --enable-modules --enable-accesslog=yes --enable-shell --with-tls --enable-meta --enable-ldap --enable-sql #make test 操作建议分开执行 [root@itchenyi-04 openldap-2.4.39]# make && make test && make install |
变更OpenLDAP配置,请勿直接复制粘贴
代码如下 | |
[root@itchenyi-04 ~]# cat /software/openldap/etc/openldap/slapd.conf | egrep -v "^#|^$" include /software/openldap/etc/openldap/schema/core.schema include /software/openldap/etc/openldap/schema/collective.schema include /software/openldap/etc/openldap/schema/corba.schema include /software/openldap/etc/openldap/schema/cosine.schema include /software/openldap/etc/openldap/schema/duaconf.schema include /software/openldap/etc/openldap/schema/dyngroup.schema include /software/openldap/etc/openldap/schema/inetorgperson.schema include /software/openldap/etc/openldap/schema/java.schema include /software/openldap/etc/openldap/schema/misc.schema include /software/openldap/etc/openldap/schema/nis.schema include /software/openldap/etc/openldap/schema/openldap.schema include /software/openldap/etc/openldap/schema/pmi.schema include /software/openldap/etc/openldap/schema/ppolicy.schema pidfile /software/openldap/var/run/slapd.pid argsfile /software/openldap/var/run/slapd.args database bdb suffix "dc=itchenyi,dc=com" rootdn "cn=Manager,dc=itchenyi,dc=com" rootpw secret directory /software/openldap/var/openldap-data index objectClass eq |
启动服务
代码如下 | |
|
测试OpenLDAP
代码如下
[root@itchenyi-04 ~]# /software/openldap/bin/ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts -h 1.1.1.5 -p 389
# extended LDIF
#
# LDAPv3
# base <> with scope baseObject
# filter: (objectclass=*)
# requesting: namingContexts
#
#
dn:
namingContexts: dc=itchenyi,dc=com
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1
初始化,添加一点数据进去
代码如下 | |
[root@itchenyi-04 ~]# cat > itchenyi.example.ldif <<EOF dn:dc=itchenyi,dc=com objectclass:dcObject objectclass:organization o:www.itchenyi.com,blog. dc:itchenyi dn:cn=Manager,dc=itchenyi,dc=com objectclass:organizationalRole cn:Manager EOF [root@itchenyi-04 ~]# /software/openldap/bin/ldapadd -x -D "cn=manager,dc=itchenyi,dc=com" -f itchenyi.example.ldif -p 389 -h 1.1.1.5 -w secret |