一. 操作系统环境以及软件包版本
Red Hat Enterprise Linux AS release 4 (Nahant)
cyrus-sasl-2.1.20.tar.gz
db-4.3.28.tar.gz
openldap-release.tgz
phpldapadmin-0.9.6c.tar.gz
二. 安装步骤
cd /tmp
tar zxpf db-4.3.28.tar.gz
cd db-4.3.28/build_unix/
../dist/configure && make && make install
cp /usr/local/BerkeleyDB.4.3/include /usr/include (y,y)
cp /usr/local/BerkeleyDB.4.3/lib/* /usr/lib
cd /tmp
tar zxpf cyrus-sasl-2.1.20.tar.gz
cd cyrus-sasl-2.1.20
./configure && make && make install
rm -f /usr/lib/lib*sasl*so* (libsasl2.so.2 这个就别删除了)
tar zxpf openldap-stable-20060227.tgz
cd openldap-2.3.20/
./configure && make depend && make && make test && make install
三. 配置步骤
vi /etc/ld.so.conf 加如下一行:
/usr/local/BerkeleyDB.4.3/lib
mv /usr/lib/libdb-4.3.so /tmp/libdb-4.3.so.old
ln -s /usr/lib/libdb-4.so /usr/lib/libdb-4.3.so
ldconfig
vi /usr/local/etc/openldap/slapd.conf 添加如下八条;
include /usr/local/etc/openldap/schema/corba.schema
include /usr/local/etc/openldap/schema/dyngroup.schema
include /usr/local/etc/openldap/schema/java.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/nis.schema
include /usr/local/etc/openldap/schema/misc.schema
include /usr/local/etc/openldap/schema/openldap.schema
找到语句:
suffix "dc=my-domain,dc=com"
rootdn "cn=Manager,dc=my-domain,dc=com"
rootpw secret
改为:
suffix "dc=example,dc=com"
rootdn "cn=Manager,dc=example,dc=com"
rootpw {SSHA}k9ijFfU2r/l2c/O/iHAq9EBuT1xi9pi3 (如下命令执行出来的:)
注:这个密码就是ldap的管理口令,牢记!
cd /usr/local/sbin
[root@lzj sbin]# ./slappasswd
New password:
Re-enter new password:
{SSHA}k9ijFfU2r/l2c/O/iHAq9EBuT1xi9pi3
[root@lzj sbin]#
四. 启动openldap服务并初始化数据
/usr/local/libexec/slapd
telnet 127.0.0.1 389 (测试)
touch /tmp/example.ldif
vi /tmp/example.ldif 加入如下内容:
dn:dc=example,dc=com
objectclass:dcObject
objectclassrganization
o:Example, Inc.
dc:example
dn:cn=Manager,dc=example,dc=com
objectclassrganizationalRole
cn:Manager
保存退出后执行如下命令:
/usr/local/bin/ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f /tmp/example.ldif
五. Phpldapadmin的安装方法
首先确认安装了php、php-ldap的包
Cd /tmp/
Tar zxpf phpldapadmin-0.9.6c.tar.gz
Cp –a phpldapadmin-0.9.6c /usr/local/phpldapadmin
Vi /etc/httpd/conf/httpd.conf
增加如下的内容:
Alias /phpldapadmin "/usr/local/phpldapadmin"
<Directory "/usr/local/phpadmin">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
vi /etc/local/phpadmin/lang/auto.php
将$uselang=”en”改为$uselang=”zh-cn”
vi /etc/local/phpldapadmin/header.php
将最后的charset=utf-8改为charset=GB2312
cp /usr/local/phpldapadmin/config.php.example /usr/local/phpldapadmin/config.php
vi /usr/local/phpldapadmin/config.php
将$blowfish_secret=””改为$blowfish_secret=”welcome”;
将$servers[$i] [‘host’]=’ldap.example.com’改为$servers[$i] [‘host’]=’127.0.0.1’
将login_pass=’secret’改为login_pass=’’
OK.到目前为止,设置全部结束,剩下的各位朋友自己去摸索吧。作者: 咸鱼翻身 时间: 2006-8-7 07:49 PM