openLDAP install guide

来源:互联网 发布:js防水上贴瓷砖 编辑:程序博客网 时间:2024/05/22 10:52

This steps is a sample of installing openLDAP on Solaris 10

 

 

 

-- install BerkeleyDB
1. Download BerkelayDB (db-4.7.25.NC.tar.gz)
2. gunzip ..., tar -xvf ...   
3. cd .../db-4.7.25.NC
2.  cd build_unix
3. ../dist/configure --prefix=...
4. make
5. make install
 
-- install OpenLDAP
1. download openLDAP from openLDAP.org (openldap-stable.tgz)
2. gunzip ..., tar -xvf ...
3.export environment
    export CFLAGS="-D_AVL_H"   # see comment 1
    export CPPFLAGS="-I/ $(BerkeleyDBInstalled) /include "
    export LDFLAGS="-L/ $(BerkeleyDBInstalled) /lib"
    export LD_LIBRARY_PATH="/$(BerkeleyDBInstalled)/lib"
 
2. cd /.../openldap-2.4.16
3. ./configure --prefix=/... --with-tls=no
4. make depend
5. make
6. make install

comment 1:
If following compile error you met, this CFLAGS must be defined.

"//include/avl.h", line 86: identifier redeclared: avl_insert
current : function(pointer to pointer to struct avlnode {pointer to void
avl_data, array[2] of pointer to struct avlnode {} avl_link, array[2] of char
avl_bits, signed char avl_bf}, pointer to void, pointer to function()
returning int, pointer to function() returning int) returning int
previous: function(pointer to struct avl_tree {pointer to struct
avl_node {} avl_root, pointer to function() returning int avl_compar,
unsigned long avl_offset, unsigned long avl_numnodes, unsigned long avl_size},
pointer to void, unsigned long) returning void : "/usr/include/sys/avl.h", line
154
"//include/avl.h", line 92: identifier redeclared: avl_find
current : function(pointer to struct avlnode {pointer to void avl_data,
array[2] of pointer to struct avlnode {} avl_link, array[2] of char avl_bits,
signed char avl_bf}, pointer to const void, pointer to function() returning
int) returning pointer to void
previous: function(pointer to struct avl_tree {pointer to struct
avl_node {} avl_root, pointer to function() returning int avl_compar,
unsigned long avl_offset, unsigned long avl_numnodes, unsigned long avl_size},
pointer to void, pointer to unsigned long) returning pointer to void :
"/usr/include/sys/avl.h", line 146


-- define LDAP server configure file
#:> cat /tmp/donot_delete_it_hui/build_openldap/tests/testrun/slapd.1.conf
include         /u/huishen/tmp/install/etc/openldap/schema/core.schema
include         /u/huishen/tmp/install/etc/openldap/schema/cosine.schema
include         /u/huishen/tmp/install/etc/openldap/schema/inetorgperson.schema
include         /u/huishen/tmp/install/etc/openldap/schema/openldap.schema
include         /u/huishen/tmp/install/etc/openldap/schema/nis.schema

#
pidfile         /tmp/donot_delete_it_hui/build_openldap/tests/testrun/slapd.1.pid
argsfile        /tmp/donot_delete_it_hui/build_openldap/tests/testrun/slapd.1.args

#######################################################################
# database definitions
#######################################################################                  
                                                                                         
database        bdb                                                                      
suffix          "dc=example,dc=com"                                                      
rootdn          "cn=Manager,dc=example,dc=com"                                           
rootpw          secret                                                                   
directory       /tmp/donot_delete_it_hui/build_openldap/tests/testrun/db.1.a             
index           objectClass     eq                                                       
index           cn,sn,uid       pres,eq,sub                                              
checkpoint              1024 5

-- start LDAP server

#:> /u/huishen/tmp/install/libexec/slapd /
-s0 /
-f /tmp/donot_delete_it_hui/build_openldap/tests/testrun/slapd.1.conf /
-h ldap://localhost:9011/ /
-d 261

# the LDAP will listen on port 9011


-- Check LDAP server is available
/u/huishen/tmp/install/bin/ldapsearch -x -b '' -s base -h localhost -p 9011 '(objectclass=*)' namingContexts
-- Add new item into LDAP server
#:> cat example.ldif
dn: dc=example,dc=com
objectclass: dcObject
objectclass: organization
o: Example Company
dc: example
dn: cn=Manager,dc=example,dc=com
objectclass: organizationalRole
cn: Manager
#:>
/u/huishen/tmp/install/bin/ldapadd -x -D "cn=Manager,dc=example,dc=com" -h localhost -p 9011 -W -f example.ldif
-- Verify new item has saved into LDAP server
/u/huishen/tmp/install/bin/ldapsearch -x -b 'dc=example,dc=com' -h localhost -p 9011 '(objectclass=*)'