How to install LDAP on CentOS 7


LDAP stands for Lightweight Directory Access Protocol and, as the name suggests, it’s a standard protocol for accessing and maintaining distributed directory information services over an IP network.
In this tutorial, we’ll install a LDAP server on Centos 7 using 389 Directory Server.

Getting started

First of all, configure FQDN in /etc/hosts.
In that file, put the server’s fully qualified domain name. localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
X.X.X.X yoursever.hostname.lan server

Of course, substitue the last line in this example with your server’s informations.

Configure firewall

As you may know, we need to allow LDAP server’s default ports via firewall in order to access it from a remote system.

firewall-cmd --permanent --add-port=389/tcp
firewall-cmd --permanent --add-port=636/tcp
firewall-cmd --permanent --add-port=9830/tcp

Now, restart firewalld service.

firewall-cmd --reload

Create an user account

Now, create a new user.

useradd ldapuser

and set a password

passwd ldapuser

Restart CentOS.

Install LDAP Server

Note: you need to have EPEL repository.
Install 389 DS server:

yum install 389-ds-base 389-admin

After installing it, it’s time to configure:


At this point, you have installed and configured everything. You can, of course, tweak something, and, for example, enable directory server and directory admin services automatically on every reboot. It’s up to you!