×


OpenLDAP on Ubuntu Steps to install it

Are you trying to install OpenLDAP on Ubuntu?

This guide will help you.


OpenLDAP is an open-source implementation of LDAP that can act as both server and client.

It is basically an LDAP (Lightweight Directory Access Protocol) which is an open and cross platform protocol used for directory services authentication. LDAP provides the communication language that applications use to communicate with other directory services servers.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform OpenLDAP related queries.

In this context, we shall look into how to install OpenLDAP on Ubuntu.


More information about OpenLDAP ?

OpenLDAP is an open-source implementation of the Lightweight Directory Access Protocol(LDAP) which is very flexible, and, of course, is free.

It is useful in managing OpenVPN infrastructure, Kubernetes and Docker implementations, backend Jenkins, and thousands of other applications. Also, it is used by organizations that want to connect users to more technical IT resources, such as Linux-based applications, servers, and storage.


How to Install and configure OpenLDAP on Ubuntu ?

Before we begin the installation process, we must install the necessary software. It is great that the packages are all available in Ubuntu's default repositories.


i. First, we run the below command in the terminal window to take care of the update/upgrade.

$ sudo apt-get update
$ sudo apt-get upgrade

ii. Once that finishes, we're now ready to install OpenLDAP. For that, we run the below command.

$ sudo apt-get install slapd ldap-utils

During the installation, we need to select and confirm an administrator password for LDAP.

iii. After the installation completes, we modify the default Directory Information Tree (DIT) suffix. We'll change our DIT to dc=ibmimedia, dc=com. For that, we run the below command.

$ sudo dpkg-reconfigure slapd

iv. For the first question, we answer No(omitting an initial configuration). Next, need to configure the DNS domain name, Organization name, and then enter/verify the admin password we created during the installation.

v. After doing that, we select MDB as the database backend and then select No for removing the database when slapd purges.


vi. Finally, we select Yes to move the old database, and No to Allow LDAPv2 protocol.


That's how to install and configure LDAP.


How to Populate the LDAP database ?

Now let's add initial data to the LDAP database. We’ll do this from a file and create a single entry. For that, we run the below command.

$ nano ldap_data.ldif

In this new file, we add the below contents.

dn: ou=People,dc=ibmimedia,dc=com
objectClass: organizationalUnit
ou: People
dn: ou=Groups,dc=ibmimedia,dc=com
objectClass: organizationalUnit
ou: Groups
dn: cn=DEPARTMENT,ou=Groups,dc=ibmimedia,dc=com
objectClass: posixGroup
cn: SUBGROUP
gidNumber: 5000
dn: uid=USER,ou=People,dc=ibmimedia,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: USER
sn: LASTNAME
givenName: FIRSTNAME
cn: FULLNAME
displayName: DISPLAYNAME
uidNumber: 10000
gidNumber: 5000
userPassword: USER
gecos: FULLNAME
loginShell: /bin/bash
homeDirectory: USERDIRECTORY

We save and close this file. We add the content of the file to LDAP by running the below command.

$ ldapadd -x -D cn=admin,dc=ibmimedia,dc=com -W -f ldap_data.ldif

After successfully authenticating with the LDAP admin password, the data will be added. We then search the database with the command:

$ ldapsearch -x -LLL -b dc=ibmimedia,dc=com 'uid=USER' cn gidNumber

Where USER is the name of the user we added. As a result, of the above command, we must see a list of users.

Finally, now we have our first entry in the LDAP database.


[Need urgent assistance with Ubuntu queries? – We'll help you. ]


Conclusion

This article will guide you on the steps to #install and configure #OpenLDAP on #Ubuntu.

OpenLDAP is a open source implementation of #LDAP in Linux.

If it's your #server, you will know just by looking at the running services. When you are there, run #netstat and probably you will see LDAP listening only on localhost . Remotely, if the server is listening on #localhost , you cannot know just by running nmap , the port will not answer for the public #interface.

To Install and Configure OpenLDAP on #CentOS / #RHEL #Linux:

1. Install OpenLDAP Packages. On CentOS and RedHat, use yum install as shown below, to install the openldap related packages. 

2. LDAP #Config Files. config. 

3. Create olcRootDN Account as Admin. 

4. Create olcRootPW Root Password. 

5. Create olcSuffix #Domain Name. 

6. Verify The #Configuration Files. 

7. Start the LDAP Server. 

8. Verify the LDAP Search.