FedoraRHEL Based

How To Install OpenLDAP on Fedora 39

Install OpenLDAP on Fedora 39

In this tutorial, we will show you how to install OpenLDAP on Fedora 39. OpenLDAP, or Open Lightweight Directory Access Protocol, is a command-line-driven software that allows IT administrators to build and manage an LDAP directory. It is a specialized database optimized for reading, browsing, and searching, and it supports sophisticated filtering capabilities.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the OpenLDAP on a Fedora 39.

Prerequisites

Before diving into the installation process, let’s ensure that you have everything you need:

  • A server running one of the following operating systems: Fedora 39.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. Fedora 39 provides the Terminal application for this purpose. It can be found in your Applications menu.
  • A network connection or internet access to download the OpenLDAP packages.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install OpenLDAP on Fedora 39

Step 1. Before installing any new software, it’s always a good idea to update your system packages. This ensures that you have the latest versions of all software and libraries, which can help prevent compatibility issues. To update your system packages, open the terminal and run the following command:

sudo dnf clean all
sudo dnf update
sudo dnf install httpd php gcc glibc gd gd-devel wget tar make

Step 2. Installing the OpenLDAP on Fedora 39.

To install the OpenLDAP package, open the terminal and run the following command:

sudo dnf install openldap-servers openldap-clients

After the installation, start the OpenLDAP service using the following command:

sudo systemctl start slapd

To ensure the OpenLDAP service starts automatically at boot, enable it using:

sudo systemctl enable slapd

Step 3. Configuration.

  • Server Configuration.

After successfully installing OpenLDAP, the next step is to configure it. This involves setting up the root password, editing the configuration file, and creating test users.

To set up the root password, use the slappasswd command as follows:

slappasswd

Enter your desired password when prompted. This command generates a hashed password, which you should note down for the next step.

Open the main configuration file using a text editor:

sudo nano /etc/openldap/slapd.d/cn=config.ldif

Find the line that starts with olcRootPW and replace its value with the hashed password generated in the previous step.

To create test users, you need to create an LDIF file. An LDIF (LDAP Data Interchange Format) file is a standard plain-text format for LDAP entries. Here’s an example of how to create a user named “idroot“:

dn: uid=idroot,ou=users,dc=example,dc=com
objectClass: top
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
cn: idroot
uid: idroot
uidNumber: 10000
gidNumber: 10000
homeDirectory: /home/idroot
userPassword: {CLEARTEXT}password
loginShell: /bin/bash
gecos: Test User

Save this content in a file named idroot.ldif and add it to the LDAP directory using the ldapadd command:

ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f idroot.ldif

After setting up the OpenLDAP server, you need to configure the LDAP client. This involves installing the necessary packages and editing the LDAP configuration file.

  • Client Configuration.

First, Install the necessary packages using the following command:

sudo dnf install nss-pam-ldapd

Open the LDAP configuration file using a text editor:

sudo nano /etc/nslcd.conf

Edit the file to match your LDAP server settings. Here’s an example configuration:

uid nslcd
gid ldap
uri ldap://localhost/
base dc=example,dc=com

Congratulations! You have successfully installed OpenLDAP. Thanks for using this tutorial for installing the OpenLDAP on your Fedora 39 system. For additional or useful information, we recommend you check the official OpenLDAP website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button