4.6. Silent Setup

Silent setup uses a file to predefine all the Directory Server configuration parameters that are normally supplied interactively with the setup program. The silent functionality allows you to script the setup of multiple instances of Directory Server.

4.6.1. Silent Setup for Directory Server and Administration Server

Silent setup is useful at sites where many server instances must be created, especially for heavily replicated sites that will create a large number of consumer servers. Silent setup uses the same scripts that are used to create instances of Directory Server and Administration Server, with a special option signaling that the script is to be run silently. Silent mode requires referencing a setup parameter file (-s -f setup.inf) or setting Directory Server parameters on the command line.
To run a silent setup of both the Directory Server and Administration Server:
  1. Install the Directory Server packages as in Section 3.2, “Installing the Directory Server Packages”.
  2. Make the setup .inf file. It must specify the following directives:
    [General] 
    FullMachineName=dir.example.com 
    SuiteSpotUserID=dirsrv
    SuiteSpotGroup=dirsrv
    AdminDomain=example.com 
    ConfigDirectoryAdminID=admin 
    ConfigDirectoryAdminPwd=admin 
    ConfigDirectoryLdapURL=ldap://dir.example.com:389/o=NetscapeRoot 
    
    [slapd] 
    SlapdConfigForMC=Yes 
    UseExistingMC=0 
    ServerPort=389 
    ServerIdentifier=dir 
    Suffix=dc=example,dc=com  
    RootDN=cn=Directory Manager 
    RootDNPwd=secret
    ds_bename=exampleDB 
    AddSampleEntries=No
    
    [admin] 
    Port=9830
    ServerIpAddress=111.11.11.11 
    ServerAdminID=admin 
    ServerAdminPwd=admin
    There are three sections of directives in the .inf file to create the default Directory and Administration Servers: [General], [slapd], and [admin]. Creating an additional instance, or installing a single instance of Directory Server using setup-ds.pl, only requires two sections, [General] and [slapd].
    This parameters correspond to the information supplied during a typical setup. The .inf file directives are described more in Appendix A, Parameters in .inf Files.
  3. Run the setup-ds-admin script with the -s and -f options.
    # setup-ds-admin.pl -s -f /export/ds-inf/setup.inf
    Running setup-ds-admin installs both the Directory Server instance and the Administration Server instance. This means that the setup file must specify parameters for both the Directory Server and the Administration Server. -s runs the script in silent mode, and -f /export/ds-inf/setup.inf specifies the setup file to use.
After the script runs, the new Directory Server and Administration Server instances are configured and running, as with a standard setup.

4.6.2. Silent Directory Server Instance Creation

Like setting up both the Directory Server and Administration Server, silent setup for a single instance is useful for configuring multiple instances quickly. Silent setup uses the same scripts that are used to create a new instances of Directory Server, with a special option signaling that the script is to be run silently and referencing the setup file to use.
To run a silent setup of a Directory Server instance:

Note

When creating a single instance of Directory Server, the Directory Server packages must already be installed, and the Administration Server must already be configured and running.
  1. Make the setup .inf file. It must specify the following directives:
    [General] 
    FullMachineName=dir.example.com 
    SuiteSpotUserID=dirsrv
    SuiteSpotGroup=dirsrv
    StrictHostCheck=false
    
    [slapd] 
    ServerPort=389 
    ServerIdentifier=dir 
    Suffix=dc=example,dc=com  
    RootDN=cn=Directory Manager 
    RootDNPwd=secret 
    ds_bename=exampleDB
    SlapdConfigForMC=Yes 
    UseExistingMC=0 
    AddSampleEntries=No
    There are two sections of directives in the instance creation: [General] and [slapd].
    This parameters correspond to the information supplied during a typical setup. The .inf file directives are described more in Appendix A, Parameters in .inf Files.
  2. Run the setup-ds.pl script with the -s and -f options.
    # setup-ds.pl -s -f /export/ds-inf/setup-single.inf
    Running setup-ds.pl installs only a Directory Server instance, so the setup file must specify parameters only for the Directory Server. -s runs the script in silent mode, and -f /export/ds-inf/setup-single.inf specifies the setup file to use.
After the script runs, the new Directory Server instance is configured and running, as with a standard setup.

4.6.3. Sending Parameters in the Command Line

The setup utility, setup-ds-admin.pl, allows settings for all three configuration components — General (host server), slapd (LDAP server), and admin (Administration Server) — to be passed directly in the command line. Command-line arguments correspond to the parameters and values set in the .inf file. The arguments used with setup-ds-admin.pl specify the .inf setup file section (General, slapd, or admin), parameter, and value in the following form:
section.parameter=value
For example, to set the machine name, suffix, and Directory Server port of the new instance, the command is as follows:
# setup-ds-admin.pl General.FullMachineName=ldap.example.com "slapd.Suffix=dc=example,dc=com" slapd.ServerPort=389

Note

For a list of possible parameters you can set, see Appendix A, Parameters in .inf Files.
Passing arguments in the command line or specifying an .inf sets the defaults used in the interactive prompt unless they are used with the s (silent) option.
Argument values containing spaces or other shell special characters must quoted to prevent the shell from interpreting them. In the previous example, the suffix value has a space character, so the entire parameter has to be quoted. If many of the parameters have to be quoted or escaped, use an .inf file instead.
You can use an .inf file in conjunction with command line parameters. Parameters set in the command line override those specified in an .inf file, which is useful for creating an .inf file to use to set up many Directory Servers. Many of the parameters can be the same, such as ConfigDirectoryLdapURL, ones specific to the host, such as FullMachineName have to be unique. For example:
# setup-ds-admin.pl -s -f common.inf General.FullMachineName=ldap37.example.com slapd.ServerIdentifier=ldap37
This command uses the common parameters specified in the common.inf file, but overrides FullMachineName and ServerIdentifier with the command line arguments.

Note

The section names and parameter names used in the .inf files and on the command line are case sensitive. Refer to Appendix A, Parameters in .inf Files to check the correct capitalization.

4.6.4. Using the ConfigFile Parameter to Configure the Directory Server

The ConfigFile parameter in the .inf is an extremely useful tool to configure the directory from the time it is set up. The ConfigFile parameter specified an LDIF file to import into the directory. Since the ConfigFile parameter can be used multiple times, it is a good idea to have multiple LDIF files so that the individual entries are easy to manage.
The ConfigFile parameter is set in the [slapd] section of the .inf.
For example, to configure a new Directory Server instance as a supplier in replication, ConfigFile can be used to create the replication manager, replica, and replication agreement entries:
[slapd]
...
ConfigFile=repluser.ldif
ConfigFile=changelog.ldif
ConfigFile=replica.ldif
ConfigFile=replagreement.ldif
...
The LDIF file contains the entry information. For example, the replica.ldif contains the information to configure the new Directory Server instance as a supplier:
dn: cn=replica,cn="dc=example,dc=com",cn=mapping tree,cn=config
changetype: add
objectclass: top
objectclass: nsds5replica
objectclass: extensibleObject
cn: replica
nsds5replicaroot: dc=example,dc=com
nsds5replicaid: 7
nsds5replicatype: 3
nsds5flags: 1
nsds5ReplicaPurgeDelay: 604800
nsds5ReplicaBindDN: cn=replication manager,cn=config
For more information on LDIF, see the Red Hat Directory Server Administration Guide.
The ConfigFile parameter can be used to create special user entries like the replication manager, to configure views or classes of service, to add new suffixes and databases, to create instances of the Attribute Uniqueness plug-in, and to set many other configurations for Directory Server.