Thursday, October 4, 2012

389-Console Directory Server Installation

  The 389 Directory Server (previously Fedora Directory Server) is an LDAP (Lightweight Directory Access Protocol) server developed by Red Hat. The name 389 is derived from the port number for LDAP                                                                  
I followed the below steps for installing the Directory server.                                                                                                                       
   cd /etc/yum.repos.d
    yum clean all
   yum install xorg-x11-deprecated-libs
   yum install java-1.6.0-openjdk
   yum install 389-ds*
   yum install yum-plugin-protectbase.noarch
   yum -y localinstall epel-release-5-4.noarch.rpm
   yum -y update
   yum install mod_authz_ldap
   yum install openldap-clients

[root@tester tmp] wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
 --2012-09-21 12:36:44--  http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
 Resolving download.fedoraproject.org... 152.19.134.146, 140.211.169.197, 209.132.181.16, ...
 Connecting to download.fedoraproject.org|152.19.134.146|:80... connected.
 HTTP request sent, awaiting response... 302 FOUND
 Location: http://mirrors.einstein.yu.edu/epel/5/x86_64/epel-release-5-4.noarch.rpm [following]
 --2012-07-19 11:36:08--  http://mirrors.einstein.yu.edu/epel/5/x86_64/epel-release-5-4.noarch.rpm
 Resolving mirrors.einstein.yu.edu... 129.98.1.19, 129.98.1.27
 Connecting to mirrors.einstein.yu.edu|129.98.1.19|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 12232 (12K) [application/x-rpm]
 Saving to: `epel-release-5-4.noarch.rpm'
2012-09-21 12:36:44 (437 KB/s) - `epel-release-5-4.noarch.rpm' saved [12232/12232]

[root@tester tmp] ls -l epel-release-5-4.noarch.rpm
 -rw-rw---- 1 root root 12232 Sep 21  2012 epel-release-5-4.noarch.rpm

Okay, that’s better.  Let’s try yum install again:

[root@tester tmp] yum -y localinstall epel-release-5-4.noarch.rpm

… failed

the key problem again

 [root@tester tmp] rpm --checksig /tmp/epel-release-5-4.noarch.rpm
 /tmp/epel-release-5-4.noarch.rpm: (SHA1) DSA sha1 md5 (GPG) NOT OK (MISSING KEYS: GPG#217521f6)

Okay, let’s get that one:

[root@tester tmp] wget http://fedoraproject.org/static/217521F6.txt
 --2012-09-21 12:40:50--  http://fedoraproject.org/static/217521F6.txt
 Resolving fedoraproject.org... 152.19.134.146, 140.211.169.197, 209.132.181.16, ...
 Connecting to fedoraproject.org|152.19.134.146|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 1820 (1.8K) [text/plain]
 Saving to: `217521F6.txt'

100%[===============================================================================================>] 1,820       --.-K/s   in 0s

2012-09-21 12:40:50 (59.9 MB/s) - `217521F6.txt' saved [1820/1820]

[root@tester tmp] rpm --import 217521F6.txt


 Verify the signature now

[root@tester tmp]  rpm --checksig /tmp/epel-release-5-4.noarch.rpm
 /tmp/epel-release-5-4.noarch.rpm: (sha1) dsa sha1 md5 gpg OK

 see  we can install it.

[root@tester tmp] yum -y localinstall epel-release-5-4.noarch.rpm
 Loaded plugins: downloadonly, fastestmirror, security
 Setting up Local Package Process
 Examining epel-release-5-4.noarch.rpm: epel-release-5-4.noarch
 Marking epel-release-5-4.noarch.rpm to be installed
 Loading mirror speeds from cached hostfile
 * base: mirror.metrocast.net
 * extras: centos.mirror.nac.net
 * updates: mirror.7x24web.net
 Resolving Dependencies
 --> Running transaction check
 ---> Package epel-release.noarch 0:5-4 set to be updated
 --> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================
 Package                          Arch                       Version                  Repository                                    Size
 =========================================================================================================================================
 Installing:
 epel-release                     noarch                     5-4                      /epel-release-5-4.noarch                      0.0

Transaction Summary
 =========================================================================================================================================
 Install       1 Package(s)
 Upgrade       0 Package(s)

Downloading Packages:
 Running rpm_check_debug
 Running Transaction Test
 Finished Transaction Test
 Transaction Test Succeeded
 Running Transaction
 Installing     : epel-release                                                                                                      1/1

Installed:
 epel-release.noarch 0:5-4

Complete!

[root@tester tmp] yum -y update

Hmm.  The update of R-devel failed, which makes me unhappy.  I’m going to disable this repo by default. (Edit the file /etc/yum.repos.d/epel.repo and set enabled=0 where it says enabled=1).

Now, let’s get back to the task at hand.  Can we now install mod_auth_cas?

[root@tester tmp] yum -y install --enablerepo=epel mod_auth_cas

...

Installed:
 mod_auth_cas.x86_64 0:1.0.8.1-2.el5

Complete!

[root@tester tmp]  yum install 389-ds
..
Dependencies Resolved

=======================================================================================================================
 Package                          Arch              Version                                   Repository          Size
=======================================================================================================================
Installing:
 389-ds                           noarch            1.2.2-1.el6                               epel               9.9 k
Installing for dependencies:
 389-admin                        x86_64            1.1.29-1.el6                              epel               344 k
 389-admin-console                noarch            1.1.8-1.el6                               epel               202 k
 389-admin-console-doc            noarch            1.1.8-1.el6                               epel                43 k
 389-adminutil                    x86_64            1.1.15-1.el6                              epel                64 k
 389-console                      noarch            1.1.7-1.el6                               epel                72 k
 389-ds-base                      x86_64            1.2.9.14-1.el6_2.2                        updates            1.4 M
 389-ds-base-libs                 x86_64            1.2.9.14-1.el6_2.2                        updates            363 k
 389-ds-console                   noarch            1.2.6-1.el6                               epel               1.4 M
 389-ds-console-doc               noarch            1.2.6-1.el6                               epel                55 k
 389-dsgw                         x86_64            1.1.9-1.el6                               epel               468 k
 cyrus-sasl-gssapi                x86_64            2.1.23-13.el6                             base                33 k
 idm-console-framework            noarch            1.1.7-2.el6                               epel               1.1 M
 java-1.5.0-gcj                   x86_64            1.5.0.0-29.1.el6                          base               139 k
 java-1.6.0-openjdk               x86_64            1:1.6.0.0-1.43.1.10.6.el6_2               updates             25 M
 java_cup                         x86_64            1:0.10k-5.el6                             base               197 k
 jline                            noarch            0.9.94-0.8.el6                            base                86 k
 jpackage-utils                   noarch            1.7.5-3.12.el6                            base                59 k
 jss                              x86_64            4.2.6-20.el6                              base               746 k
 ldapjdk                          x86_64            4.18-6.el6                                base               847 k
 libgcj                           x86_64            4.4.6-3.el6                               base                19 M
 mod_nss                          x86_64            1.0.8-14.el6_2                            updates             82 k
 nss-tools                        x86_64            3.13.1-7.el6_2                            updates            725 k
 perl-CGI                         x86_64            3.51-119.el6_1.1                          base               206 k
 perl-Mozilla-LDAP                x86_64            1.5.3-4.el6                               base               160 k
 rhino                            noarch            1.7-0.7.r2.2.el6                          base               778 k
 sinjdoc                          x86_64            0.5-9.1.el6                               base               705 k
 svrcore                          x86_64            4.0.4-5.1.el6                             base                15 k
 tzdata-java                      noarch            2012b-3.el6                               updates            154 k
 zip                              x86_64            3.0-1.el6                                 base               260 k

Transaction Summary
=======================================================================================================================
Install      30 Package(s)

Total download size: 54 M
Installed size: 169 M
Is this ok [y/N]:

Configuration
setup-ds-admin.pl


[root@tester ~]# 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]:

==============================================================================
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 10-AUGUST-2007.

NOTICE : System is x86_64-unknown-linux2.6.32-220.13.1.el6.x86_64 (2 processors).

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 (hard limit) available, which
limit the number of simultaneous 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]:


==============================================================================
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 [centos.linuxproblems.org]:

==============================================================================
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]: ldap
System Group [nobody]: ldap

==============================================================================
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]:

==============================================================================
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]:
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 [linuxproblems.org]:

==============================================================================
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 [centos]: centos-ds

==============================================================================
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=linuxproblems, dc=org]:

==============================================================================
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]:

==============================================================================
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]:
Password:
Password (confirm):

==============================================================================
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]:

==============================================================================
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 'centos-ds' 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 admin server . . .
output: Starting dirsrv-admin:
output:                                                    [  OK  ]
The admin server was successfully started.
Admin server was successfully created, configured, and started.
Exiting . . .
Log file is '/tmp/setupk3F6CN.log'

[root@tester ~]# ps -ef | grep ldap
ldap     17547     1  0 12:13 ?        00:00:00 ./ns-slapd -D /etc/dirsrv/slapd-centos-ds -i /var/run/dirsrv/slapd-centos-ds.pid -w /var/run/dirsrv/slapd-centos-ds.startpid
ldap     17671 17667  0 12:13 ?        00:00:00 /usr/sbin/httpd.worker -k start -f /etc/dirsrv/admin-serv/httpd.conf

Verify the installation

[root@tester ~]# /usr/bin/ldapsearch -x -h centos -s base -b "dc=linuxproblems, dc=org" "objectclass=*"
# extended LDIF
#
# LDAPv3
# base <dc=linuxproblems, dc=org> with scope baseObject
# filter: objectclass=*
# requesting: ALL
#

# linuxproblems.org
dn: dc=linuxproblems,dc=org
objectClass: top
objectClass: domain
dc: linuxproblems

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

Running the Console

Now you should be able to run the console either locally, or remotely for example from my laptop:

[root@tester ~]# ssh -X centos /usr/bin/389-console -a http://centos:9830

Admin Server Console

From the 389-console, users can choose the admin server console:

    389admin.png
    389adminconsole.png

Directory Server Console

Or the directory server console:

    389directory.png
    389directoryconsole.png

You can read more about the console on the redhat documentation site and see more screenshots here.
Stopping and Starting

Stop and Start a directory server instance

[root@tester ~]# stop-dirsrv centos-ds
[root@tester ~]# ps -ef | grep slapd
root    22855 22147  0 13:26 pts/0    00:00:00 grep slapd
[root@tester ~]# start-dirsrv centos-ds
[root@tester ~]# ps -ef | grep slapd
ldap     22862     1  1 13:27 ?        00:00:00 ./ns-slapd -D /etc/dirsrv/slapd-centos-ds -i /var/run/dirsrv/slapd-centos-ds.pid -w /var/run/dirsrv/slapd-centos-ds.startpid

Stop and Start the directory server admin instance

[root@tester ~]# stop-ds-admin
[root@tester ~]]# ps -ef | grep admin-serv
root    22730 22147  0 13:25 pts/0    00:00:00 grep admin-serv
[root@tester ~]# start-ds-admin
#root@tester ~]# ps -ef | grep admin-serv
root     22737     1  0 13:26 ?        00:00:00 /usr/sbin/httpd.worker -k start -f /etc/dirsrv/admin-serv/httpd.conf
root     22740 22737  0 13:26 ?        00:00:00 /usr/sbin/httpd.worker -k start -f /etc/dirsrv/admin-serv/httpd.conf
ldap     22741 22737  0 13:26 ?        00:00:00 /usr/sbin/httpd.worker -k start -f /etc/dirsrv/admin-serv/httpd.conf

Directory Server Gateway, Phonebook and Org Chart

[root@tester ~]# /usr/sbin/setup-ds-dsgw
######################################################################
This shell script will configure the Directory Server
Gateway, Phonebook and Org Chart web applications to
work with the Administration Server.

Reading parameters from Administration Server config . . .
Using Administration Server URL http://centos.linuxproblems.org:9830 . . .
Reading parameters from Directory Server /etc/dirsrv/slapd-centos-ds . . .
Using Directory Server URL ldap://centos.linuxproblems.org:389/dc=linuxproblems,dc=org . . .
Generating config file /etc/dirsrv/dsgw/dsgw.conf . . .
Generating config file /etc/dirsrv/dsgw/pb.conf . . .
Generating config file /etc/dirsrv/dsgw/orgchart.conf . . .
Generating config file /etc/dirsrv/dsgw/default.conf . . .
Generating the credential database directory . . .
Adding configuration to httpd config file /etc/dirsrv/admin-serv/httpd.conf . . .
Enabling links to web apps from Administration Server home page . . .

The Directory Server Gateway web applications have been successfully configured.
You will need to restart your Administration Server.
######################################################################

[root@tester ~]# stop-ds-admin
[root@tester ~]# start-ds-admin

Now browse to the admin server at http://<adminserver>:9830/dist/download

  













No comments: