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

Updated:   |  OpenLDAP articles

Use apt-get or yum to install OpenLDAP.

yum install openldap openldap-clients openldap-servers migrationtools

 

The base directory of OpenLDAP is

/etc/openldap

 

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 example.com. 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.

olcAccess: 
  "cn=Manager,dc=example,dc=com"

 

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

$DEFAULT_MAIL_DOMAIN = "example.com"
$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 0.0.0.0:389             0.0.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/migrate_common.ph to use extended schema.

$EXTENDED_SCHEMA = 1;

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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