FreeKB - OpenLDAP Install and configure OpenLDAP on Linux
OpenLDAP - Install and configure OpenLDAP on Linux

Use apt-get or yum to install OpenLDAP.

yum install openldap openldap-clients openldap-servers migrationtools


The base directory of OpenLDAP is



Do the following:


After a clean install, your olcDatabase={2}hdb file will not contain olcRootPW, which is your admin OpenLDAP password. Use the slappasswd command to reset your admin OpenLDAP password and then use ldapadd to update your admin root password.

olcRootPW: {SSHA}df934jFHB82hfV737rDF19sdfV#$ds



Configure LDAP for your domain

Next, you will configure LDAP to use your domain name, such as The domain is the top-level entity in an LDAP hierarchy. Later, you will create OUs and add users to OUs.


In the /etc/openldap/slapd.d/cn=config/olcDatabase={1}monitor.ldif file, replace my-domain with your domain name.



Update /usr/share/migrationtools/ to have your domain.

$DEFAULT_BASE = "dc=example,dc=com"


Ensure "config file testing succeeded" is displayed. Checksum errors can be ignored.

~]# slaptest -u
. . .
config file testing succeeded


Start and enable OpenLDAP

Start OpenLDAP using systemctl. Verify that the LDAP service is listening on port 389.

netstat -ant | grep 389
tcp        0      0   *               LISTEN          
tcp6       0      0 :::389                  :::*                    LISTEN


Database schema

Copy the example DB_CONFIG file into the /var/lib/ldap/ directory, and rename the file to DB_CONFIG.

cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG


Add the cosine, nis, and inetorgperson schemas

~]# ldapadd -Y EXTERNAL -H ldapi:// -f /etc/openldap/schema/cosine.ldif
~]# ldapadd -Y EXTERNAL -H ldapi:// -f /etc/openldap/schema/nis.ldif
~]# ldapadd -Y EXTERNAL -H ldapi:// -f /etc/openldap/schema/inetorgperson.ldif


Update /usr/share/migrationtools/ to use extended schema.




Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter fbdb0 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |