Main menu

Install and configure 389 Directory server CentOS7

In this section we will see how to install and configuration 389 directory server in CentOS7 machine.

389 Directory server is an alternative of popular directory server OpenLDAP and as free and open source. It’s an extremely easy to configure drop-in replacement for OpenLDAP server.
Some of the key features of 389DS.

  • multi-master replication : Fault tolerance with write.
  • Admin console : Mangement console for managing 389-DS
  • password polices
  • Active directory Sync : Synchronize
  • Secure authentication use (SASL, SSLv2 and TLS)
  • LDAPv3 Support

Install and configure 389 Directory server CentOS7

389DS not comes within the default repository of CentOS. We need to add an additional EPEL repository to install  389 Directory server.

[root@technet ~]# yum install epel-release -y

Creating a user for 389 Directory Server.

[root@technet ~]# useradd ldapadmin
[root@technet ~]# passwd ldapadmin

Check if selinux is enabled and disable during the installation.

[root@technet ~]# getenforce
 Enforcing
[root@technet ~]# setenforce 0
[root@technet ~]# getenforce
 Permissive

We need to optimize system for LDAP performance and security. Need to configure maximum number of open files in  system, tcp keep alive timeout and port range can be used.

Open /etc/sysctl.conf and add this at the end of file.

net.ipv4.tcp_keepalive_time = 300
net.ipv4.ip_local_port_range = 1024 65000
fs.file-max = 64000

Load the new configuration with sysctl commnad

[root@technet ~]# sysctl -p

Open /etc/security/limits.conf and append these configuration at the end of file

*               soft     nofile          8192
*               hard     nofile          8192

Open  /etc/pam.d/login and append these at the end of file

[...]
session    required     /lib/security/pam_limits.so

Directory works on FQDN name and it should be resolvable during the installation. If you don’t have a DNS server configured add your FQDN name in your host file along with your IP address

[root@technet ~]#  vi /etc/hosts
 x.x.x.x yourdomain.com

Search for the 389 Directory server in your repository.

[root@technet ~]# yum search 389
 Loaded plugins: fastestmirror
 Determining fastest mirrors
 * base: centos.mirror.net.in
 * epel: ftp.cuhk.edu.hk
 * extras: centos.mirror.net.in
 * updates: centos.mirror.net.in
 ========================================= N/S matched: 389 
 389-adminutil.x86_64 : Utility library for 389 administration
 389-admin.x86_64 : 389 Administration Server (admin)
 389-adminutil-devel.x86_64 : Development and header files for 389-adminutil
 389-ds-base.x86_64 : 389 Directory Server (base)
 389-ds-base-devel.x86_64 : Development libraries for 389 Directory Server
 389-ds-base-libs.x86_64 : Core libraries for 389 Directory Server

Now it’s time to install 389 Directory Server with admin interface.

[root@technet ~]# yum install 389-ds-base 389-admin 389-adminutil -y

After the installation, 389 directory server provides two setup utility for post configuration. setup-ds-admin.pl if you want to install and configure 389DS with admin console or setup-ds.pl if you want to install only the core of 389DS.

Let’s run setup-ds-admin.pl configuration utility.

[root@technet ~]# setup-ds-admin.pl
NOTICE : System is x86_64-unknown-linux3.10.0-123.20.1.el7.x86_64 (1 processor).
WARNING: 980MB of physical memory is available on the system. 1024MB is recommended for best performance on large production system.
NOTICE : The net.ipv4.tcp_keepalive_time is set to 7200000 milliseconds
 (120 minutes).  This may cause temporary server congestion from lost
 client connections.
WARNING: There are only 1024 file descriptors (soft limit) available, which
 limit the number of simultaneous connections.
WARNING  : The warning messages above should be reviewed before proceeding.
Would you like to continue? [no]: yes

If you are getting these warning you can recheck all the configuration from the starting or you can continue the installation, these are just warnings not an errors.

[root@technet dirsrv]# setup-ds-admin.pl

==============================================================================
This program will set up the 389 Directory and Administration Servers.

It is recommended that you have "root" privilege to set up the software.
Tips for using this program:
- Press "Enter" to choose the default and go to the next screen
- Type "Control-B" then "Enter" to go back to the previous screen
- Type "Control-C" to cancel the setup program

Would you like to continue with set up? [yes]: yes

==============================================================================
Your system has been scanned for potential problems, missing patches,
etc.  The following output is a report of the items found that need to
be addressed before running this software in a production
environment.

389 Directory Server system tuning analysis version 23-FEBRUARY-2012.

NOTICE : System is x86_64-unknown-linux3.10.0-123.20.1.el7.x86_64 (1 processor).

WARNING: 980MB of physical memory is available on the system. 1024MB is recommended for best performance on large production system.

NOTICE : The net.ipv4.tcp_keepalive_time is set to 7200000 milliseconds
(120 minutes).  This may cause temporary server congestion from lost
client connections.

WARNING: There are only 1024 file descriptors (soft limit) available, which
limit the number of simultaneous connections.

WARNING  : The warning messages above should be reviewed before proceeding.

Would you like to continue? [no]: yes

==============================================================================
Choose a setup type:

1. Express
Allows you to quickly set up the servers using the most
common options and pre-defined defaults. Useful for quick
evaluation of the products.

2. Typical
Allows you to specify common defaults and options.

3. Custom
Allows you to specify more advanced options. This is
recommended for experienced server administrators only.

To accept the default shown in brackets, press the Enter key.

Choose a setup type [2]: 3

==============================================================================
Enter the fully qualified domain name of the computer
on which you're setting up server software. Using the form
<hostname>.<domainname>
Example: eros.example.com.

To accept the default shown in brackets, press the Enter key.

Warning: This step may take a few minutes if your DNS servers
can not be reached or if DNS is not configured correctly.  If
you would rather not wait, hit Ctrl-C and run this program again
with the following command line option to specify the hostname:

General.FullMachineName=your.hostname.domain.name

Computer name [technet.sector19.net.sector19.net]: technet.sector19.net

==============================================================================
The servers must run as a specific user in a specific group.
It is strongly recommended that this user should have no privileges
on the computer (i.e. a non-root user).  The setup procedure
will give this user/group some permissions in specific paths/files
to perform server-specific operations.

If you have not yet created a user and group for the servers,
create this user and group using your native operating
system utilities.

System User [nobody]: ldapadmin
System Group [nobody]: ldapadmin

==============================================================================
Server information is stored in the configuration directory server.
This information is used by the console and administration server to
configure and manage your servers.  If you have already set up a
configuration directory server, you should register any servers you
set up or create with the configuration server.  To do so, the
following information about the configuration server is required: the
fully qualified host name of the form
<hostname>.<domainname>(e.g. hostname.example.com), the port number
(default 389), the suffix, the DN and password of a user having
permission to write the configuration information, usually the
configuration directory administrator, and if you are using security
(TLS/SSL).  If you are using TLS/SSL, specify the TLS/SSL (LDAPS) port
number (default 636) instead of the regular LDAP port number, and
provide the CA certificate (in PEM/ASCII format).

If you do not yet have a configuration directory server, enter 'No' to
be prompted to set up one.

Do you want to register this software with an existing
configuration directory server? [no]: no

==============================================================================
Please enter the administrator ID for the configuration directory
server.  This is the ID typically used to log in to the console.  You
will also be prompted for the password.

Configuration directory server
administrator ID [admin]: admin
Password:*********
Password (confirm):********

==============================================================================
The information stored in the configuration directory server can be
separated into different Administration Domains.  If you are managing
multiple software releases at the same time, or managing information
about multiple domains, you may use the Administration Domain to keep
them separate.

If you are not using administrative domains, press Enter to select the
default.  Otherwise, enter some descriptive, unique name for the
administration domain, such as the name of the organization
responsible for managing the domain.

Administration Domain [sector19.net]: sector19.net

==============================================================================
The standard directory server network port number is 389.  However, if
you are not logged as the superuser, or port 389 is in use, the
default value will be a random unused port number greater than 1024.
If you want to use port 389, make sure that you are logged in as the
superuser, that port 389 is not in use.

Directory server network port [389]:

==============================================================================
Each instance of a directory server requires a unique identifier.
This identifier is used to name the various
instance specific files and directories in the file system,
as well as for other uses as a server instance identifier.

Directory server identifier [technet]:

==============================================================================
The suffix is the root of your directory tree.  The suffix must be a valid DN.
It is recommended that you use the dc=domaincomponent suffix convention.
For example, if your domain is example.com,
you should use dc=example,dc=com for your suffix.
Setup will create this initial suffix for you,
but you may have more than one suffix.
Use the directory server utilities to create additional suffixes.

Suffix [dc=sector19, dc=net]:

==============================================================================
Certain directory server operations require an administrative user.
This user is referred to as the Directory Manager and typically has a
bind Distinguished Name (DN) of cn=Directory Manager.
You will also be prompted for the password for this user.  The password must
be at least 8 characters long, and contain no spaces.
Press Control-B or type the word "back", then Enter to back up and start over.

Directory Manager DN [cn=Directory Manager]: cn=manager
Password:******
Password (confirm):*******

==============================================================================
You may install some sample entries in this directory instance.  These
entries will be installed in a separate suffix and will not interfere
with the normal operation of the directory server.

Do you want to install the sample entries? [no]: yes

==============================================================================
You may wish to populate your new directory instance with some data.
"You may already have a file in LDIF format to use or some suggested
entries can be added.  If you want to import entries from an LDIF
file, you may type in the full path and filename at the prompt.  If
you want the setup program to add the suggested entries, type the
word suggest at the prompt.  The suggested entries are common
container entries under your specified suffix, such as ou=People and
ou=Groups, which are commonly used to hold the entries for the persons
and groups in your organization.  If you do not want to add any of
these entries, type the word none at the prompt.

Type the full path and filename, the word suggest, or the word none [suggest]:

==============================================================================
The Administration Server is separate from any of your web or application
servers since it listens to a different port and access to it is
restricted.

Pick a port number between 1024 and 65535 to run your Administration
Server on. You should NOT use a port number which you plan to
run a web or application server on, rather, select a number which you
will remember and which will not be used for anything else.

Administration port [9830]:

==============================================================================
If you want to configure the Administration Server to bind
to a specific IP address, enter the address below.

IP address [0.0.0.0]:

==============================================================================
The Administration Server program runs as a certain user on your
system. This user must have permission to modify files and directories
for your Directory server as well as the Administration server.  You
are strongly encouraged to use a non-privileged (i.e. non-root) user.

Run Administration Server as [ldapadmin]:

==============================================================================
The interactive phase is complete.  The script will now set up your
servers.  Enter No or go Back if you want to change something.

Are you ready to set up your servers? [yes]:
Creating directory server . . .
Your new DS instance 'technet' was successfully created.
Creating the configuration directory server . . .
Beginning Admin Server creation . . .
Creating Admin Server files and directories . . .
Updating adm.conf . . .
Updating admpw . . .
Registering admin server with the configuration directory server . . .
Updating adm.conf with information from configuration directory server . . .
Updating the configuration for the httpd engine . . .

Starting and enabling 389DS services.

[root@technet ~]# systemctl enable dirsrv
[root@technet ~]# systemctl enable dirsrv-admin 
[root@technet ~]# start-dirsrv
[root@technet ~]# start-ds-admin

Check if 389DS having open ports.

## netstat -tunlp | grep -E '9830|389'

Configure iptables to open 389DS ports

## iptables -A INPUT -p tcp --dport 389  -m state --state NEW -j ACCEPT
## iptables -A INPUT -p tcp --dport 9830  -m state --state NEW -j ACCEPT
## service iptables save

Verify 389DS Schema

ldapsearch -x -b "dc=yourdomain,dc=com"
 ...
 # search result
 search: 2
 result: 0 Success

Next : Configure clients to use 389DS as a login server (Working on this article)

 [root@technet config]# yum install sssd-ldap
 [root@technet]# yum install openldap-clients.x86_64
 [root@technet]# yum install nss-pam-ldapd
 [root@technet]# authconfig-tui
 [root@technet]# getent passwd
 [root@technet]# yum install php-ldap
  • Charliemopps

    Nope: Error: Could not create directory server instance ‘ldap’.
    This guide doesn’t work. As there’s no date on it, no telling how old this is.

    • Let me know if i can help you to setup directory server.

FacebookTwitterGoogle+RSS