Chapter 2. Installing OpenDJ From the Command Line

This chapter covers command-line installation with additional information on setup options.

Procedure 2.1. To Prepare For Installation

  1. Make sure you have the correct Java environment installed, as described in the Release Notes section on Java Environment requirements.

    If your default Java environment is not appropriate, set OPENDJ_JAVA_HOME to the path to the correct Java environment, or set OPENDJ_JAVA_BIN to the absolute path of the java command. The latter environment variable is useful for example if you have both 32-bit and 64-bit versions of the Java environment installed, and want to make sure you use the 64-bit version.

  2. Download OpenDJ software from one of the following locations.

    • The ForgeRock Enterprise Downloads page has the latest stable, supported release of OpenDJ and the other products in the ForgeRock identity stack.

    • The Nightly Builds page posts links to the latest nightly builds of OpenDJ software. Note that these builds are the working version from the trunk and are not for use in a production environment.

    • The Community Archives page includes stable community builds for previous releases of OpenDJ software.

    The following server software is available.

    OpenDJ-4.8.1-SNAPSHOT.zip

    Cross-platform OpenDJ directory server installation files

    opendj_4.8.1-SNAPSHOT-1_all.deb

    OpenDJ directory server native package for Debian and related Linux distributions.

    opendj-4.8.1-SNAPSHOT-1.noarch.rpm

    OpenDJ directory server native package for Red Hat and related Linux distributions.

    OpenDJ-4.8.1-SNAPSHOT-DSML.war

    Cross-platform OpenDJ DSML gateway web archive

    opendj-rest2ldap-servlet-4.8.1-SNAPSHOT-servlet.war

    Cross-platform OpenDJ REST LDAP gateway web archive

  3. If you plan to install OpenDJ DSML gateway or OpenDJ REST LDAP gateway, make sure you have an appropriate application server installed.

  4. If you plan to configure SSL or TLS to secure network communications between the server and client applications, get a properly signed digital certificate that your client applications recognize, such as one that fits with your organization's PKI or one provided by a recognized certificate authority.

    To use the certificate during installation, the certificate must be located in a key store provided with Java (JKS, JCEKS, PKCS#12), or on a PKCS#11 token. To import a signed certificate into a key store, you can use the Java keytool command.

    See Preparing For Secure Communications in the Administration Guide for examples.

Procedure 2.2. To Install OpenDJ Directory Server

  1. Unzip OpenDJ-4.8.1-SNAPSHOT.zip in the file system directory where you want to install the server.

    Unlike the web-based Quick Setup install, the setup command uses the directory where you unzipped the files as the installation directory, and does not ask you where to install OpenDJ. Therefore, if you want to install elsewhere on the file system, unzip the files in that location.

  2. Run the setup --cli command found in the opendj directory.

    This command starts the setup program in interactive mode on the command line, prompting you for each option. Alternatively, use additional setup options to specify values for the options you choose during interactive mode, thus scripting the installation process. See setup --help and the notes below.

    To perform a non-interactive, silent installation, provide all the options to configure OpenDJ, and then also use the -n or --no-prompt option.

    The setup command without the --cli option runs the Quick Start GUI installer with your local version of software, as does Java WebStart with a remote version of the software.

    $ /path/to/opendj/setup --cli
    READ THIS SOFTWARE LICENSE AGREEMENT CAREFULLY. BY DOWNLOADING OR INSTALLING
    THE FORGEROCK SOFTWARE, YOU, ON BEHALF OF YOURSELF AND YOUR COMPANY, AGREE TO
    BE BOUND BY THIS SOFTWARE LICENSE AGREEMENT. IF YOU DO NOT AGREE TO THESE
    TERMS, DO NOT DOWNLOAD OR INSTALL THE FORGEROCK SOFTWARE.
    
    ...
    
    Please read the License Agreement above.
    You must accept the terms of the agreement before continuing with the
    installation.
    Accept the license (Yes/No) [No]:Yes
    
    What would you like to use as the initial root user DN for the Directory
    Server? [cn=Directory Manager]:
    Please provide the password to use for the initial root user:
    Please re-enter the password for confirmation:
    
    Provide the fully-qualified directory server host name that will be used when
    generating self-signed certificates for LDAP SSL/StartTLS, the administration
    connector, and replication [opendj.example.com]:
    
    On which port would you like the Directory Server to accept connections from
    LDAP clients? [1389]: 
    
    On which port would you like the Administration Connector to accept
    connections? [4444]: 
    
    Do you want to create base DNs in the server? (yes / no) [yes]: 
    
    Provide the base DN for the directory data: dc=example,dc=com
    Options for populating the database:
    
        1)  Only create the base entry
        2)  Leave the database empty
        3)  Import data from an LDIF file
        4)  Load automatically-generated sample data
    
    Enter choice [1]: 3
    
    Please specify the path to the LDIF file containing the data to import: \
    /path/to/Example.ldif
    
    Do you want to enable SSL? (yes / no) [no]:
    
    Do you want to enable Start TLS? (yes / no) [no]:
    
    Do you want to start the server when the configuration is completed? (yes /
    no) [yes]:
    
    
    Setup Summary
    =============
    LDAP Listener Port:            1389
    Administration Connector Port: 4444
    LDAP Secure Access:            disabled
    Root User DN:                  cn=Directory Manager
    Directory Data:                Create New Base DN dc=example,dc=com.
    Base DN Data: Import Data from LDIF File (/path/to/Example.ldif)
    
    Start Server when the configuration is completed
    
    
    What would you like to do?
    
        1)  Set up the server with the parameters above
        2)  Provide the setup parameters again
        3)  Print equivalent non-interactive command-line
        4)  Cancel and exit
    
    Enter choice [1]:
    
    See /var/.../opendj-setup...log for a detailed log of this operation.
    
    Configuring Directory Server ..... Done.
    Importing LDIF file /path/to/Example.ldif ........... Done.
    Starting Directory Server ........... Done.
    
    To see basic server configuration status and configuration you can launch \
    /path/to/opendj/bin/status

    Some notes on the options follow.

    Initial root user DN

    The root user Distinguished Name identifies a user who can perform all administrative and other operations allowed for the server, called root user due to the similarity to the UNIX root. The default, cn=Directory Manager, is a well-known name. If you have reason to be paranoid, you might opt for a different name.

    Initial root user password

    The root user will use simple, password-based authentication. Later you can limit clear text access to avoid snooping, but for now use a strong password here unless this is a throwaway server.

    Fully-qualified directory server host name

    OpenDJ uses fully-qualified host name in self-signed certificates and for identification when you use replication. If you are installing a single server temporarily for evaluation, and are not concerned about replication and whether self-signed certificates can be trusted, then you can use an FQDN such as localhost.localdomain. Otherwise, use an FQDN that other hosts can resolve to reach your server.

    LDAP port

    The default for LDAP is 389. If you are working as a user who cannot open port 389, setup suggests 1389 by default.

    Administration port

    This is the service entrance used to configure the server, run tasks, and so forth. The default is 4444.

    Create base DNs

    You need a base Distinguished Name, such as dc=example,dc=com, to add directory data. If you already have LDIF, the base DN you want is the distinguished name suffix common to all entries in your LDIF. You can provide more than one base DN if your data belongs in more than one suffix.

    Import LDIF

    LDAP data interchange format is the standard text format for expressing LDAP data. If you have LDIF already, one reason you might not want to import the data at the same time you install is because your data uses attributes not defined in the default schema, and so you will wait to add schema definitions before you import.

    If you have a huge data set to import, you no doubt should also increase the import cache size, which you can do by passing a Java properties file. You might also prefer to perform data import offline.

    Enable SSL and TLS

    Enabling Secure Sockets Layer or Transport Layer Security lets you protect the network traffic between directory clients and your server.

    SSL

    SSL requires its own, separate port for LDAPS traffic. The default port for LDAPS is 636. If you are working as a user who cannot open port 636, setup suggests 1636 by default.

    TLS

    TLS lets you use StartTLS to negotiate a secure connection between a client and server, starting from the same server port you configured for LDAP.

    X.509 certificates

    The digital certificate you need for SSL and TLS can be self-signed and created on the fly. Trouble is, client applications view self-signed certificates like fake IDs, and so do not trust them. Self-signed certificates facilitate testing, but are not intended for production use.

    Start the server

    If you do not start the server during installation, you can use the /path/to/opendj/bin/start-ds command later.

  3. Run the status command to make sure your OpenDJ server is working as expected.

    $ /path/to/opendj/bin/status
    
    >>>> Specify OpenDJ LDAP connection parameters
    
    Administrator user bind DN [cn=Directory Manager]:
    
    Password for user 'cn=Directory Manager':
    
              --- Server Status ---
    Server Run Status:        Started
    Open Connections:         1
    
              --- Server Details ---
    Host Name:                opendj.example.com
    Administrative Users:     cn=Directory Manager
    Installation Path:        /path/to/opendj
    Version:                  OpenDJ 4.8.1-SNAPSHOT
    Java Version:             version
    Administration Connector: Port 4444 (LDAPS)
    
              --- Connection Handlers ---
    Address:Port : Protocol : State
    -------------:----------:---------
    --           : LDIF     : Disabled
    0.0.0.0:161  : SNMP     : Disabled
    0.0.0.0:636  : LDAPS    : Disabled
    0.0.0.0:1389 : LDAP     : Enabled
    0.0.0.0:1689 : JMX      : Disabled
    
              --- Data Sources ---
    Base DN:     dc=example,dc=com
    Backend ID:  userRoot
    Entries:     160
    Replication: Disabled
[Note] Note

You can install OpenDJ in unattended and silent fashion, too. See the procedure, Procedure 2.5, “To Install OpenDJ Directory Server With a Properties File”.

Procedure 2.3. To Install From the Debian Package

On Debian and related Linux distributions such as Ubuntu, you can install OpenDJ directory server from the Debian package.

  1. Before you install OpenDJ, install a Java runtime environment if none is installed yet.

    $ sudo apt-get install default-jre
  2. Install the OpenDJ directory server package.

    $ sudo dpkg -i opendj_4.8.1-SNAPSHOT-1_all.deb
    Selecting previously unselected package opendj.
    (Reading database ... 185569 files and directories currently installed.)
    Unpacking opendj (from opendj_4.8.1-SNAPSHOT-1_all.deb) ...
    
    Setting up opendj (4.8.1-SNAPSHOT) ...
    $

    The .deb installs OpenDJ directory server in the directory /opt/opendj.

    The files are owned by root by default, making it easier to have OpenDJ listen on ports 389 and 636.

  3. Configure OpenDJ directory server by using the command sudo /opt/opendj/setup.

    $ sudo /opt/opendj/setup --cli
    ...
    To see basic server configuration status and configuration you can launch
     /opt/opendj/bin/status
  4. Check OpenDJ directory server status.

    $ sudo /opt/opendj/bin/status
    
    
    >>>> Specify OpenDJ LDAP connection parameters
    
    Administrator user bind DN [cn=Directory Manager]:
    
    Password for user 'cn=Directory Manager':
    
              --- Server Status ---
    Server Run Status:        Started
    Open Connections:         1
    
              --- Server Details ---
    Host Name:                ubuntu.example.com
    Administrative Users:     cn=Directory Manager
    Installation Path:        /opt/opendj
    Version:                  OpenDJ 4.8.1-SNAPSHOT
    Java Version:             version
    Administration Connector: Port 4444 (LDAPS)
    
              --- Connection Handlers ---
    Address:Port : Protocol               : State
    -------------:------------------------:---------
    --           : LDIF                   : Disabled
    0.0.0.0:161  : SNMP                   : Disabled
    0.0.0.0:389  : LDAP (allows StartTLS) : Enabled
    0.0.0.0:636  : LDAPS                  : Enabled
    0.0.0.0:1689 : JMX                    : Disabled
    0.0.0.0:8080 : HTTP                   : Disabled
    
              --- Data Sources ---
    Base DN:     dc=example,dc=com
    Backend ID:  userRoot
    Entries:     2002
    Replication: 
  5. If you want to run OpenDJ when the system starts, see create-rc-script.

Procedure 2.4. To Install From the RPM Package

On Red Hat and related Linux distributions such as Fedora and CentOS, you can install OpenDJ directory server from the RPM package.

  1. Log in as superuser to install the software.

    $ su
    Password:
    # 
  2. Before you install OpenDJ, install a Java runtime environment if none is installed yet.

    You might need to download an .rpm to install the Java runtime environment, and then install it using the rpm command.

    # rpm -ivh jre-*.rpm
  3. Install the OpenDJ directory server package.

    # rpm -i opendj-4.8.1-SNAPSHOT-1.noarch.rpm
    Pre Install - initial install
    Post Install - initial install
    
    #

    The .rpm installs OpenDJ directory server in the directory /opt/opendj.

    The files are owned by root by default, making it easier to have OpenDJ listen on ports 389 and 636.

  4. Configure OpenDJ directory server by using the command /opt/opendj/setup.

    # /opt/opendj/setup --cli
    ...
    To see basic server configuration status and configuration you can launch
     /opt/opendj/bin/status
  5. Check OpenDJ directory server status.

    # /opt/opendj/bin/status
    
    
    >>>> Specify OpenDJ LDAP connection parameters
    
    Administrator user bind DN [cn=Directory Manager]:
    
    Password for user 'cn=Directory Manager':
    
              --- Server Status ---
    Server Run Status:        Started
    Open Connections:         1
    
              --- Server Details ---
    Host Name:                fedora.example.com
    Administrative Users:     cn=Directory Manager
    Installation Path:        /opt/opendj
    Version:                  OpenDJ 4.8.1-SNAPSHOT
    Java Version:             version
    Administration Connector: Port 4444 (LDAPS)
    
              --- Connection Handlers ---
    Address:Port : Protocol               : State
    -------------:------------------------:---------
    --           : LDIF                   : Disabled
    0.0.0.0:161  : SNMP                   : Disabled
    0.0.0.0:389  : LDAP (allows StartTLS) : Enabled
    0.0.0.0:636  : LDAPS                  : Enabled
    0.0.0.0:1689 : JMX                    : Disabled
    0.0.0.0:8080 : HTTP                   : Disabled
    
              --- Data Sources ---
    Base DN:     dc=example,dc=com
    Backend ID:  userRoot
    Entries:     2002
    Replication: 
  6. If you want to run OpenDJ when the system starts, see create-rc-script.

Procedure 2.5. To Install OpenDJ Directory Server With a Properties File

You can install OpenDJ directory server by using the setup command with a properties file.

Property names correspond to the option names, but without leading dashes. Options that take no arguments become boolean properties as in the following example.

enableStartTLS=true

If you use a properties file with multiple tools, prefix the property name with the tool name followed by a dot (.), as in the following example.

setup.rootUserPasswordFile=/tmp/pwd.txt

The following steps demonstrate use of a properties file as part of a scripted installation process.

  1. Prepare your properties file.

    This procedure uses the following example properties file.

    #
    # Sample properties file to set up OpenDJ directory server
    #
    hostname                        =opendj.example.com
    ldapPort                        =1389
    generateSelfSignedCertificate   =true
    enableStartTLS                  =true
    ldapsPort                       =1636
    jmxPort                         =1689
    adminConnectorPort              =4444
    rootUserDN                      =cn=Directory Manager
    rootUserPassword                =password
    baseDN                          =dc=example,dc=com
    ldifFile                        =/net/install/dj/Example.ldif
    #sampleData                     =2000

    If you have multiple servers to install, consider scripting creation of the properties files.

  2. Prepare an installation script.

    $ cat /net/install/dj/1/setup.sh
    #!/bin/sh
    
    unzip -d /path/to /net/install/dj/OpenDJ-4.8.1-SNAPSHOT.zip && cd /path/to/opendj
    ./setup --cli --propertiesFilePath /net/install/dj/1/setup.props \
      --acceptLicense --no-prompt
  3. Run your installation script.

    $ /net/install/dj/1/setup.sh
    Archive:  /net/install/dj/OpenDJ-4.8.1-SNAPSHOT.zip
       creating: /path/to/opendj
    ...
      inflating: /path/to/opendj/setup
      inflating: /path/to/opendj/uninstall
      inflating: /path/to/opendj/upgrade
    
    READ THIS SOFTWARE LICENSE AGREEMENT CAREFULLY. BY DOWNLOADING OR INSTALLING
    THE FORGEROCK SOFTWARE, YOU, ON BEHALF OF YOURSELF AND YOUR COMPANY, AGREE TO
    BE BOUND BY THIS SOFTWARE LICENSE AGREEMENT. IF YOU DO NOT AGREE TO THESE
    TERMS, DO NOT DOWNLOAD OR INSTALL THE FORGEROCK SOFTWARE.
    
    ...
    
    Do you accept the License Agreement?yes
    See /var/folders/.../opendj-setup-....log for a detailed log of this operation.
    
    Configuring Directory Server ..... Done.
    Configuring Certificates ..... Done.
    Importing LDIF file /net/install/dj/Example.ldif ....... Done.
    Starting Directory Server ....... Done.
    
    To see basic server configuration status and configuration you can launch
     /path/to/opendj/bin/status

    At this point you can use OpenDJ directory server, or you can perform additional configuration.

Procedure 2.6. To Install OpenDJ REST LDAP Gateway

The OpenDJ REST LDAP gateway functions as a web application in a web application container, running independently of OpenDJ. Alternatively, you can use the HTTP connection handler in OpenDJ directory server. See the procedure, To Set Up REST Access to OpenDJ Directory Server, for instructions.

You configure the gateway to access your directory service by editing opendj-rest2ldap-servlet.json where you deploy the gateway web application.

  1. Deploy opendj-rest2ldap-servlet-4.8.1-SNAPSHOT-servlet.war according to the instructions for your application server.

  2. Edit opendj-rest2ldap-servlet.json where you deployed the gateway web application.

    The default JSON resource for the configuration includes both connection and authentication information, and also mappings. The mappings describe how the gateway translates between JSON and LDAP representations of your data. The default mappings are built to work with generated example data and also the sample content in Example.ldif.

    At minimum, make sure that the host name and port numbers for primaryLDAPServers are properly configured, that authentication reflects the correct simple bind credentials, and that the mappings for the endpoints correctly match your directory data.

    For details on the configuration, see REST LDAP Configuration.

    When connecting to directory servers over LDAPS or LDAP and StartTLS, you can configure the trust manager to use a file-based trust store for server certificates that the gateway should trust. This allows the gateway to validate server certificates signed for example by a Certificate Authority not recognized by the Java environment when setting up LDAPS or StartTLS connections. See Preparing For Secure Communications for an example showing how to use the keytool command to support a server certificate into a trust store file.

  3. Restart the REST LDAP gateway or the application server to make sure the changes are taken into account.

  4. Make sure that your directory server is running, and then check that the gateway is connecting correctly.

    The following command reads Babs Jensen's entry through the gateway to the backend holding data from Example.ldif.

    $ curl http://bjensen:hifalutin@opendj.example.com:8080/rest2ldap/users/bjensen
     ?_prettyPrint=true
    {
      "_rev" : "000000002ee3b764",
      "schemas" : [ "urn:scim:schemas:core:1.0" ],
      "contactInformation" : {
        "telephoneNumber" : "+1 408 555 1862",
        "emailAddress" : "bjensen@example.com"
      },
      "_id" : "bjensen",
      "name" : {
        "familyName" : "Jensen",
        "givenName" : "Barbara"
      },
      "userName" : "bjensen@example.com",
      "displayName" : "Barbara Jensen",
      "manager" : [ {
        "_id" : "trigden",
        "displayName" : "Torrey Rigden"
      } ]
    }

    If you generated example data, Babs Jensen's entry is not included. Try a URL such as http://user.0:password@opendj.example.com:8080/rest2ldap/users/user.0 instead.

Procedure 2.7. To Install OpenDJ DSML gateway

The OpenDJ DSML gateway functions as a web application located in a web application container. The DSML gateway runs independently of OpenDJ directory server. You configure the gateway to access your directory service by editing the ldap.host and ldap.port parameters in the WEB-INF/web.xml configuration file.

  1. Deploy OpenDJ-4.8.1-SNAPSHOT-DSML.war according to the instructions for your application server.

  2. Edit WEB-INF/web.xml to ensure the values for ldap.host and ldap.port are correct.

  3. Restart the web application container according to the instructions for your application server.