分类: LINUX
2010-11-29 19:32:56
1. Install Berkeley DB 5.1
First, download Berkeley DB:
Then extract it to current folder.
cd db-5.1.19.NC/build_unix/
Execute the following commands to install BDB on the box:
../dist/configure
make
sudo make install
After that, edit /etc/ld.so.conf and add the following line to the end of the file.
/usr/local/BerkeleyDB.5.1/lib
Then
sudo ldconfig
2. Install and Configure OpenLDAP 2.4.23
First, download openldap from the following link
Then extract it to current folder.
Patch it (without this step, you will encounter “configure: error: BDB/HDB: BerkeleyDB not available” error)
wget
patch –p0 < openldap-2.4.23-bdb5-1.patch
cd openldap-2.4.23
with the following commands to install openldap:
env CPPFLAGS="-I/usr/local/BerkeleyDB.5.1/include" LDFLAGS="-L/usr/local/lib -L/usr/local/BerkeleyDB.5.1/lib -R/usr/local/BerkeleyDB.5.1/lib" LD_LIBRARY_PATH="/usr/local/BerkeleyDB.5.1/lib" ./configure
make depend
make
sudo make install
After that, edit slapd.conf to make it works as expected:
sudo vi /usr/local/etc/openldap/slapd.conf
Changed “my-domain” at the line 54 and 55 to “yoyosys”
Back to line 6 and insert the following three lines
include /usr/local/etc/openldap/schema/corba.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
Save and exit.
Copy DB_CONFIG to appropriate folder and then start slapd.
sudo cp /usr/local/etc/openldap/DB_CONFIG.example /usr/local/var/openldap-data/DB_CONFIG
sudo /usr/local/libexec/slapd
You may execute the following command to make sure slapd starts.
sudo netstat -tnlp | grep 389
Add users with .ldif file
ldapadd -x -D "cn=Manager,dc=yoyosys,dc=com" -W -f testdata.ldif
Search for specified user or group
ldapsearch -x -b 'dc=yoyosys,dc=com'
Hope this helps.
Thanks,
Kylin