Example of CentOS6.5 install OpenLDAP Directory Access Protocol

Source: Internet
Author: User
Tags ldap openssl openldap

Note: This is based on a few web engines to enable the front desk to manage a little more convenient, so LNMP installation I follow in writing it, really no time, if it is installed on its own PHP to add PHP-LDAP support!

1. Installation OpenSSL

The code is as follows Copy Code


[root@itchenyi-04 ~]# tar zxf openssl-1.0.1e.tar.gz
[root@itchenyi-04 ~]# CD openssl-1.0.1e
[root@itchenyi-04 openssl-1.0.1e]#./config--prefix=/software/openssl
[root@itchenyi-04 openssl-1.0.1e]# make && make install
[Root@itchenyi-04 openssl-1.0.1e]# ln-s/software/openssl/lib/usr/lib64/

Note: Change profile, after the completion of the overload of the environment, the following similar operations please do their own

The code is as follows Copy Code
[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. Install JDK

  code is as follows copy code

 
[ root@itchenyi-04 ~]# tar zxf jdk-7u21-linux-x64.tar.gz
[root@itchenyi-04 ~]# mv jdk1.7.0_21//SOFTWARE/JDK
[ root@itchenyi-01 ~]# cat >> ~/.bash_profile <<eof
java_home=/software/jdk
Export Java_home
&NBSP
path= $JAVA _home/bin: $PATH
Export PATH
EOF
[root@itchenyi-04 ~]# source ~/.bash_profile


 
[root@itchenyi-01 ~]# cat >> ~/.bash_profile <<eof
cppflags= "-i/software/mysql/include "
Export cppflags
EOF
[root@itchenyi-04 ~]# source ~/.bash_profile

3. Installation CYRUS-SASL

The code is as follows Copy Code

&NBSP
[root@itchenyi-04 ~]# tar zxf cyrus-sasl-2.1.25.tar.gz
[root@itchenyi-04 ~]# cd cyrus-sasl-2.1.25
[root@itchenyi-04 cyrus-sasl-2.1.25]#./configure--PREFIX=/SOFTWARE/SASL2--enable-login--with-openssl=/software/ openssl/--enable-java--with-javabase=/software/jdk--with-mysql=/software/mysql/--enable-sql
[ root@itchenyi-04 cyrus-sasl-2.1.25]# make && make install
[root@itchenyi-04 cyrus-sasl-2.1.25]# ln-s/ SOFTWARE/SASL2/LIB/SASL2/USR/LIB64/SASL2
[root@itchenyi-04 cyrus-sasl-2.1.25]# cat >> ~/.bash_profile < <eof
 
ld_library_path=/mnt/db-5.3.21/build_unix/.libs: $LD _library_path
Export Ld_library_path
cppflags= "-i/software/bdb/include-i/software/sasl2/include/sasl-i/software/sharelib/include"
LDFLAGS= "- L/software/bdb/lib-l/software/sasl2/lib-l/software/sharelib/lib "
Export cppflags ldflags
PATH=/software/ Bdb/bin: $PATH
EOF
[root@itchenyi-04 ~]# source ~/.bash_profile

4. Installation BDB

The code is as follows Copy Code


[root@itchenyi-04 ~]# tar zxf db-5.3.21.tar.gz
[root@itchenyi-04 ~]# CD db-5.3.21/build_unix/
[Root@itchenyi-04 build_unix]#. /dist/configure--prefix=/software/bdb--enable-java--enable-sql--enable-sql_codegen
[root@itchenyi-04 build_unix]# make && make install
[Root@itchenyi-04 build_unix]# ln-s/software/bdb/lib/usr/lib

5. Installation OpenLDAP

The code is as follows Copy Code
[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-ldap--enable-sql
#make Test action recommendations are performed separately
[root@itchenyi-04 openldap-2.4.39]# make && make test && make install

Change OPENLDAP configuration, do not copy and paste directly

The code is as follows Copy Code
[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

Start a service

The code is as follows Copy Code


#简历数据存储的配置文件
[root@itchenyi-04 ~]# cd/software/openldap/var/openldap-data/&& CP db_config.example DB_CONFIG
[root@itchenyi-04 openldap-data]#/software/openldap/libexec/slapd-d 256-h "ldap://1.1.1.5"

Test OpenLDAP

The code is as follows Copy Code


[root@itchenyi-04 ~]#/software/openldap/bin/ldapsearch-x-B ' s base ' (objectclass=*) ' Namingcontexts-h 1.1.1.5-p 38 9
# 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

Initialize, add a little bit of data in

/tbody>
  code is as follows copy code
&NBSP;
[ 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.