OpenLDAP Server Setup

OpenLDAP Server is an open-source implementation of the Lightweight Directory Access Protocol (LDAP) used to manage and access directory information over a network. It acts as a centralized directory service that stores and organizes data, such as user information, network resources, and organizational structures, in a hierarchical format. OpenLDAP is widely used for authentication and authorization in enterprise environments, allowing applications and systems to query and manage user credentials, access controls, and other directory-based data. Its flexibility, scalability, and compliance with LDAP standards make it a popular choice for organizations needing a robust directory service.

We will be using the following hardware and softwares during the deployment :

OS :  Ubuntu Sever 22.04LTS
Storage :  100GiB Min
Ram : 4GiB Min 
CPU : 4vCPU

Refrence URL : https://adamtheautomator.com/openldap/

Step -1 : Setting up the hostname & FQDN of the linux severs

sudo hostnamectl set-hostname ldapserver

Now we have to setup the FQDN of the machine so we will have to edit the file "/etc/hosts"

sudo vi /etc/hosts
> 172.0.1.0    ldapserver.rookie.com    ldapserver 

Upon rebooting the system we have sucessfully configured the server hostname & the FQDN to verify the same :

$> hostname 
ldapserver

$> hostname --fqdn
ldapserver.rookie.com
Machine Hostname Details

Step -2 Installing the required packages :

$> sudo apt update -y
$> sudo apt install apache2 php php-cgi libapache2-mod-php php-mbstring php-common php-pear -y

This will install all the dependencies and now we will install the LDAP packages on the server

$> sudo apt install slapd ldap-utils -y && sudo apt install ldap-account-manager -y

upon installing this there will be a pinkish page appers with some necessary details to be required

After configuring the Administrative password we can see the LDAP service is running

Once the ldap service is up & running we will reconfigure the server settings to configure the LDAP service on the server

$> sudo dpkg-reconfigure slapd 

Again the pinkish screen will apper and we will have to configure the settings here

Enter the domain name in my case it is rookie.com

Upon configuring all the options we can complete the setup & it should result in output like this :

Now we have to edit the config file as follows :

$> sudo vi /etc/ldap/ldap.conf    

We have to add two lines as shown in the last of the image above

BASE    dc=rookie,dc=com
URI    ldap://localhost

Now we have sucessfully configured the LDAP server


Step -3 : Testing & Verification

$> ldapserarch -x
$> sudo slapcat

Now we have sucessfully deployed the LDAP server, On the next section we will learn how to setup the LDAP Account Manager to efficiently manage the LDAP server.

Last updated