First install the openldap package

sudo apt-get install slapd

Then add the memberOf module and overlay to the schema.

vi member.ldif

Add the following to the file:

dn: cn=module,cn=config
cn: module
objectclass: olcModuleList
objectclass: top
olcmoduleload: memberof.la
olcmodulepath: /usr/lib/ldap

dn: olcOverlay={0}memberof,olcDatabase={1}hdb,cn=config
objectClass: olcConfig
objectClass: olcMemberOf
objectClass: olcOverlayConfig
objectClass: top
olcOverlay: memberof

Save the file and add it to the OpenLDAP config with the following command:

ldapadd -Y EXTERNAL -H ldapi:/// -f member.ldif

[AdSense-B]
Add referential integrety to the ldap config

vi refint.ldif

Add the following to the file:

dn: cn=module,cn=config
cn: module
objectclass: olcModuleList
objectclass: top
olcmoduleload: refint.la
olcmodulepath: /usr/lib/ldap

dn: olcOverlay={1}refint,olcDatabase={1}hdb,cn=config
objectClass: olcConfig
objectClass: olcOverlayConfig
objectClass: olcRefintConfig
objectClass: top
olcOverlay: {1}refint
olcRefintAttribute: memberof member manager owner

[AdSense-A]

Save the file and load the file into the ldap schema

ldapadd -Y EXTERNAL -H ldapi:/// -f refint.ldif

You should now have a fully functional OpenLDAP server with the memeberOf attribute.