📅  最后修改于: 2023-12-03 15:33:18.135000             🧑  作者: Mango
This guide will walk you through the installation of OpenLDAP on CentOS 8 using Shell-Bash. OpenLDAP is an open-source implementation of the Lightweight Directory Access Protocol (LDAP) that is used for managing user authentication, authorization, and other directory-related services.
Before starting the installation process, you should have:
To install OpenLDAP on CentOS 8, use the following command:
sudo dnf install openldap-servers openldap-clients
This will install OpenLDAP server and client packages on your CentOS 8 machine.
Once the installation is completed, you need to configure OpenLDAP by editing its configuration file slapd.conf
. You can find this file in the /etc/openldap
directory.
sudo vi /etc/openldap/slapd.conf
This file contains the settings for OpenLDAP server. You need to set the following parameters:
suffix
: The base DN for your LDAP directory.rootdn
: The root DN for your LDAP directory.rootpw
: The root password for your LDAP directory.For example, if you want your LDAP directory to be named example.com
, you can set the suffix as follows:
suffix "dc=example,dc=com"
You also need to set the root DN and password:
rootdn "cn=admin,dc=example,dc=com"
rootpw {SSHA}<your-encrypted-password>
Note that you need to generate an encrypted password to secure your root password. You can use the following command to generate an encrypted password:
sudo slappasswd -s <your-password>
After you have made the necessary changes, save and close the file.
Now start OpenLDAP service with the command:
sudo systemctl start slapd
To verify that the service is running properly, check its status:
sudo systemctl status slapd
The output should show that the service is active and running.
To validate that OpenLDAP is working, you can use the ldapsearch
command to search for a record in your LDAP directory. For example, to search for the rootdn
user, use the following command:
sudo ldapsearch -x -b 'dc=example,dc=com' -D 'cn=admin,dc=example,dc=com' -W cn=admin
This will prompt you for the rootpw
that you set in the slapd.conf file. If the search returns a result, then you have successfully installed and configured OpenLDAP on CentOS 8.
In this guide, we have shown you how to install and configure OpenLDAP on CentOS 8 using Shell-Bash. With OpenLDAP installed, you can now manage your LDAP directory to authenticate and authorize users and services in your network.