If you need to migrate the contents of an OpenLDAP server into another server, then do the following:

  1. Copy database contents to a file:
    # /etc/init.d/slapd stop
    # slapcat > database.ldif
  2. Copy the configuration file to the new server

    NOTE: If migrating from a server with an old OpenLDAP version (configuration is in slapd.conf) to a newer version (configuration in a directory, like /etc/openldap/slapd.d), do the following in the new server to create the structure (slapd.conf is the file copied from the old server):

    # slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
  3. Recreate the database in the new server:
    # slapadd -l database.ldif