In this blog post. you’ll get to learn how to Install and configure OpenLDAP on Ubuntu 18.04 LTS. OpenLDAP is a free and open source implementation of the Lightweight Directory Access Protocol developed by the OpenLDAP Project and released under OpenLDAP Public License.
Before you start the installation, set your system hostname and add it to file
sudo hostnamectl set-hostname ldap.example.com echo "192.168.18.50 ldap.example.com" | sudo tee -a /etc/hosts
ldap.example.com with your correct hostname/valid domain name. When done, install LDAP packages by running the commands below:
sudo apt update sudo apt -y install slapd ldap-utils
During the installation, you’ll be prompted to set LDAP
admin password, provide your desired password, then press <OK>
Confirm the password and continue installation by selecting <ok> with TAB key.
You can confirm that your installation was successful using the command
slapcat to output SLAPD database contents.
Step 2: Add base dn for Users and Groups
The next step is adding a base DN for users and groups. Create a file named
basedn.ldif with below contents:
dn: ou=people,dc=example,dc=com objectClass: organizationalUnit ou: people dn: ou=groups,dc=example,dc=com objectClass: organizationalUnit ou: groups
example and com with your correct domain components.
Now add the file by running the command:
$ ldapadd -x -D cn=admin,dc=example,dc=com -W -f basedn.ldif Enter LDAP Password: adding new entry "ou=people,dc=example,dc=com" adding new entry "ou=groups,dc=example,dc=com"
Step 3: Install LDAP Account Manager on Ubuntu 18.04 LTS – Recommended
I noticed phpLDAPadmin doesn’t work well with PHP 7.2 which is a default version of PHP on Ubuntu 18.04. I recommend you use LDAP Account Manager instead. Follow our guide below to install and configure LDAP Account Manager on Ubuntu 18.04.
The guide also shows you how to add user accounts and groups to your LDAP server.
Step 6: Configure your Ubuntu 18.04 as LDAP Client
The last step is to configure the systems in your network to authenticate against the LDAP server we’ve just configured:
How to configure Ubuntu 18.04 LTS as LDAP Client
Thanks for using our guide to install and configure OpenLDAP server on your Ubuntu 18.04. I recommend installing and using LDAP Account Manager to administer your LDAP server through a web interface.
If you need an advanced centralized user management platform, see