vmware 6.52 + Red Hat Enterprise Linux 5(rhel-5.1-server-i386-dvd)+ openldap2.4.23
#在vm5.5.1g下装 redhat5时是装不上的。一直提示找不到硬盘,换成vmware 6.52可以安装
#安装的时候选内存为1G,硬盘为10G,netword adapter为桥接
---------第一步:安装完linux之后 setup gcc from cdrom
mkdir /mnt/cdrom
#将光驱挂载到本地
mount /dev/cdrom /mnt/cdrom
#提示:mount: No medium found
#解决办法:说明光驱中没有盘,在虚拟中设定光盘iso文件
#提示:mount: block device /dev/cdrom is write-protected, mounting read-only表明挂载成功
cd /mnt/cdrom/Server
rpm -ivh kernel-headers-2.6.18-53.el5.i386.rpm
rpm -ivh glibc-headers-2.5-18.i386.rpm
rpm -ivh glibc-devel-2.5-18.i386.rpm
rpm -ivh cpp-4.1.2-14.el5.i386.rpm
rpm -ivh binutils-2.17.50.0.6-5.el5.i386.rpm
rpm -ivh libgomp-4.1.2-14.el5.i386.rpm
rpm -ivh gcc-4.1.2-14.el5.i386.rpm
---------第二步:安装 BDB from db-4.5.20.tar.gz
#因为安装openldap之前要安装BDB,解决BerkeleyDB not available的问题
#下载地址: http://download-west.oracle.com/berkeley-db/
#下载内容:db-4.5.20.tar.gz
tar –zxvpf db-4.5.20.tar.gz
cd db-4.5.20
cd build_unix
../dist/configure
make
make install
env CPPFLAGS="-I /usr/local/BerkeleyDB.4.5/include" LDFLAGS="-L /usr/local/BerkeleyDB.4.5/lib"
------第三步:安装openldap:在openldap官网上下载tar包
tar -zxvpf openldap-stable-20100719.tgz
cd openldap-2.4.23
./configure --prefix=/usr/local/openldap --enable-ldbm
#提示:configure: error: BDB/HDB: BerkeleyDB not available
#解决:copy: /usr/local/BerkeleyDB.4.3/include to: /usr/include
copy: /usr/local/BerkeleyDB.4.3/lib to: /usr/lib
./configure --prefix=/usr/local/openldap --enable-ldbm
#提示:Please run "make depend" to build dependencies 后执行下面的命令。
make depend
make
make test
提示:
>>>>> ./scripts/test019-syncreplication-cascade failed for hdb (exit 1)
make[2]: *** [hdb-yes] Error 1
make[2]: Leaving directory `/qingfeng_setup/2.4.23_linux/openldap-2.4.23/tests'
make[1]: *** [test] Error 2
make[1]: Leaving directory `/qingfeng_setup/2.4.23_linux/openldap-2.4.23/tests'
make: *** [test] Error 2
不用理,继续安装
make install
------第四步:启动openldap,测试是否能启动成功
/usr/local/openldap/libexec/slapd -d 256
/usr/local/openldap/bin/ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts
/usr/local/openldap/bin/ldapsearch -h localhost "objectClass=*"
------第五步:配置openldap,增加你自己的schema
#配置文件目录:/usr/local/openldap/etc/openldap/slapd.conf
#schema顺序:
include /usr/local/openldap/etc/openldap/schema/core.schema
include /usr/local/openldap/etc/openldap/schema/corba.schema
include /usr/local/openldap/etc/openldap/schema/cosine.schema
include /usr/local/openldap/etc/openldap/schema/inetorgperson.schema
include /usr/local/openldap/etc/openldap/schema/misc.schema
include /usr/local/openldap/etc/openldap/schema/openldap.schema
include /usr/local/openldap/etc/openldap/schema/nis.schema
include /usr/local/openldap/etc/openldap/schema/你自己的.schema
修改:suffix "你自己的suffix"
修改: rootdn "你自己的rootdn"
-----第六步:重启openldap,添加数据
/usr/local/openldap/libexec/slapd -d 256
#添加内容
/usr/local/openldap/bin/ldapadd -x -D "你自己的rootdn" -W -f /qingfeng_setup/2.4.23_linux/XX.ldif
#停止防火墙,如果不停止,是连接不上ldap的,在每次启动linux后都要停止防火墙
/etc/rc.d/init.d/iptables stop
#可以使用我们平常用的jxplore工具连接openldap
#ifconfig 查看ip ,端口:389 ,suffix和rootdn参看配置文件slapd.conf中设置
------第七步:设定固定ip
#路径:/etc/sysconfig/network-scripts/ifcfg-eth0 增加下面的内容
#注意:BOOTPROTO这个属性原来是有值的,需要改一下。
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.1
NETMASK=255.255.255.0
GATEWAY=192.168.0.3
#改后要重新加载 eth0
ifconfig eth0 down
ifconfig eth0 up
/etc/init.d/network restart
重启后发现ip没变就达到效果