读书人

LDAP Redhat Enterprise Linux装配

发布时间: 2012-07-05 07:59:17 作者: rapoo

LDAP Redhat Enterprise Linux安装

Compile the software

make
Install the software

make install
Now you have installed OpenLDAP, there are a couple of problems though. First of all /opt/local/lib is not in your library path. This can of course be remediated in a couple of ways. Install everything into /usr/local which is recognized as a valid library path or we can make a few tweaks to the ld.so.conf.d directory.

vim /etc/ld.so.conf.d/ldap.conf

add the following line

/opt/local/lib
Run ldconfig, the dynamic linker run time bindings.

ldconfig
We need to add a user to the system for ldap to run as. You can run it as root, but I do not recommend it.

groupadd -g 55 ldap
useradd -s /bin/false -d /opt/local/var -g ldap -u 55 ldap
Set the appropriate permissions on all the files.

chown -R ldap:ldap /opt/local/var/run
chown -R ldap:ldap /opt/local/var/ldap-data
chown ldap:ldap /opt/local/etc/openldap/slapd.conf
chmod 700 /opt/local/etc/openldap/slapd.conf
Create the following startup script:

sudo vim /etc/init.d/ldap

#!/bin/bash
#
# slapd This shell script takes care of starting and stopping OpenLDAP.
# ldap servers (slapd)..........................
# chkconfig: - 27 73# description: LDAP stands for Lightweight Directory Access Protocol, used \# for implementing the industry standard directory services.# processname: slapd# config: /etc/openldap/slapd.conf# pidfile: /var/run/slapd.pid ### BEGIN INIT INFO# Provides: slapd# Required-Start: $network $local_fs# Required-Stop: $network $local_fs # Should-Start: # Should-Stop: # Default-Start: # Default-Stop: # Short-Description: starts and stopd OpenLDAP server daemon# Description: LDAP stands for Lightweight Directory Access Protocol, used# for implementing the industry standard directory services.### END INIT INFO # Source function library.. /etc/init.d/functions # Define default values of options allowed in /etc/sysconfig/ldap#SLAPD_LDAP="yes"#SLAPD_LDAPI="no"#SLAPD_LDAPS="no"#SLAPD_URLS=""#SLAPD_SHUTDOWN_TIMEOUT=3# OPTIONS, SLAPD_OPTIONS and KTB5_KTNAME are not defined export LD_LIBRARY_CONFIG=/opt/local/lib slapd=/opt/local/libexec/slapdslaptest=/opt/local/sbin/slaptestlockfile=/opt/local/var/lock/subsys/slapdconfigdir=/opt/local/etc/openldap/slapd.dconfigfile=/opt/local/etc/openldap/slapd.confpidfile=/opt/local/var/run/slapd.pidslapd_pidfile=/opt/local/var/run/openldap/slapd.pid RETVAL=0start() { [ -x $slapd ] || exit 5 [ `id -u` -eq 0 ] || exit 4 # Define a couple of local variables which we'll need. Maybe. user=ldap group=ldap prog=`basename ${slapd}` #harg="$SLAPD_URLS" #if test x$SLAPD_LDAP = xyes ; then harg="$harg ldap:///" #fi #if test x$SLAPD_LDAPS = xyes ; then # harg="$harg ldaps:///" #fi #if test x$SLAPD_LDAPI = xyes ; then # harg="$harg ldapi:///" #fi # Start daemons. echo -n $"Starting $prog: " daemon --pidfile=$pidfile --check=$prog ${slapd} -h "\"$harg\"" -u ${user} -g ${group} -f ${configfile} RETVAL=$? if [ $RETVAL -eq 0 ]; then touch $lockfile #ln $slapd_pidfile $pidfile fi echo return $RETVAL} function stop() { # Stop daemons. prog=`basename ${slapd}` [ `id -u` -eq 0 ] || exit 4 echo -n $"Stopping $prog: " # This will remove pid and args files from /var/run/openldap killproc -p $pidfile -d $SLAPD_SHUTDOWN_TIMEOUT ${slapd} RETVAL=$? # Now we want to remove lock file and hardlink of pid file [ $RETVAL -eq 0 ] && rm -f $pidfile $lockfile echo return $RETVAL}# See how we were called.case "$1" in start) start RETVAL=$? ;; stop) stop RETVAL=$? ;; status) status -p $pidfile ${slapd} RETVAL=$? ;; restart|force-reload) stop start RETVAL=$? ;; condrestart|try-restart) status -p $pidfile ${slapd} > /dev/null 2>&1 || exit 0 stop start ;; usage) echo $"Usage: $0 {start|stop|restart|force-reload|status|condrestart|try-restart|usage}" RETVAL=0 ;; *) echo $"Usage: $0 {start|stop|restart|force-reload|status|condrestart|try-restart|usage}" RETVAL=2esacexit $RETVAL This concludes the installation of OpenLDAP on Redhat Enterprise Linux.

读书人网 >UNIXLINUX

热点推荐