Install OpenLDAP in Ubuntu 24.04

In this article, we cover how to install OpenLDAP in Ubuntu 24.04 release. LDAP or Lightweight Directory Access Protocol helps us find and store information about users, applications, etc. within an organization. So, this is how it works:

A user connects to the LDAP directory. A search query is sent and the user authenticates himself/herself. Information associated with the search query is sent to the user and the connection to the LDAP directory is closed.

Note: The following operations require Administrative rights. In case you don’t have the required rights, contact your System Administrator for assistance.

Install OpenLDAP in Ubuntu 24.04

The required packages are part of the standard Ubuntu repository. Therefore, update that first. Open a terminal and issue the following:

sudo apt update

To install OpenLDAP:

sudo apt install slapd

Enter the Administrator password next. The SLAPD is a Standalone LDAP Daemon. It is a server and clients connect to it through LDAP.

We can the status of the SLAPD service through the following command:

systemctl status slapd.service

Configure SLAPD server

Issue the following command in the terminal to reconfigure the installed package:

sudo dpkg-reconfigure slapd

It will prompt us on whether to Omit OpenLDAP Configuration, we went ahead with NO.

Then, enter a DNS domain and organization name. We chose:

“example” for the organization name.

Then, enter the Administrator password. And, it asked us if we wanted to remove the database when slapd is purged, we chose NO. Move old database – YES.

Thereafter, to view the contents of the SLAPD database:


Next, we create a Student group for the Organization unit. So, create an empty file through the touch command-line utility:

sudo touch /etc/ldap/students.ldif

Edit the file:

sudo nano /etc/ldap/students.ldif

Append it with the following entries:

dn: ou=Students,dc=example,dc=org
objectClass: organizationalUnit
ou: Students

This will create the Students group on

Now, run the following command to add the group defined above.

sudo ldapadd -D "cn=admin,dc=example,dc=org" -W -H ldapi:/// -f /etc/ldap/students.ldif

To show groups available on the OpenLDAP server:

ldapsearch -x -b "dc=example,dc=org"

In conclusion, we have covered how to install and configure OpenLDAP in Ubuntu 24.04 release.

Similar Posts