How to Set up OpenLDAP on CentOS 8
- This is a free source for OpenLDAP on the LDAP protocol. And OpenLDAP is considered to be LDAP, but it is software and lightweight LDAP.
- OpenLDAP is widely used due to its flexibility and cost savings, and it works well with Windows. However, users of Mac, Linux, and others also choose it.
- It can also be compared to Microsoft’s Active Directory.
- An LDAP server is a non-relational database that Access is optimized for use but not for writing data.
- The LDAP server essentially serves to store users’ names and passwords in a centralized server. Against which it can authenticate for further use of existing applications and services.
- It is mainly used as a backend or for the address book.
- Software packages have emerged to streamline LDAP directory creation, implementation, and management. The first is OpenLDAP which streamlines directory creation, implementation, and management.
Now, let’s understand how to set up OpenLDAP. This will require root or sudo.
OpenLDAP does not come directly with Centos 8, so it has to be updated with the apt command “sudo update -y”.
Now, we will install the OpenLDAP server using the command “sudo install openldap openldap-servers -y”.
The following command, “install openldap-clients -y” will install the OpenLDAP client.
After this, to start the sldap service and immediately stop it, use the following two commands:
"systemctl enable slapd"
Now, the root password has to be set through the password command, for which the command is “slappasswd”.
Next, take the old password in it and use the two following commands to configure it:
"ldapadd -Y EXTERNAL -H ldapi:/// -f ldaprootpasswd.ldif"
After configuration, it has to use the appropriate command for OpenLDAP sample configuration:
chown -R ldap:ldap /var/lib/ldap/DB_CONFIG
systemctl restart slapd
Then, the following two commands are used to add the domain to it and make some changes:
ldapmodify -Y EXTERNAL -H ldapi:/// -f ldapdomain.ldif
Now, the process of adding the database is done with these commands:
ldapadd -x -D cn=service,dc=test,dc=com -W -f baseldapdomain.ldif
Then, let us use the following command to create LDAP users and groups:
ldapadd -x -W -D "cn=service,dc=test,dc=com" -f ldapgroup.ldif
The last step is to create and define LDAP, and then, use the command to test it.
ldapadd -x -D cn=service,dc=test,dc=com -W -f ldapuser.ldif
authconfig --enableldap --enableldapauth --ldapserver=ldap.test.com --ldapbasedn="dc=test,dc=com" --enablemkhomedir --update
In this article, we discussed the uses and features of OpenLDAP in Centos 8. Also, how it is set up in the system is shown in this article. We hope that this article will be useful for you.