OpenLDAP is an open-source implementation of the Lightweight Directory Access Protocol (LDAP). It provides a centralized directory service for managing user accounts, groups, and other directory-based information.
sudo apt update
sudo apt upgrade
sudo apt install slapd ldap-utils
During the installation, you will be prompted to set a password for the LDAP administrator. Make sure to remember this password for future use.
sudo dpkg-reconfigure slapd
You can use the ldapsearch command to test whether the OpenLDAP server is running properly.
ldapsearch -x -LLL -H ldap:/// -b dc=example,dc=com
nano base.ldif
Add the following content to the file:
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: Example Company
dc: example
dn: cn=admin,dc=example,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
userPassword: {CLEARTEXT}admin_password
cn: admin
userRole: 1
ldapadd -x -D cn=admin,dc=example,dc=com -W -f base.ldif
Enter the admin password when prompted.
ldapsearch -x -LLL -H ldap:/// -b dc=example,dc=com
You should see the LDAP directory structure you defined in the base.ldif file.
You can further configure OpenLDAP by modifying the slapd.conf file or using the cn=config method.
Congratulations! You have successfully installed and configured OpenLDAP on Ubuntu 22.04. You can now use this directory service for managing user accounts, groups, and other directory-based information in your environment.
What our customers say about us
Create your free account today.