CentOS 5.5 installation log - (7) LDAP installation and basic configuration

2010-12-15  来源:本站原创  分类:OS  人气:126 

Now try installing LDAP (openLDAP).

1 Software Installation:

yum -y install openldap openldap-clients openldap-servers nss_ldap samba samba-client openssl mod_ssl php-ldap php-pdo php-cli php-common perl-LDAP smbldap-tools perl-Digest-SHA1 perl-Digest-SHA perl-Unicode-String perl-Unicode-Map8 perl-Unicode-Map perl-Unicode-MapUTF8 perl-Jcode

Here with a lot of software installed, this line-by-letter knock into, obviously unreasonable. My general practice is that these statements, in particular, have ready the command-line information, copy and paste into Notepad + +, save for the sh file, then psftp uploaded to the / bin, then run.

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

Installed software 38MB size.

2. Openldap configuration

Back up the configuration file:

# cp /etc/ldap.conf /etc/ldap.conf.orig
# cp /etc/nsswitch.conf /etc/nsswitch.conf.orig
# cp -R /etc/openldap /etc/openldap.orig

(1) modify slapd.conf

# Nano / etc / openldap / slapd.conf

I installed Centos set hostname of the machine is: server1.example.com here to configure the domain name in accordance with:

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

First save and exit.

(2) generate rootpw

Enter the command

#/usr/sbin/slappasswd

When prompted, enter my password twice, will produce a string of characters:

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

Pen down this string of characters, huh, huh. I was putty operation, you can simply, this string of characters selected with the mouse, then open the slapd.conf

# Nano / etc / openldap / slapd.conf

Find rootpw line, carriage return, then, right-click of the mouse, just a string of characters pasted on. Then, in the strings with the rootpw

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

Save and exit.

(3) generate DB_CONFIG

# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG

Then granted ownership of the ownership

# chown -R ldap:ldap /var/lib/ldap
# chmod 700 /var/lib/ldap

(4) set the boot

# chkconfig --levels 235 ldap on

Now start:

/etc/init.d/ldap start

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

3 Add record

(1) initialize the log file using Notepad + + to edit a rootinit.ldif file, as follows:

dn: dc=example,dc=com
dc: example
o: example.com
description: Root LDAP entry for example.com
objectClass: top
objectClass: dcObject
objectClass: organization

Save and exit.

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

(2) ou log file using Notepad + + to edit a ou1.ldif file, as follows:

dn: ou=People,dc=example,dc=com
ou: People
objectClass: organizationalUnit

dn: ou=Groups,dc=example,dc=com
ou: Groups
objectClass: organizationalUnit

dn: ou=Hosts,dc=example,dc=com
ou: Hosts
description: All hosts in example.com
objectClass: organizationalUnit

Save and exit.

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

(3) in the Centos machine to build a temporary folder

# mkdir /home/tmp

(4) ldif file upload

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

(5) import the ldif file to import using ldapadd:

# ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f  /home/tmp/rootinit.ldif
# ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f  /home/tmp/ou1.ldif

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

(6) view existing records

# ldapsearch -x -b 'dc=example,dc=com'

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

4 Clear (delete) records

Empty input record is definitely for beginners encounter. I add a record in the process, many errors, so the Internet looking for ways to delete the existing record, Oh, many times to delete several times to add, probably only a little experience.

(1) stop ldap
(2) delete / var / lib / ldap under the file, but keep DB_CONFIG file. If you delete all the files in the directory, and need to copy DB_CONFIG to the directory.

# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG

(3) the authorization to the ldap directory
(4) restart ldap

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

5 Installation and Configuration phpldapadmin

(1) Installation

# yum -y install phpldapadmin

(2) configuration to its configuration file / usr / share / phpldapadmin / config / config.php
I did not change, keep the original settings.

Modify / etc / httpd / conf.d / phpldapadmin.conf

# Nano / etc / httpd / conf.d / phpldapadmin.conf

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

Save and exit. Then restart httpd:

# /etc/init.d/httpd restart

(3) log in the browser can now open phpldapadmin

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

================================================== ====================

The above is a configuration process, many of the problems encountered in the middle, but in the end can be considered to complete the basic configuration. The evening, many articles in the Baidu search to Chinese good tutorial, and makes reading and found out that they have a lot of vague understanding of the need to try.

(1) to empty all of the input stop ldap, delete / var / lib / ldap file only under the retention DB_CONFIG, authorization.
Modify / etc / openldap / slapd.conf file, change the rootdn:

rootdn "cn=root,dc=example,dc=com"

Save, restart ldap.

(2) edit some ldif files, file names and contents are as follows:

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

Then psftp uploaded to / home / tmp.

One by one using ldapadd to import the ldif file:

# ldapadd -x -D "cn=root,dc=example,dc=com" -W -f /home/tmp/init1.ldif

# ldapadd -x -D "cn=root,dc=example,dc=com" -W -f /homr/tmp/ou1.ldif

# ldapadd -x -D "cn=root,dc=example,dc=com" -W -f /home/tmp/wgroup1.ldif

# ldapadd -x -D "cn=root,dc=example,dc=com" -W -f /home/tmp/user1.ldif

View previous input with ldapsearch:

# ldapsearch -x -b "dc=example,dc=com"

(3) a single user password change

Modify user John's password:

# ldappasswd -x -D "cn=root,dc=example,dc=com" -W "uid=John,ou=People,dc=example,dc=com" -S
New password:
Re-enter new password:
Enter LDAP Password:

New password and Re-enter new password is entered John's new password twice, and Enter LDAP Password, enter the password for the LDAP system, that we have already established with slappasswd password.

Modify user ldapadmin password:

# ldappasswd -x -D "cn=root,dc=example,dc=com" -W "uid=ldapadmin,ou=People,dc=example,dc=com" -S
New password:
Re-enter new password:
Enter LDAP Password:

Upon completion, # ldapsearch-x-b "dc = example, dc = com" look, you find the user's password has been changed:

CentOS 5.5 installation log - (7) LDAP installation and basic configuration

================================================== ====================

References:

http://blog.javachap.com/index.php/installing-openldap-on-centos/

http://www.syntaxtechnology.com/2010/05/openldap-on-centos-5-4-part-4-the-data/

http://www.howtoforge.com/ldap-user-authentication-on-centos-5.x

http://www.productionmonkeys.net/guides/ldap-server/openldap-installation

http://www.syntaxtechnology.com/2010/05/openldap-on-centos-5-4-part-4-the-data/

http://www.server-world.info/en/note?os=CentOS_5&p=ldap

Chinese openLDAP configuration very detailed tutorial

http://zhumeng8337797.blog.163.com/blog/#m=0

: -

相关文章