Scope of this Document
1. Building a distributable RPM From The Source OpenLDAP source RPM1.1. Get the source RPM2. Configuring the master OpenLDAP servers for mirroring
1.2. Install the source RPM
1.3. Generate the OpenLDAP mirroring RPM
2.1. Install the OpenLDAP RPMsExample Files
2.2 Copy the data from one server to the other
2.3 Configure both servers
2.4 Restart both OpenLDAP servers
Example /usr/src/redhat/SOURCES/openldap-2.0.23-multimaster.patch
Example /usr/src/redhat/SPECS/openldap.spec
Example /etc/openldap/slapd.conf for server A:
Example /etc/openldap/slapd.conf for server B:
This document provides a guide for generating a set of OpenLDAP 2.0 servers on <>UNIX (and UNIX-like) systems that will automatically mirror changes made to one server to all the others . The document is aimed at experienced system administrators who are familiar with OpenLDAP and creating RPM packages.
This document is meant to be used in conjunction with other OpenLDAP information resources provided with the software package and on the project's extensive site (http://www.OpenLDAP.org/ ) on the World Wide Web. The site makes available a number of resources.
Note: This documentation applies to Linux distributions (particularly RedHat-like distributions) but it can be applied to other distributions with small modifications.a. Go to http://www.rpmfind.net
b. In "Search" type: openldap
c. At your desired system on the 'Package' column click the *.html link
d. Click the Source RPM: Source RPM: openldap-{version}.src.rpm. on the right hand column to save the file to your desired directory.
>From the command line in the directory in which you want to save the source RPM type:
rpm -i openldap-{version}.src.rpm
This will extract all the files you need in order to build the multimaster RPM to the directory: /usr/src/redhat
a. Change directory to /usr/src/redhat/SPECS
b. Type:
rpm -bp openldap.spec
This will create the directory: /usr/src/redhat/BUILD/openldap-{version}
c. Create a multimaster replication patch:
Note: You may skip this step and use the example patch file below:
d. Edit the file /usr/src/redhat/SPECS/openldap.spec:
- Copy the directory /usr/src/redhat/BUILD/openldap-{version} to /tmp by typing
cp -rp /usr/src/redhat/BUILD/openldap-{version} /tmp- Switch to the directory /tmp/openldap-{version}
- Edit the file configure.in:
Uncomment (remove the 'dnl' word at he beginning of) all the lines that have something to do with multimaster:
- Change the line:
OL_ARG_ENABLE(multimaster,[--enable-multimaster enable multimaster replication], no)dnl
to:
OL_ARG_ENABLE(multimaster,[--enable-multimaster enable multimaster replication], yes)dnl
- Leave the line:
dnl ol_enable_multimaster=no
as it is.
- Edit the file include/portable.h.in:
Under:
#undef SLAPD_MODULES
add the following lines:
/* define to support multimaster replication */
#undef SLAPD_MULTIMASTER
- Create the patch by typing:
diff -uNr /usr/src/redhat/BUILD/openldap-{version}/ /tmp/openldap-{version}/ > openldap-{version}-multimaster.patch
Where {version} is substituted with your version of OpenLDAP, for example, 2.0.23
- Edit the file 'openldap-{version}-multimaster.patch' by removing the path:
/tmp/
from the lines:
+++ /tmp/openldap-2.0.23/configure.in Mon Apr 22 18:38:48 2002
and
+++ /tmp/openldap-2.0.23/include/portable.h.in Mon Apr 22 18:48:05 2002
- Copy openldap-{version}-multimaster.patch to the directory:
/usr/src/redhat/SOURCES
Note: You may skip this step and use the example spec file below :
e. In the /usr/src/redhat/SPECS/ directory run the command:
- Change the lines:
%package servers-openldap
Summary: OpenLDAP servers and related files.
to:
%package servers-multimaster
Summary: OpenLDAP servers and related files, with multimaster replication enabled.
- After the line:
Group: System Environment/Daemons
add the line:
Obsoletes: openldap-servers
- Change the line:
%description openldap-servers
to:
%description servers-multimaster
- Under the last Patch{LastNumber} statement type add:
Patch{LastNumber+1}: openldap-{version}-multimaster.patch
For example: if the last Patch statement is: Patch25 then below it type:
Patch26: openldap-2.0.23-multimaster.patch
- Under the lines:
%patch25 -p2 -b .schema
popd
type:
%patch26 -p1 -b .multimaster
autoconf
autoheader
- In the %configure statement under the line:
--enable-spasswd \
add the line:
--enable-multimaster \
rpm -bb openldap.spec Note: This should take a while so don't worry :)
This will create four packages in the directory: /usr/src/redhat/RPMS/i386
Of these packages, only openldap-servers-multimaster-{version}.rpm
- openldap-{version}.rpm
- openldap-clients-{version}.rpm
- openldap-devel-[version}.rpm
- openldap-servers-multimaster-{version}.rpm
should be affected by these changes.
f. Now you are ready to install the following RPM packages found in the directory:
/usr/src/redhat/RPMS/i386
using the command:
rpm -i {package name} or rpm -u {package name}
First of all, let us assume we we have two different Master-LDAP servers,
A and B that need to mutually replicate changes from one to the other.
The steps you need to take are as follows:
The following applies both to servers A and B:
This can be done by copying the contents of the /var/lib/ldap directory on one server to the other by creating a .tar.gz file using the command:
tar -zcvpf ldap.tar.gz /var/lib/ldap
Do this by typing on each machine:
service ldap restart