CentOS 7下OpenLDAP编译安装及配置(2)

#设置rootdn密码,这里设置为123456; #这样rootdn密码为密文方式,复制输出密文到主配置文件rootdn对应的位置即可,如果不想麻烦,可以忽略此步,在主配置文件中使用明文即可。 [root@localhost ~]# cd /usr/local/openldap-2.4.44/ [root@localhost openldap-2.4.44]# slappasswd New password: Re-enter new password: {SSHA}K9+WK/t1e0V0K6pUMOyTsaTwkDBNEDiP

3. 主配置文件slapd.conf

[root@localhost openldap-2.4.44]# cd /usr/local/openldap-2.4.44/etc/openldap/ [root@localhost openldap]# vim slapd.conf #以下修改紫红色字体是未做修改的部分,红色字体是有修改部分,蓝色字体表示新增部分 #schema默认只有core.schema,各级需要添加,这里将同配置文件一个目录的schema目录中有的schema文件都加到配置文件中; 5 include /usr/local/openldap-2.4.44/etc/openldap/schema/core.schema 6 include /usr/local/openldap-2.4.44/etc/openldap/schema/collective.schema 7 include /usr/local/openldap-2.4.44/etc/openldap/schema/corba.schema 8 include /usr/local/openldap-2.4.44/etc/openldap/schema/cosine.schema 9 include /usr/local/openldap-2.4.44/etc/openldap/schema/duaconf.schema 10 include /usr/local/openldap-2.4.44/etc/openldap/schema/dyngroup.schema 11 include /usr/local/openldap-2.4.44/etc/openldap/schema/inetorgperson.schema 12 include /usr/local/openldap-2.4.44/etc/openldap/schema/java.schema 13 include /usr/local/openldap-2.4.44/etc/openldap/schema/misc.schema 14 include /usr/local/openldap-2.4.44/etc/openldap/schema/nis.schema 15 include /usr/local/openldap-2.4.44/etc/openldap/schema/openldap.schema 16 include /usr/local/openldap-2.4.44/etc/openldap/schema/pmi.schema 17 include /usr/local/openldap-2.4.44/etc/openldap/schema/ppolicy.schema 25 pidfile /usr/local/openldap-2.4.44/var/run/slapd.pid 26 argsfile /usr/local/openldap-2.4.44/var/run/slapd.args #新增日志文件级别与路径,需要在编译时--enable-debug,否则日志文件输出,不影响调试模式; 28 loglevel 256 29 logfile /usr/local/openldap-2.4.44/var/slapd.log #这里使用mdb做后端数据库,也可修改为"bdb"参数,在OpenLDAP 官方文档" 11.4. LMDB"章节中有介绍mdb是推荐使用的后端数据库; 67 database mdb #使用mdb做后端数据库时,根据官方文档中说明需要设置一个空间值," In addition to the usual parameters that a minimal configuration requires, the mdb backend requires a maximum size to be set. This should be the largest that the database is ever anticipated to grow (in bytes). The filesystem must also provide enough free space to accommodate this size.";如果使用bdb做后端数据库,需要将此项参数注释; 68 maxsize 1073741824 #修改域名及管理员账户名; 69 suffix "dc=sys,dc=com" 70 rootdn "cn=admin,dc=sys,dc=com" #使用密文密码,即前面使用slappasswd生成的密文; 74 rootpw {SSHA}K9+WK/t1e0V0K6pUMOyTsaTwkDBNEDiP #openldap数据目录,采用mdb时,在相应目录生成" data.mdb"与" lock.mdb"文件;采用bdb时,在相应目录生成" dn2id.bdb"与" id2entry.bdb",及多个" __db.00*"文件。 78 directory /usr/local/openldap-2.4.44/var/openldap-data 80 index objectClass eq

4. 初始化OpenLADP(optional)

#如果采用mdb做后端数据库,此步可忽略,DB_CONFIG是 bdb/hdb数据库使用的; #与主配置文件中的配置有关,主配置文件确定使用bdb与数据存放路径。 [root@localhost openldap]# cd /usr/local/openldap-2.4.44/var/openldap-data/ [root@localhost openldap-data]# cp DB_CONFIG.example DB_CONFIG

5. 启动OpenLADP

#直接在后台工作; #非root用户不能监听端口1~1024,如果是非root用户,有可能需要重新定义服务端口 [root@localhost ~]# /usr/local/openldap-2.4.44/libexec/slapd #在前端工作,输出debug信息 [root@localhost ~]# /usr/local/openldap-2.4.44/libexec/slapd -d 256

6. 验证

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/3c7dfe8a306f2d9750f446f7e3f5040c.html