|
| 1 | +--- |
| 2 | +layout: home |
| 3 | +landing-title: "Getting Started with OpenDJ" |
| 4 | +landing-title2: "Getting Started with OpenDJ" |
| 5 | +description: "Step-by-step guide with CLI commands for quick OpenDJ setup." |
| 6 | +keywords: 'OpenDJ, OpenDJ tutorial, OpenDJ installation, LDAP server setup, OpenIdentityPlatform, generate LDIF data, import-ldif, ldapsearch, directory server, Java LDAP' |
| 7 | +share-buttons: true |
| 8 | +products: |
| 9 | +- opendj |
| 10 | + |
| 11 | +--- |
| 12 | +# Getting Started with OpenDJ |
| 13 | + |
| 14 | +In this article, we will download the latest OpenDJ version, generate and import test data, and perform a search operation. |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | +* Java 8+ for OpenDJ 4.x.x |
| 18 | +* Java 11+ for OpenDJ 5.x.x |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +Download the latest release from GitHub with the following command: |
| 23 | + |
| 24 | +```bash |
| 25 | +export VERSION="$(curl -i -o - --silent https://api.github.com/repos/OpenIdentityPlatform/OpenDJ/releases/latest | grep -m1 "\"name\"" | cut -d\" -f4)" |
| 26 | +echo "last release: $VERSION" |
| 27 | +curl -L https://github.com/OpenIdentityPlatform/OpenDJ/releases/download/$VERSION/opendj-$VERSION.zip --output opendj.zip |
| 28 | +unzip opendj.zip |
| 29 | +cd opendj |
| 30 | +``` |
| 31 | + |
| 32 | +Perform a basic setup with the following command |
| 33 | + |
| 34 | +```bash |
| 35 | +./setup -h localhost -p 1389 --ldapsPort 1636 --adminConnectorPort 4444 --enableStartTLS --generateSelfSignedCertificate --rootUserDN "cn=Directory Manager" --rootUserPassword password --baseDN dc=example,dc=com --cli --acceptLicense --no-prompt |
| 36 | +``` |
| 37 | + |
| 38 | +In the console output you will see something like this: |
| 39 | +``` |
| 40 | +Configuring Directory Server ..... Done. |
| 41 | +Configuring Certificates ..... Done. |
| 42 | +Starting Directory Server ....... Done. |
| 43 | +
|
| 44 | +To see basic server configuration status and configuration, you can launch |
| 45 | +/home/user/opendj/bin/status |
| 46 | +``` |
| 47 | + |
| 48 | +Check the status of the OpenDJ: |
| 49 | + |
| 50 | +```bash |
| 51 | +./bin/status --bindDN "cn=Directory Manager" --bindPassword password |
| 52 | +``` |
| 53 | + |
| 54 | +``` |
| 55 | + --- Server Status --- |
| 56 | +Server Run Status: Started |
| 57 | +Open Connections: 1 |
| 58 | +
|
| 59 | + --- Server Details --- |
| 60 | +Host Name: MacBook-Pro-Maxim.local |
| 61 | +Administrative Users: cn=Directory Manager |
| 62 | +Installation Path: |
| 63 | +/home/user/opendj |
| 64 | +Version: OpenDJ Server 4.10.2 |
| 65 | +Java Version: 11.0.25 |
| 66 | +Administration Connector: Port 4444 (LDAPS) |
| 67 | +
|
| 68 | + --- Connection Handlers --- |
| 69 | +Address:Port : Protocol : State |
| 70 | +-------------:------------------------:--------- |
| 71 | +-- : LDIF : Disabled |
| 72 | +0.0.0.0:161 : SNMP : Disabled |
| 73 | +0.0.0.0:1389 : LDAP (allows StartTLS) : Enabled |
| 74 | +0.0.0.0:1636 : LDAPS : Enabled |
| 75 | +0.0.0.0:1689 : JMX : Disabled |
| 76 | +0.0.0.0:8080 : HTTP : Disabled |
| 77 | +
|
| 78 | + --- Data Sources --- |
| 79 | +Base DN: dc=example,dc=com |
| 80 | +Backend ID: userRoot |
| 81 | +Entries: 0 |
| 82 | +``` |
| 83 | + |
| 84 | + |
| 85 | +## Importing Data |
| 86 | + |
| 87 | +If you don’t have any existing data, you can simply generate it with the following command: |
| 88 | + |
| 89 | +```bash |
| 90 | +./bin/makeldif -o /tmp/test.ldif -c suffix=dc=example,dc=com ./config/MakeLDIF/example.template |
| 91 | +``` |
| 92 | +``` |
| 93 | +Processed 1000 entries |
| 94 | +Processed 2000 entries |
| 95 | +Processed 3000 entries |
| 96 | +Processed 4000 entries |
| 97 | +Processed 5000 entries |
| 98 | +Processed 6000 entries |
| 99 | +Processed 7000 entries |
| 100 | +Processed 8000 entries |
| 101 | +Processed 9000 entries |
| 102 | +Processed 10000 entries |
| 103 | +LDIF processing complete. 10002 entries written |
| 104 | +``` |
| 105 | + |
| 106 | +Import generated data: |
| 107 | + |
| 108 | +```bash |
| 109 | +./bin/import-ldif --ldifFile /tmp/test.ldif --backendID=userRoot -h localhost -p 4444 --bindDN "cn=Directory Manager" --bindPassword password --trustAll |
| 110 | +``` |
| 111 | +``` |
| 112 | +... |
| 113 | +Import task 20251105092509120 has been successfully completed |
| 114 | +``` |
| 115 | + |
| 116 | +## Searching Data |
| 117 | + |
| 118 | +Perform a search for a user with the command below: |
| 119 | + |
| 120 | +```bash |
| 121 | + ./bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "dc=example,dc=com" --searchScope sub "(uid=user.1)" |
| 122 | +``` |
| 123 | +Example output: |
| 124 | +``` |
| 125 | +dn: uid=user.1,ou=People,dc=example,dc=com |
| 126 | +cn: Aaren Atp |
| 127 | +description: This is the description for Aaren Atp. |
| 128 | +employeeNumber: 1 |
| 129 | +givenName: Aaren |
| 130 | +homePhone: +1 403 554 6522 |
| 131 | +initials: AWA |
| 132 | +l: Dallas |
| 133 | + |
| 134 | +mobile: +1 903 040 3970 |
| 135 | +objectClass: inetOrgPerson |
| 136 | +objectClass: organizationalPerson |
| 137 | +objectClass: person |
| 138 | +objectClass: top |
| 139 | +pager: +1 745 770 1195 |
| 140 | +postalAddress: Aaren Atp$79294 Franklin Street$Dallas, CO 05437 |
| 141 | +postalCode: 05437 |
| 142 | +sn: Atp |
| 143 | +st: CO |
| 144 | +street: 79294 Franklin Street |
| 145 | +telephoneNumber: +1 344 623 5820 |
| 146 | +uid: user.1 |
| 147 | +userPassword: {SSHA}jVX/9WQ3eSN2jsVspqA482KQpIN8nFccVZOH6w== |
| 148 | +``` |
0 commit comments