Tuesday, August 11, 2009

OpenLDAP on Solaris 10 - How To


We have a LifeRay Proof-of-Concept coming up. The customer is a local defense company. Their environment utilizes OpenLDAP at the moment. (Yes, I'm pushing hard for OpenDS deployment soon :>) 



We need LifeRay to authenticate with OpenLDAP.  Thus here I am - helping my team with getting an instance of OpenLDAP up on Solaris 10 x86 OS.



bash-3.00# cat /etc/release 
                        Solaris 10 5/08 s10x_u5wos_10 X86
           Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                             Assembled 24 March 2008

Dependencies (Download from sunfreeware):

1. libiconv-1.11 
2. gcc-3.4.6
3. libgcc-3.4.6
4. db-4.4.20.NC 
5. sasl-2.1.21
6. openssl-0.9.8k
7. libtool-1.5.24
8. make-3.81


Note: Do not install the latest Berkeley DB 4.7.25 unless you know how to patch it. I'll give it a miss here since this OpenLDAP is only for our POC, not for production usage.


Package install for dependencies

bash-3.00# pkgadd -d libiconv-1.11-sol10-x86-local
bash-3.00# pkgadd -d gcc-3.4.6-sol10-x86-local   
bash-3.00# pkgadd -d libgcc-3.4.6-sol10-x86-local
bash-3.00# pkgadd -d db-4.4.20.NC-sol10-x86-local
bash-3.00# pkgadd -d sasl-2.1.21-sol10-x86-local 
bash-3.00# pkgadd -d openssl-0.9.8k-sol10-x86-local 
bash-3.00# pkgadd -d libtool-1.5.24-sol10-x86-local 
bash-3.00# pkgadd -d make-3.81-sol10-x86-local <- required for source compile

Note: When you package-add libgcc-3.4.6-sol10-x86-local, you'll encounter this error. Choose "n" will do.
    The following files are already installed on the system and are being
    used by another package:
      /usr/local/lib/libg2c.so.0.0.0
      /usr/local/lib/libgcc_s.so.1
      /usr/local/lib/libstdc++.so.6.0.3
    
    Do you want to install these conflicting files [y,n,?,q] n
Source Compile OpenLDAP 2.4.16 (Download source from here)

    bash-3.00# cd /openldap/openldap-2.4.16

Environment Setting

    bash-3.00# export CFLAGS="-D_AVL_H" 
    bash-3.00# export CPPFLAGS="-I/usr/local/include –I/usr/local/BerkeleyDB.4.4/include –I/usr/local/include/sasl –I/usr/sfw/include"
    bash-3.00# export LDFLAGS="-L/usr/local/lib –L/usr/local/BerkeleyDB.4.4/lib –L/usr/local/lib/sasl2 –L/usr/sfw/lib" 
    bash-3.00# export CC="/usr/local/bin/gcc"
    bash-3.00# export LD_LIBRARY_PATH=/usr/dt/lib:/usr/openwin/lib:/usr/local/BerkeleyDB.4.4/lib:/usr/local/lib:/usr/sfw/lib
    bash-3.00# export PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin

    bash-3.00# vi /etc/profile
export LOGNAME PATH <- default
PATH=$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin
export PATH
LD_LIBRARY_PATH=/usr/dt/lib:/usr/openwin/lib:/usr/local/BerkeleyDB.4.4/lib:/usr/local/lib:/usr/sfw/lib
export LD_LIBRARY_PATH

Configure

    bash-3.00# ./configure –-prefix=/opt/openldap --enable-monitor --enable-syslog
    bash-3.00# make depend
    bash-3.00# make
    bash-3.00# make test <- MUST complete succesfully; otherwise, do not continue
    bash-3.00# make install

    bash-3.00# vi /opt/openldap/etc/openldap/slapd.conf
include         /opt/openldap/etc/openldap/schema/core.schema <- default
include         /opt/openldap/etc/openldap/schema/cosine.schema
include         /opt/openldap/etc/openldap/schema/inetorgperson.schema

suffix            "dc=sg,dc=com"
rootdn          "cn=Manager,dc=sg,dc=com"
rootpw          secret <- leave as-is
        

Start OpenLDAP
    bash-3.00# /opt/openldap/libexec/slapd    

Stop OpenLDAP
    bash-3.00# /usr/bin/pkill slapd

No comments:

Post a Comment