LDAP is the Lightweight Directory Access Protocol, which allows for the querying and modification of an X.500-based directory service. LDAP is used over an IP network to manage and access a distributed directory service. The primary purpose of LDAP is to provide a set of records in a hierarchical structure. If you're curious as to how LDAP fits in with Active Directory, think of it this way: Active Directory is a directory service database, and LDAP is one of the protocols used to communicate with it. LDAP can be used for user validation, as well as the adding, updating, and removing of objects within a directory.
I want to show you how to install OpenLDAP on the latest iteration of Ubuntu, and then how to populate an LDAP database with a first entry. All you will need for this is a running instance of Ubuntu 18.04 and a user account with sudo privileges.
And with that said, let's install.
Step 1 Installation
The first thing you'll want to do is run an update/upgrade on the server. Remember, during this process the kernel could be upgraded, which will require a reboot. Because of this, run the update/upgrade during a time when a reboot is feasible.
To take care of the update/upgrade, open a terminal window and issue the commands:
Once that finishes, you're ready to install OpenLDAP. For this, go back to the terminal window and issue the command:
During the installation, you will be asked to create an admin password for the LDAP directory
You can confirm that your installation was successful using the commandslapcat
to output SLAPD database contents.
Step 2: Add base dn for Users and Groups
The next step is adding a base DN for users and groups. Create a file named basedn.ldif
with below contents:
Now add the file by running the command:
Step 3: Add User Accounts and Groups
Generate a password for the user account to add.
Create ldif file for adding users.
Do the same of group. Create ldif file:
Add group: