您的位置:首页 > 运维架构 > Apache

源码编译安装ldap+apache+php+phpldapadmin

2012-08-10 17:27 363 查看
For reprint content of this site, Declined reprint为保障原作者权利,谢绝转载

源码包:
db-4.7.25.tar.gz
openldap-stable-20090411.tar.gz
phpldapadmin-1.2.1.1.tar.gz
Apache2.4.2.tar.gz
Php.5.4.5.tar.gz
apr-1.4.6.tar.gz
apr-util-1.4.1.tar.gz
gettext-0.17.tar.gz
libmcrypt-2.5.7.tar.gz
libpng-1.5.12.tar.gz
libxml2-2.7.7.tar.gz
安装BerkeleyDB
#tar -zxf
db-4.7.25.tar.gz
# cd db-4.7.25/build_unix
#
../dist/configure
# make
# make install
# vi /etc/ld.so.conf(加入:/usr/local/BerkeleyDB.4.7/lib)
#/sbin/ldconfig

安装openldap
#
tar zxvf
openldap-stable-20090411.tgz
# cd openldap-2.4.16
# env
CPPFLAGS=”-I/usr/local/BerkeleyDB.4.7/include”
LDFLAGS=”-L/usr/local/BerkeleyDB.4.7/lib” ./configure
--prefix=/usr/local/openldap
--enable-ldbm
# make
depend
# make
# make
install
(配置文件目录为:/usr/local/openldap/etc/openldap/)

配置openldap
复制配置文件
# cp /usr/locla/openldap/etc/openldap/DB_CONFIG.example
/usr/local/openldap/var/openldap-data/DB_CONFIG
修改slapd.conf配置文件,
Vim /usr/local/openldap/etc/openldap/slapd.conf
内容如下
#
#
See slapd.conf(5) for details on configuration options.
#
This file should NOT be world readable.
#
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
include
/usr/local/openldap/etc/openldap/schema/ppolicy.schema

#
Define global ACLs to disable default read access.

#
Do not enable referrals until AFTER you have a working directory
#
service AND an understanding of referrals.
#referral ldap://root.openldap.org

pidfile /usr/local/openldap/var/run/slapd.pid
argsfile /usr/local/openldap/var/run/slapd.args
#
Load dynamic backend modules:
#
modulepath
/usr/local/openldap/libexec/openldap
#
moduleload back_bdb.la
#
moduleload back_hdb.la
#
moduleload back_ldap.la

#
Sample security restrictions
# Require integrity protection (prevent
hijacking)
# Require 112-bit (3DES or better)
encryption for updates
# Require 63-bit encryption for simple
bind
#
security ssf=1 update_ssf=112 simple_bind=64

#
Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub)entry DSE: allow anyone
to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read
access
# Allow anonymous users to
authenticate
# Directives needed to implement policy:
#
access to dn.base="" by * read
#
access to dn.base="cn=Subschema" by * read
#
access to *
# by self write
# by users read
# by anonymous auth
#
#
if no access controls are present, the default policy
#
allows anyone and everyone to read anything but restricts
#
updates to rootdn. (e.g., "access
to * by * read")
#
#
rootdn can always read and write EVERYTHING!

#######################################################################
#
BDB database definitions
#######################################################################

database bdb
suffix
"dc=abc,dc=com"rootdn
"cn=manager,dc=abc,dc=com"#
Cleartext passwords, especially for the rootdn, should
#
be avoid. See slappasswd(8) and
slapd.conf(5) for details.
#
Use of strong authentication encouraged.
rootpw password#
The database directory MUST exist prior to running slapd AND
#
should only be accessible by the slapd and slap tools.
#
Mode 700 recommended.
directory /usr/local/openldap/var/openldap-data
#
Indices to maintain
index objectClass eq
修改ldap.conf配置文件
Vim /usr/local/openldap/etc/openldap/ldap.conf
内容如下
#
#
LDAP Defaults
#
#
See ldap.conf(5) for details
#
This file should be world readable but not world writable.
BASabcc,dc=com
#URI ldap://ldap.example.com
ldap://ldap-master.example.com:666
#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never

测试启动
#/usr/local/openldap/libexec/slapd -d 256

编译安装apache2.4
前提:
1
#yum install libtool libtool-ltdl -y
[root@localhost
apr-1.4.6]# ./configure
[root@localhost
apr-1.4.6]#make
[root@localhost
apr-1.4.6]#make install
2
[root@localhost
apr-util-1.4.1]# ./configure --with-apr=/usr/local/apr
[root@localhost
apr-util-1.4.1]#make
[root@localhost
apr-util-1.4.1]#make install
3
[root@www pcre-8.30]# ./configure
[root@www
pcre-8.30]# make
[root@www
pcre-8.30]# make install
4
[root@www httpd-2.4.2]#./configure --enable-mods-shared=all --enable-so
[root@www
httpd-2.4.2]#make
[root@www
httpd-2.4.2]#make install

安装php
1
[root@www
gettext-0.17]#./configure --prefix=/usr/local/gettex
[root@www
gettext-0.17]#make
[root@www
gettext-0.17]#make install
2 配置库文件搜索路径
[root@www
gettext-0.17]# echo "/usr/local/gettex/lib" >> /etc/ld.so.conf
[root@www
gettext-0.17]# ldconfig -v
3
[root@www libxml2-2.7.7]#./configure
[root@www
libxml2-2.7.7]#make
[root@www
libxml2-2.7.7]#make install
4
[root@www libpng-1.5.12]#./configure
[root@www
libpng-1.5.12]#make
[root@www
libpng-1.5.12]#make install
5
[root@www libmcrypt-2.5.7]#./configure
[root@www
libmcrypt-2.5.7]#make
[root@www
libmcrypt-2.5.7]#make install
6
#yum install zlib-devel
7
[root@www
php-5.4.5]# ./configure --prefix=/data/php5 --with-config-file-path=/etc
--with-apxs2=/usr/local/apache2/bin/apxs --with-zlib --enable-xml
--enable-mbstring --enable-sockets --with-ldap=/usr/local/openldap
--with-gettext=/usr/local/gettex --with-zlib-dir
[root@www
php-5.4.5]#make
[root@www
php-5.4.5]#make install
[root@www
php-5.4.5]# cp php.ini-dist /etc/php.ini
# vi
/data/apache/conf/httpd.conf
#查找AddType
application/x-compress .Z
AddType
application/x-gzip .gz .tgz
在其下加入
---------------------------------------------------
AddType
application/x-tar .tgz
AddType
application/x-httpd-php .php
AddType
application/x-httpd-php-source .phps
AddType image/x-icon
.ico
---------------------------------------------------
改DirectoryIndex
行,添加index.php
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux openldap