Start by updating CentOS repositories and packages to ensure the latest versions are installed: sudo yum update
Install the necessary OpenLDAP packages along with the utilities package: sudo yum install openldap openldap-servers openldap-clients
Enable and start the LDAP service to run on boot: sudo systemctl enable slapd sudo systemctl start slapd
Use the slappasswd command to generate an encrypted password for the LDAP root user: slappasswd
Edit the OpenLDAP configuration file to define your root domain and use the encrypted password: sudo nano /etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif
Create an .ldif file with the base structure (e.g., domain and users) and load it with: ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f base.ldif
Verify that the LDAP server is running and accessible by querying: ldapsearch -x -b "dc=example,dc=com" -D "cn=admin,dc=example,dc=com" -W