`

LDAP Redhat Enterprise Linux安装

阅读更多
Share

We all respect Redhat's goal of providing a stable operating system to its customers, the stability often comes at price. Often in the form of missing features that are available in the more recent releases of many packages. One such product has always been OpenLDAP. There are many LDAP implementations available today, including 389 Directory Server, which is a good enterprise directory server, but often includes too much extra stuff that is not needed. I have always preferred OpenLDAP for its simplicity, no frills, get the job done directory server. The latest version of OpenLDAP adds some very nice enterprise features such as multi-master replication and a new LDAP based configuration, which, I admit, I am still getting used too in comparison to good old fashioned slapd.conf file. In this article I am going to go through how I installed OpdenLDAP 2.4.x on Redhat Enterprise Linux. These same instructions are applicable to CentOS users as well.

  1. In order to install openldap, you need to install some prerequisites.

    yum install cyrus-sasl-devel openssl-devel krb5-devel zlib-devel
  2. Next we need to install Berkely-DB. This software package can be obtained via the following link: http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html .
  3. Download the software package and extract the contents to your system where you will be installing OpenLDAP. In this case I have download the following file: db-5.1.25.tar.gz.

    tar -zxvf db-5.1.25.tar.gz
  4. Next change into the newly created directory.

    cd db-5.1.25
    cd build_unix
  5. Configure the package. You will note that I am installing everything into /opt/local. That is where I put random things like this. You could also consider putting everyting in /usr/local, which makes your life easier in some ways.

    ../dist/configure --prefix=/opt/local
  6. Run make

    make
  7. Now install the software

    sudo make install
  8. Now that berkely-db is built, we can begin the OpenLDAP installation. First download the installation files

    wget ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.24.tgz
  9. Extract the tarball

    tar -zxvf openldap-2.4.24.tgz
  10. Change into the installation directory

    cd openldap-2.4.24
  11. Configure the software. You can specify the options you want for your installation. These are the ones I am using. Also make note of how I am passing the build flags via the command. This is very important otherwise the configure script will complain about your version of berkely-db header.

    env CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" ./configure --enable-hdb --enable-bdb --enable-overlays=mod --prefix=/opt/local
  12. Compile the software

    make
  13. Install the software

    make install
  14. 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
  15. Run ldconfig, the dynamic linker run time bindings.

    ldconfig
  16. 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
  17. 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
  18. 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/slapd
    slaptest=/opt/local/sbin/slaptest
    lockfile=/opt/local/var/lock/subsys/slapd
    configdir=/opt/local/etc/openldap/slapd.d
    configfile=/opt/local/etc/openldap/slapd.conf
    pidfile=/opt/local/var/run/slapd.pid
    slapd_pidfile=/opt/local/var/run/openldap/slapd.pid
     
    RETVAL=0
    start() {
    [ -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=2
    esac
    exit $RETVAL
     
  19. This concludes the installation of OpenLDAP on Redhat Enterprise Linux.
分享到:
评论

相关推荐

    ldap 详解(linux 下的ldap配置精华文档)

    关于linux 里ldap的详细安装和解释文档

    ldap的离线安装包及安装方法

    ldap ubuntu 16.04 离安装包及安装方法

    svn安装配置与ldap整合

    这是一遍比较完整的linux下svn+apche+ldap安装配置手册,根据本人实际安装整理后的文档,目前都算是最新版本。其中ldap使用sun的opends,个人感觉比openldap要方便,当然重点不是用什么ldap而是如何配置。 主要包括...

    Linux系统快速实现基于LDAP协议的目录服务

    RedHat 6.1 Linux发行版中就包含了Openldap软件包,该发行版可从计算机世界报信息服务中心得到,对LDAP的支持是Redhat6.1提供的一个重要扩展,,以下详细介绍在Linux中安装并配置Openldap的方法,以及使用该软件包为...

    linux redhat7部署ldap服务器 详细步骤整理(一)

    虚拟机系统 redhat7 首先清楚Ldap是一个协议 有不同的实现方法,我用openldap软件。 LDAP功能简介 公司内部会有许多第三方系统或服务,例如SVN、Git、VPN、Jira、Jenkins等等,每个系统都需要维护一份账号密码以支持...

    LINUX高级企业服务器管理

     安装Redhat Enterprise Linux5操作系统  熟练掌握常用命令的使用  熟练使用文本编辑器  熟练掌握Linux下硬件管理与磁盘操作  掌握Linux用户和组的管理  掌握Linux下软件的安装与卸载  配置和管理文件...

    linux下安装svn命令行

    详细的linux下安装svn命令行 安装Subversion服务器 debian:~# apt-get install subversion subversion-tools 创建一个新的储存库: debian:~# svnadmin create /data/svn 导入你的源码: debian:~# svn import /data...

    ldap安装、认证、部署

    这几天在研究LDAP安装,上网找了一大圈还是没整明白,经过无数次的失败和N小时的尝试中终于研究的差不多了。 下面简要说一下流程吧,希望对大家有所帮助: 主要参考:...

    LDAP安装介绍1111111111111

    LDAP安装介绍,主要介绍LDAP服务器以及客户端,在linux上的安装过程

    Fedora和Red Hat Enterprise Linux实用指南(第6版)

    《fedora和red hat enterprise linux实用指南(第6版)》采用通俗易懂的语言和大量的实例,对目前企业应用最为广泛的fedora和red hat enterprise linux版本的应用进行了系统、科学、全面的介绍,包括linux系统管理、...

    ldap+gerrit+gitweb集成化安装部署

    本文档详细介绍了如何在linux系统下安装ldap、gerrit、gitweb的安装流程。还包括gerrit的ldap认证配置,gerrit+gitweb集成化安装部署流程。

    ldap安装与客户端ldapadmin windows

    ldap安装与客户端ldapadmin windows版本,

    LINUX LDAP 服务器 简介

    LDAP 的英文全称是Lightweight Directory Access Protocol,一般都简称为LDAP。它是基于X.500标准的,但是简单多了并且可以根据需要定制。与X.500不同,LDAP支持TCP/IP, 这对访问Internet是必须的。LDAP的核心规范...

    jxplorer-3.3.1.1 LDAP

    jxplorer-3.3.1.1 LDAP数据的连接工具,非常的好用

    Ldap管理工具

    Linux ldap 管理工具 Linux ldap 管理工具 Linux ldap 管理工具

    linux下的ldap配置详述

    ldpa属性详解,配置,安装搭建,链接等使用

    Practical LDAP on Linux

    一本在linux下应用LDAP的书,E文

    LdapBrowser2.82版和LDAP使用手册

    LdapBrowser2.82版,能浏览服务器的ldap数据,还有一份word详细使用文档及ldap安装说明

    ldap+gerrit详细安装视频讲解

    此视频详细讲解了ldap服务器和gerrit服务器的安装流程,以及对gerrit进行ldap认证配置也进行详细的讲解。

    Fedora 6 and Red Hat Enterprise Linux Bible

    如何在Linux下设置和使用MySQL数据库服务器;如何能让在其他章节中配置的服务器被公共因特网访问;如何设置域名系统(DNS)服务器;如何设置Fedora或RHEL成为一台Macintosh文件和打印服务器。第5部分包括第27章和第...

Global site tag (gtag.js) - Google Analytics