Article Title: how to set a basic OpenLDAPServer. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
I. Purpose
This document describes how to install OpenLDAP and set up a centralized Email Address Book server in the company for the client to query.
Basically, OpenLDAPg is also applied in many other aspects, such as a centralized user account verification server, but mail address book query is the most commonly used.
Ii. Installation
Download the latest openldap software package from www.openldap.org and run the following commands in sequence:
# Tar cvfz openldap-stable-20010524.tgz
# Cd openldap-2.0.11
#./Configure
# Make depend
# Make
# Make test
# Make install
My operating environment is redhat 6.1. If no error is encountered, the LDAP background program slapd is installed to the directory/usr/local/libexec by default; the configuration file is in the/usr/local/etc/openldap/directory, and various OpenLDAP tools ldapadd, ldapdelete, ldapmodify, ldapmodrdn, ldappasswd, and ldapsearch are in the/usr/local/bin directory, the runtime database is in/usr/local/var/openldap-ldbm.
Iii. Settings
1) change the configuration file/usr/local/etc/openldap/slapd. conf in include/usr/local/etc/openldap/schema/core. add the following lines after the schema line, including all solutions.
2) Change the suffix in the "ldbm database definitions" section of the slapd. conf file. The rootdn line is as follows:
Database ldbm
Suffix "o = yourdomain, c = us"
Rootdn "cn = root, o = yourdomain, c = us"
Rootpw secret
Directory/usr/local/var/openldap-ldbm
You can use various formats. Here I use o = yourdomain, c = us indicates that after installing your company domain name and the rootdn format in the country or region, the default value is cn = Manager. Here we change it to root, this is in line with the tradition that root has the highest permissions in Unix/Linux.
3) Now you can start slapd and run/usr/local/libexec/slapd.
You can add/usr/local/bin and/usr/local/libexec to the search PATH, that is, add the PATH row to/etc/profile:
PATH = "$ PATH:/usr/X11R6/bin:/usr/local/libexec". In this way, you only need to type slapd next time you log on.
4) test whether the ldap server works properly.
Run the following command to check whether the output is correct.
# Ldapsearch-x-B 'o = yourdomain, c = ''' (objectclass = *)'
5) edit the. ldif text file and use ldapadd to add records to the LDAP database.
The file content is as follows:
Dn: o = yourdomain, c = us
Objectclass: dcobject
Objectclass: organization
O: yourdomain
Dc: yourdomain
Dn: cn = Jephe Wu, o = yourdomain, c = us
Objectclass: inetorgperson
Cn: Jephe Wu
Sn: Wu
Mail: jephe_wu@yourdomain.com
... More users ......
Similarly, add the records of each person to the file. Note that the object type inetorgperson must have at least cn and sn. Here we use three definitions: cn, sn, and mail, this is sufficient for our email address book function. You can also define mobile, homephone, pager... and so on.
Then, run the following command to add the above. ldif file to the LDAP database.
# Ldapadd-x-D "cn = root, o = yourdomain, c = us"-w secret-f "yourldiffilename"
Note: The first part of the above file "dn: o = yourdomain, c = us" is required; otherwise, data cannot be added. Use your company's domain name to replace the above "yourdomain ".
6) set Outlook Express to allow you to use the LDAP server to query email addresses.
"Tools/accounts/Add -- directory service", fill in the IP address of your server or the domain name of the host, select yes on the next screen to allow you to use directory service to query the address, finally, in the "Directory Service" column, select the configured item "properties/advanced" and enter "o = yourdomain, c = us" in "Search Library ".
Set the corresponding options according to the above information.
Iv. FAQs
1) The Server Load balancer instance can be started, but the database cannot be added. An error occurred while running ldapadd to add "ldap_bind: cannot contact LDAP Server ".
A: The most likely reason is that the 127.0.0.1 localhost project does not exist in/etc/hosts.
2) query order: if there is content in the address book of Outlook Express, the address book takes priority when checking the address. If no corresponding record is found in the local address book, then query the LDAP server.
3) use the following command to make sure that the client communicates with the LDAP server, run the following command on the server, and then test the check address in OE, you will get the output of the connection process for querying the LDAP database.
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