phpldapadmin安装手册(open ldap+Berkeley DB+php 5+apache 2)

注意各软件版本之间的搭配

***************一 安装apache2(httpd-2.2.4)*******


下载地址:http://www.apache.org/dist/httpd/httpd-2.2.4.tar.gz

# tar zxvf httpd-2.2.4.tar.gz
# cd httpd-2.2.4
# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
# make
# make install

# vi /usr/local/apache2/conf/httpd.conf
修改
User nobody
Group nobody

找到#AddType application/x-tar .tgz 这行,在下面加两行。
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php
DirectoryIndex index.html index.php

# vi /etc/profile
PATH="$PATH":/usr/local/apache2/bin

***************二 安装php5(php-5.2.3)**********************

下载地址:http://cn2.php.net/get/php-5.2.3.tar.gz/from/this/mirror

# tar zxvf php-5.2.3.tar.gz
# cd php-5.2.3
# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php5 --with-ldap --with-gettext
# make
# make install
# cp php.ini-dist /usr/local/php5/php.ini

****************三 安装Berkeley DB(4.5.20)************************
因为:由于openldap需要用Berkeley DB来存放数据,所以要先安装所以需先安装Berkeley
数据库.
下载地址:http://www.oracle.com/technology/software/products/berkeley-db/htdocs/popup/db/4.5.20/db-targz.html

# tar zxvf db-4.5.20.tar.tar
# cd db-4.5.20/build_unix/
# ../dist/configure
# make
# make install

# vi /etc/ld.so.conf
加入
/usr/local/BerkeleyDB.4.5/lib
# /sbin/ldconfig

******************四 安装openldap(2.3.32)********************************

下载地址:ftp://ftp.openldap.org/pub/OpenLDAP/openldap-stable/openldap-stable-20070110.tgz

# tar zxvf openldap-stable-20070110.tgz
# cd openldap-2.3.32/
# env CPPFLAGS="-I/usr/local/BerkeleyDB.4.5/include"LDFLAGS="-L/usr/local/BerkeleyDB.4.5/lib" ./configure --prefix=/usr/local/openldap --enable-bdb

# make depend
# make
# make test
# make install

# vi /usr/local/openldap/etc/openldap/slapd.conf

在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/dyngroup.schema
include         /usr/local/openldap/etc/openldap/schema/inetorgperson.schema
include         /usr/local/openldap/etc/openldap/schema/java.schema
include         /usr/local/openldap/etc/openldap/schema/misc.schema
include         /usr/local/openldap/etc/openldap/schema/nis.schema
include         /usr/local/openldap/etc/openldap/schema/openldap.schema

修改
suffix          "dc=donnie,dc=com"
rootdn        "cn=root,dc=donnie,dc=com"#LDAP管理者用户名,密码
rootpw        {SSHA}YBW53fU7sd3wshdPHOWoA7x0EnJrFuRY

{SSHA}YBW53fU7sd3wshdPHOWoA7x0EnJrFuRY这个字符串的取得方法
# /usr/local/openldap/sbin/slappasswd   回车,再输入你用的密码

启动openldap
# /usr/local/openldap/libexec/slapd

openldap的关闭
使用命令:
ps -ef |grep slapd
root 5780 1 0 11:54 ? 00:00:00 /usr/local/libexec/slapd
root 5783 10179 0 11:54 pts/1 00:00:00 grep slapd
然后执行:
killall slapd

建立DN
# ldapadd -x -D 'cn=root,dc=donnie,dc=com' -W
dn: dc=donnie,dc=com
objectClass: dcObject
objectClass: organization
dc: donnie
o: Corporation
description: d Corporation

注:冒号后要有空格,结尾不要有空格
输入完后按Ctrl+d结束

*******************************五 安装phpldapadmin(1.0.1)说明beta 1.1.0-alpha3 版的我装后报错,所以用这个老一点的版本*****************************************

下载地址:http://prdownloads.sourceforge.net/phpldapadmin/phpldapadmin-1.0.1.tar.gz?download

# tar zxvf phpldapadmin-1.0.1.tar.gz
# cp -a phpldapadmin-1.0.1 /usr/local/phpldapadmin
# cd ../phpldapadmin/config
# cp config.php.example config.php

# vi config.php

把274行的注释符/*放到282行后,等同于使下在的代码生效
$i++;
$ldapservers->SetValue($i,'server','name','LDAP Server');
$ldapservers->SetValue($i,'server','host','127.0.0.1');
$ldapservers->SetValue($i,'server','port','389');
$ldapservers->SetValue($i,'server','base',array(''));
$ldapservers->SetValue($i,'server','auth_type','cookie');
$ldapservers->SetValue($i,'login','dn','');
$ldapservers->SetValue($i,'login','pass','');

把phpldapadmin变成中文
# cd /usr/local/phpldapadmin/locale/zh_CN/LC_MESSAGES
# iconv -f gbk -t utf8 messages.po > messages.new.po
# msgfmt -o messages.mo messages.new.po

# vi /usr/local/phpldapadmin/htdocs/header.php
$language = isset($config) ? $language = $config->GetValue('appearance','language') : 'zh_CN'; 原auto

重启apache
# /usr/local/apache2/bin/apachectl stop
# /usr/local/apache2/bin/apachectl start

你可能感兴趣的:(phpldapadmin安装手册(open ldap+Berkeley DB+php 5+apache 2))