How to set up LDAP service on CentOS 7?
To set up LDAP service on CentOS 7, you can follow these steps:
- Install the OpenLDAP software package.
- Please install openldap, openldap-servers, and openldap-clients using the command: sudo yum install openldap openldap-servers openldap-clients.
- Start the slapd service:
- Please enable and start the slapd service using systemctl.
- Create a password for the administrator:
- Please use the “sudo” command before running “slappasswd”.
- Enter the administrator password and remember it.
- Create an LDAP configuration file:
- Open the file named “olcDatabase={2}hdb.ldif” located in the directory “/etc/openldap/slapd.d/cn=config/” using the text editor Vi with administrative privileges.
- Edit the document and add the following content:
- Edit the configuration for database {2}hdb in cn=config:
– Replace olcSuffix with dc=my-domain,dc=com
– Replace olcRootDN with cn=admin,dc=my-domain,dc=com
– Replace olcRootPW with the generated administrator password stored in {SSHA} - Replace dc=my-domain,dc=com with your own domain name, and replace the administrator password generated by {SSHA} with the password you generated in step 3.
- Reload LDAP configuration.
- Restart the slapd service using systemctl.
- Install LDAP client tool (optional).
- Install openldap-clients using the sudo command and yum package manager.
Congratulations, you have now successfully set up an LDAP service on CentOS 7. You can use LDAP client tools to manage and query the LDAP server.