【www.bbyears.com--CentOS】
注:这个要基于几个WEB引擎让前台能够管理便捷一点,所以LNMP的安装我后续在写吧,确实没什么时间,如果是自行安装请对PHP添加PHP-LDAP的支持!
1、安装openssl
代码如下
[root@itchenyi-04 ~]# tar zxf openssl-1.0.1e.tar.gz
[root@itchenyi-04 ~]# cd openssl-1.0.1e
[root@itchenyi-04 openssl-1.0.1e]# ./config --prefix=/software/openssl
[root@itchenyi-04 openssl-1.0.1e]# make && make install
[root@itchenyi-04 openssl-1.0.1e]# ln -s /software/openssl/lib /usr/lib64/
注:变更profile,完成后重载一下环境,后面的类似操作请自行执行
代码如下 [root@itchenyi-01 openssl-1.0.1e]# cat >> ~/.bash_profile <
export LD_LIBRARY_PATH
PATH=/software/ssl/bin:$PATH
export PATH
EOF
[root@itchenyi-04 openssl-1.0.1e]# source ~/.bash_profile
2、安装jdk
代码如下
[root@itchenyi-04 ~]# tar zxf jdk-7u21-linux-x64.tar.gz
[root@itchenyi-04 ~]# mv jdk1.7.0_21/ /software/jdk
[root@itchenyi-01 ~]# cat >> ~/.bash_profile <
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
EOF
[root@itchenyi-04 ~]# source ~/.bash_profile
[root@itchenyi-01 ~]# cat >> ~/.bash_profile <
export CPPFLAGS
EOF
[root@itchenyi-04 ~]# source ~/.bash_profile
3、安装Cyrus-SASL
代码如下
[root@itchenyi-04 ~]# tar zxf cyrus-sasl-2.1.25.tar.gz
[root@itchenyi-04 ~]# cd cyrus-sasl-2.1.25
[root@itchenyi-04 cyrus-sasl-2.1.25]# ./configure --prefix=/software/sasl2 --enable-login --with-openssl=/software/openssl/ --enable-java --with-javabase=/software/jdk --with-mysql=/software/mysql/ --enable-sql
[root@itchenyi-04 cyrus-sasl-2.1.25]# make && make install
[root@itchenyi-04 cyrus-sasl-2.1.25]# ln -s /software/sasl2/lib/sasl2 /usr/lib64/sasl2
[root@itchenyi-04 cyrus-sasl-2.1.25]# cat >> ~/.bash_profile <
LD_LIBRARY_PATH=/mnt/db-5.3.21/build_unix/.libs:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
CPPFLAGS="-I/software/bdb/include -I/software/sasl2/include/sasl -I/software/sharelib/include"
LDFLAGS="-L/software/bdb/lib -L/software/sasl2/lib -L/software/sharelib/lib"
export CPPFLAGS LDFLAGS
PATH=/software/bdb/bin:$PATH
EOF
[root@itchenyi-04 ~]# source ~/.bash_profile
4、安装BDB
代码如下
[root@itchenyi-04 ~]# tar zxf db-5.3.21.tar.gz
[root@itchenyi-04 ~]# cd db-5.3.21/build_unix/
[root@itchenyi-04 build_unix]# ../dist/configure --prefix=/software/bdb --enable-java --enable-sql --enable-sql_codegen
[root@itchenyi-04 build_unix]# make && make install
[root@itchenyi-04 build_unix]# ln -s /software/bdb/lib /usr/lib
5、安装OpenLDAP
代码如下 [root@itchenyi-04 build_unix]# yum install tcp_wrappers-devel
[root@itchenyi-04 ~]# tar zxf openldap-2.4.39.tgz
[root@itchenyi-04 ~]# cd openldap-2.4.39
[root@itchenyi-04 openldap-2.4.39]# ./configure --prefix=/software/openldap --enable-passwd --enable-wrappers --enable-spasswd --enable-crypt --enable-modules --enable-accesslog=yes --enable-shell --with-tls --enable-meta --enable-ldap --enable-sql
#make test 操作建议分开执行
[root@itchenyi-04 openldap-2.4.39]# make && make test && make install
变更OpenLDAP配置,请勿直接复制粘贴
代码如下 [root@itchenyi-04 ~]# cat /software/openldap/etc/openldap/slapd.conf | egrep -v "^#|^$"
include /software/openldap/etc/openldap/schema/core.schema
include /software/openldap/etc/openldap/schema/collective.schema
include /software/openldap/etc/openldap/schema/corba.schema
include /software/openldap/etc/openldap/schema/cosine.schema
include /software/openldap/etc/openldap/schema/duaconf.schema
include /software/openldap/etc/openldap/schema/dyngroup.schema
include /software/openldap/etc/openldap/schema/inetorgperson.schema
include /software/openldap/etc/openldap/schema/java.schema
include /software/openldap/etc/openldap/schema/misc.schema
include /software/openldap/etc/openldap/schema/nis.schema
include /software/openldap/etc/openldap/schema/openldap.schema
include /software/openldap/etc/openldap/schema/pmi.schema
include /software/openldap/etc/openldap/schema/ppolicy.schema
pidfile /software/openldap/var/run/slapd.pid
argsfile /software/openldap/var/run/slapd.args
database bdb
suffix "dc=itchenyi,dc=com"
rootdn "cn=Manager,dc=itchenyi,dc=com"
rootpw secret
directory /software/openldap/var/openldap-data
index objectClass eq
启动服务
代码如下
#简历数据存储的配置文件
[root@itchenyi-04 ~]# cd /software/openldap/var/openldap-data/ && cp DB_CONFIG.example DB_CONFIG
[root@itchenyi-04 openldap-data]# /software/openldap/libexec/slapd -d 256 -h "ldap://1.1.1.5"
测试OpenLDAP
代码如下
[root@itchenyi-04 ~]# /software/openldap/bin/ldapsearch -x -b "" -s base "(objectclass=*)" namingContexts -h 1.1.1.5 -p 389
# extended LDIF
#
# LDAPv3
# base <> with scope baseObject
# filter: (objectclass=*)
# requesting: namingContexts
#
#
dn:
namingContexts: dc=itchenyi,dc=com
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1
初始化,添加一点数据进去
代码如下
[root@itchenyi-04 ~]# cat > itchenyi.example.ldif <
objectclass:dcObject
objectclass:organization
o:www.itchenyi.com,blog.
dc:itchenyi
dn:cn=Manager,dc=itchenyi,dc=com
objectclass:organizationalRole
cn:Manager
EOF
[root@itchenyi-04 ~]# /software/openldap/bin/ldapadd -x -D "cn=manager,dc=itchenyi,dc=com" -f itchenyi.example.ldif -p 389 -h 1.1.1.5 -w secret