centos7 openldap编译安装(含部署日志)

########################################

OS:CentOS Linux release 7.3.1611 (Core)

db:berkeleydb-5.1.29

ldap:openldap-2.4.48

########################################

相关软件下载
openldap下载
http://www.openldap.org/software/download/

参考资料
https://www.cnblogs.com/littlehb/p/7883302.html

下载地址:
ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.48.tgz

berkeley-db下载
https://download.oracle.com/berkeley-db/db-5.1.29.tar.gz

ldap admin下载
http://www.ldapbrowser.com/download.htm

下载地址:
https://downloads.softerra.com/ldapadmin/ldapadmin-4.17.20304.0-x64-eng.msi

##############################

解压

tar -zxvf db-5.1.29.tar.gz

进入编译目录

cd build_unix/

配置

…/dist/configure --prefix=/usr/local/berkeleydb-5.1.29

编译

make
make install

查看是否安装成功

ls /usr/local/berkeleydb-5.1.29/

库文件连接创建

echo “/usr/local/berkeleydb-5.1.29/lib/” > /etc/ld.so.conf

配置查看

ldconfig -v

##############################

##############################

解压文件

tar -zxvf openldap-2.4.48.tgz

进入软件目录

cd openldap-2.4.48

配置

./configure --prefix=/usr/local/openldap-2.4.48 --enable-syslog --enable-modules --enable-debug --with-tls CPPFLAGS=-I/usr/local/berkeleydb-5.1.29/include/ LDFLAGS=-L/usr/local/berkeleydb-5.1.29/lib/

编译安装

make depend
make
make install

进入安装目录

cd /usr/local/openldap-2.4.48

添加执行命令

ln -s /usr/local/openldap-2.4.48/bin/* /usr/local/bin/
ln -s /usr/local/openldap-2.4.48/sbin/* /usr/local/sbin/

设置ldap密码

slappasswd

输入:troll2019

输出:{SSHA}sNz4cLinT82kLGIWInVOVZ85NHfTnA8H

进入配置文件目录

cd etc/openldap/

备份配置文件

cp slapd.conf slapd.conf.bak.20190731

编辑配置文件

vi slapd.conf

add

include /usr/local/openldap-2.4.48/etc/openldap/schema/collective.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/corba.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/cosine.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/duaconf.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/dyngroup.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/inetorgperson.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/java.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/misc.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/nis.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/openldap.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/pmi.schema
include /usr/local/openldap-2.4.48/etc/openldap/schema/ppolicy.schema

update

suffix “dc=sysadmin,dc=com”
rootdn “cn=admin,dc=sysadmin,dc=com”

update

rootpw {SSHA}sNz4cLinT82kLGIWInVOVZ85NHfTnA8H

add

loglevel 256
logfile /usr/local/openldap-2.4.48/var/slapd.log

进入数据目录

cd …/var/openldap-data/

复制数据文件

cp DB_CONFIG.example DB_CONFIG

启动服务

/usr/local/openldap-2.4.48/libexec/slapd

验证服务进程

ps -ef | grep openldap
sudo netstat -anp | grep 389

输出debug

/usr/local/openldap-2.4.48/libexec/slapd -d 256

vi sysadmin.ldif

dn: dc=sysadmin,dc=com
objectclass: dcObject
objectclass: organization
o: SYS.Inc
dc: sysadmin

dn: cn=admin,dc=sysadmin,dc=com
objectclass: organizationalRole
cn: admin

新增节点

ldapadd -x -D “cn=admin,dc=sysadmin,dc=com” -W -f sysadmin.ldif

vi bigdata.ldif

add bigdata

dn: ou=bigdata, dc=sysadmin,dc=com
changetype: add
objectclass: top
objectclass: organizationalUnit
ou: bigdata

dn: cn=troll,ou=bigdata,dc=sysadmin,dc=com
changetype: add
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
cn: troll
sn: troll
ou: bigdata
description: sb, sx
description: sx
uid: troll

新增节点

ldapmodify -xWD ‘cn=admin,dc=sysadmin,dc=com’ -f bigdata.ldif

##############################

效果

centos7 openldap编译安装(含部署日志)_第1张图片
centos7 openldap编译安装(含部署日志)_第2张图片

LDIF修改LDAP记录或配置示例

https://www.linuxidc.com/Linux/2017-10/147559.htm

tips:部署日志和相关安装包分享
链接:https://pan.baidu.com/s/15KOK28qu5l3znQpcJj1utQ
提取码:yo5d

你可能感兴趣的:(大数据-安全)