Create a 389 Directory Server Instance with dscreate and an INF File

Generate a dscreate INF template, configure instance and backend settings, protect credentials, run dscreate from-file, and verify the new 389 Directory Server suffix.

Published

Updated

Read time 12 min read

Reviewed byDeepak Prasad

Create a 389 Directory Server Instance with dscreate and an INF File

An INF file gives you a repeatable, reviewable way to create a 389 Directory Server instance without stepping through dscreate interactive prompts. In this guide, I'll generate a template from the installed dscreate version, edit the values that matter for the deployment, protect the file because it can hold the Directory Manager password, and run dscreate from-file to provision the instance.

Before you start:

NOTE
Privilege requirement: The commands in this article create a standard system-wide instance and should be run as root or through sudo command. Non-root Directory Server installations use a different prepared directory layout. See Run a 389 Directory Server instance as a non-root user.

Tested on: Rocky Linux 10.2; 389 Directory Server 3.2.0.


When should you use a dscreate INF file?

Use an INF file when you need the same instance layout more than once or when you want human review before anything is written to disk.

Scenario Why an INF file helps
Repeatable lab builds Same ports, suffix, and backend every time you rebuild a VM
Automation and scripting CI or configuration management can render the file and call dscreate from-file
Consistent production baselines Operators approve one file instead of ad hoc interactive answers
Review before creation Diff the INF in a merge request before it touches a server
Choosing a setup method Interactive setup is useful for exploration; an INF file is the primary course workflow for reproducible instance creation

Interactive creation with dscreate interactive is covered in Install 389 Directory Server. Non-root instance layouts, multiple instances on one host, and general dsctl or dsconf usage belong in their own chapters.


Plan the Directory Server instance

Decide these values before you generate the template. Three names often get mixed up:

Setting Example What it identifies
Instance name ldap1 The running server (dirsrv@ldap1, paths under slapd-ldap1)
Backend name userroot The database backend object that stores suffix data (shown in parentheses by dsconf backend suffix list)
Directory suffix dc=example,dc=com The LDAP naming context clients search under

The instance name is fixed after creation. The suffix is the directory namespace. The backend is the server-side object that connects that suffix to LMDB storage and indexes. They are related but not interchangeable.

Setting Example
Server hostname ldap1.example.com
Directory Manager DN cn=Directory Manager
LDAP port 389
LDAPS port 636
Database library mdb

Confirm the LDAP and LDAPS ports are free on the host before you run dscreate from-file. If another service already owns 389 or 636, choose unused ports in the INF file.


Generate the dscreate INF template

Generate the template from the dscreate version on the server, not from an old blog post or another distribution's package.

Write the template to a file:

bash
dscreate create-template /root/ldap1.inf

The command exits silently on success and leaves a commented INF file at the path you chose. Open the file to review the commonly used parameters and their defaults for the installed release. To include parameters marked as advanced, check the options supported by your installed version with dscreate create-template --help and generate an advanced template when required.

bash
dscreate create-template --advanced /root/ldap1-advanced.inf

The advanced template on 389 DS 3.2.0 in this lab is roughly twice the size of the default template. It exposes low-level installer options such as custom filesystem paths, service user and group settings, and systemd or SELinux integration. The normal template already includes commonly used database, replication, changelog, and index settings, so most deployments do not need --advanced.

Print the template to the terminal when you only want to inspect the format:

bash
dscreate create-template

The output begins with a version header and commented [general] parameters:

text
;
; This is a version 2 ds setup inf file.
...
[general]
# full_machine_name (str)
...
[slapd]
# instance_name (str)

Redirect stdout to a file if you prefer to capture it yourself: dscreate create-template > /root/ldap1.inf.


Understand the INF file sections

The template splits instance-wide settings, server parameters, and backend definitions. You normally uncomment or add only the keys you need rather than filling every commented line.

[general]

General installer settings that control how this instance is created:

Parameter Purpose
config_version INF format version (2 on current releases)
full_machine_name FQDN of the system used during installation and in certificates
start Start the instance when creation completes (True / False)
strict_host_checking When False, skip forward/reverse DNS validation of full_machine_name

Set strict_host_checking = False in isolated labs where the configured hostname does not have working forward and reverse resolution. Leave hostname validation enabled when your environment provides consistent DNS resolution.

[slapd]

Instance identity, privileged account, listeners, TLS bootstrap, and database library:

Parameter Purpose
instance_name Short name passed to dsctl and systemctl (dirsrv@INSTANCE)
root_dn Directory Manager DN (default cn=Directory Manager)
root_password Directory Manager password (minimum eight characters)
port LDAP listener
secure_port LDAPS listener
self_sign_cert Create a self-signed certificate during install
db_lib Database implementation (mdb for LMDB on 3.x)
mdb_max_size Maximum size of the LMDB database environment; plan it according to expected directory and index growth

mdb_max_size limits how large the LMDB database environment can grow. The generated template calculates a default for the current host, which is sufficient for this small lab. For a production deployment, uncomment the setting and choose a value based on expected directory growth and available storage rather than copying a fixed value from another server.

[backend-userroot]

Backend sections use the format [backend-BACKEND_NAME]. The generated template contains [backend-userroot], so the backend identifier becomes userroot in dsconf output. Additional backends can be defined with sections such as [backend-apps], each with its own suffix.

Parameter Purpose
suffix Root DN of the directory data
create_suffix_entry Create the generic root entry for that suffix
sample_entries Load demonstration entries when set to yes

The generated template documents additional backend keys. Those include replication toggles, changelog limits, and index requirements that you can enable when a later chapter needs them. Duplicate the backend section with another unique name when one instance must hold multiple suffix backends.


Create a minimal INF file

Edit /root/ldap1.inf down to a minimal lab configuration. Change the hostname, instance name, suffix, ports, and password for your environment.

ini
[general]
config_version = 2
full_machine_name = ldap1.example.com
start = True
strict_host_checking = False

[slapd]
instance_name = ldap1
root_dn = cn=Directory Manager
root_password = REPLACE_WITH_STRONG_PASSWORD
port = 389
secure_port = 636
self_sign_cert = True
db_lib = mdb

[backend-userroot]
suffix = dc=example,dc=com
create_suffix_entry = True
sample_entries = no

Replace full_machine_name, instance_name, suffix, listener ports, and root_password before you install. create_suffix_entry = True creates the base dc=example,dc=com entry so suffix-scoped searches succeed immediately. sample_entries = no keeps the directory free of demonstration accounts that later course chapters do not use.

Validate syntax and prerequisites without creating files:

bash
dscreate from-file -n /root/ldap1.inf
output
Starting installation ...
Validate installation settings ...
NOOP: Dry run requested
Completed installation for instance: slapd-ldap1

The -n / --dryrun flag validates settings only and skips filesystem installation. The final Completed installation line means validation finished in dry-run mode. It does not register a new instance. Confirm with dsctl -l that no unexpected slapd-INSTANCE name appeared. On a host where the instance already exists, validation reports that conflict instead of altering the system.

An INF file is an installation input. Editing it after dscreate from-file succeeds does not change a running instance. Use dsconf for day-two configuration.


Protect the INF file

The INF file can store the Directory Manager password in plain text. When you pass a filename directly to dscreate create-template, current versions create the file with mode 600. Verify the mode before adding credentials, especially if you generated the file with shell redirection.

bash
ls -l /root/ldap1.inf
output
-rw-------. 1 root root 6991 Jul 15 13:42 /root/ldap1.inf

Permissions are already owner-read/write only (600), which is what you want before storing the Directory Manager password.

I'll set mode 600 on the INF file with the chmod command before I store the Directory Manager password:

bash
chmod 600 /root/ldap1.inf

Treat the file like any other credential-bearing configuration: do not commit it to Git, remove or archive it securely after the instance is created, and render it from a secret manager or ephemeral automation workspace in production rather than keeping long-lived copies on shared disks.


Create the Directory Server instance

Run dscreate from-file when the INF file is ready:

bash
dscreate from-file /root/ldap1.inf
output
Starting installation ...
Validate installation settings ...
Create file system structures ...
Create self-signed certificate database ...
Perform SELinux labeling ...
Create database backend: dc=example,dc=com ...
Perform post-installation tasks ...
Completed installation for instance: slapd-ldap1

dscreate validates the INF, creates instance directories under /etc/dirsrv and /var/lib/dirsrv, initializes the backend and suffix, configures certificates when requested, and starts ns-slapd when start = True. It does not replace day-two administration. Use dsctl and dsconf for that (dsctl commands, dsconf commands).


Verify the new instance

Confirm the instance is registered locally:

bash
dsctl -l
output
slapd-ldap1

Next, check whether the instance process is running. This status check does not prove that remote clients can reach the LDAP listener:

bash
dsctl ldap1 status
output
Instance "ldap1" is running

Check the matching systemd unit with systemctl:

bash
systemctl status dirsrv@ldap1 --no-pager

The Active: active (running) line and Status: "slapd started: Ready to process requests" message confirm ns-slapd started for this instance name.

List the configured suffix:

bash
dsconf ldap1 backend suffix list
output
dc=example,dc=com (userroot)

The parenthesized userroot name is the backend identifier for further dsconf backend commands.

Confirm the database library selected in the INF file:

bash
dsconf ldap1 backend config get | grep nsslapd-backend-implement
output
nsslapd-backend-implement: mdb

A value of mdb confirms LMDB. The db_lib option in [slapd] accepts mdb or bdb; new 3.x deployments should normally use mdb.

Search the suffix base entry over LDAP. A base-scope ldapsearch command against the suffix DN confirms the root entry exists:

bash
ldapsearch -x -H ldap://localhost:389 -D "cn=Directory Manager" -W -b "dc=example,dc=com" -s base

This command uses an unencrypted LDAP connection only for local loopback verification. Do not send Directory Manager credentials over an unencrypted remote connection. For remote administration, use LDAPS or StartTLS after configuring client trust for the server certificate.

Enter the Directory Manager password when prompted. A successful base search returns the dc=example,dc=com entry with objectClass: domain.

output
dn: dc=example,dc=com
objectClass: top
objectClass: domain
dc: example
description: dc=example,dc=com

Reuse the INF file for another instance

You can copy an INF file to build another instance on the same host. Only some values must change:

Value What to change for another instance on the same host
instance_name Must be unique
port and secure_port Must use ports not already occupied
full_machine_name Can normally remain the host FQDN
suffix Can remain the same or be changed, depending on directory design
Backend section name Can remain backend-userroot because it belongs to the new instance

full_machine_name is the system FQDN, not an instance identifier. Separate instances on one host can share the same hostname and suffix. That is common when building replicas or isolated test instances. Each instance still needs its own instance_name and listener ports.

Adjust those fields, run dscreate from-file again, and verify with dsctl -l. See Run multiple 389 Directory Server instances on one host for a complete second-instance example.


Troubleshoot dscreate INF file errors

Symptom Likely cause Fix
Unknown or unsupported INF parameter Typo or option from another release Regenerate the template with dscreate create-template and compare parameter names
Invalid hostname / host check failed FQDN forward or reverse resolution failed Fix DNS or set strict_host_checking = False when resolution is intentionally unavailable
Instance already exists Prior dscreate run left slapd-INSTANCE on disk Run dsctl -l; remove the test instance with dsctl INSTANCE remove --do-it only when you intend to recreate it
LDAP or LDAPS port in use Another service or instance owns the port Choose free ports in [slapd] or stop the conflicting listener
Invalid suffix DN Malformed suffix value Use a valid DN such as dc=example,dc=com
Weak or missing Directory Manager password Password shorter than eight characters or omitted Set root_password to a compliant value in [slapd]
Permission denied reading INF The executing user cannot read the file or traverse its parent directory Check ownership and parent-directory permissions. Keep the INF readable only by the account running dscreate, normally with mode 600
Backend exists but suffix base entry is missing create_suffix_entry was not enabled during creation Confirm with a base ldapsearch. For a disposable lab, recreate the instance with create_suffix_entry = True; otherwise add the suffix entry with LDAP tools

Inspect CLI validation options:

bash
dscreate from-file --help
output
usage: dscreate from-file [-h] [-n] file
  -n, --dryrun  Validate system and configurations only. Do not alter the
                system.

When creation fails after partial progress, check the service journal with journalctl and the instance error log:

bash
journalctl -u dirsrv@ldap1 --no-pager -n 30

Error details also land under /var/log/dirsrv/slapd-ldap1/errors for the instance name you chose in the INF file.


Summary

  1. Generate the template with dscreate create-template from the installed version.
  2. Configure [general], [slapd], and [backend-userroot] for your instance, listeners, and suffix.
  3. Protect the INF file with chmod 600 and keep passwords out of version control.
  4. Run dscreate from-file /root/ldap1.inf (use -n first when you want a dry run).
  5. Verify with dsctl, systemctl, dsconf ldap1 backend suffix list, nsslapd-backend-implement, and a base ldapsearch against the suffix.

What's Next


References


Frequently Asked Questions

1. What is a dscreate INF file?

A dscreate INF file is a structured answer file that lists instance, listener, certificate, and backend settings for dscreate from-file. It replaces interactive prompts with a reviewable configuration you can store, diff, and replay.

2. Should I copy an old INF file from another 389 Directory Server release?

No. Generate a fresh template with dscreate create-template from the installed dscreate version. Parameter names and defaults change between releases, and an old file may reference removed or renamed settings.

3. Can I validate an INF file without creating the instance?

Yes. Run dscreate from-file -n /path/to/file.inf to validate settings and system prerequisites without writing instance files or starting ns-slapd.

4. Why does dscreate create a backend section named backend-userroot?

A backend section uses the format [backend-BACKEND_NAME]. The generated [backend-userroot] section therefore creates a backend named userroot, which appears in parentheses in dsconf backend suffix list. The instance name, backend identifier, and directory suffix remain separate values.
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive …