一、环境准备

echo nameserver 114.114.114.114 > /etc/resolv.conf ##更改DNS
echo 192.168.0.190 hello.com >> /etc/hosts
systemctl disable firewalld.service && systemctl stop firewalld.service #关闭防火墙
sed -i 's//#SELINUX/SELINUX=disable/g' /etc/selinux/config ##永久关闭selinux
setenforce 0
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
##安装扩展源
yum -y install openldap-servers openldap-clients ##安装openldap服务端和客户端
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
chown ldap:ldap /var/lib/ldap/DB_CONFIG ##授权
systemctl start slapd && systemctl enable slapd ##启动服务,设置开机启动

二、配置管理员密码
①.slappasswd 或 slappasswd -s 密码(-s 指定密码)
输入完密码后会生成一串加密字符串
例:{SSHA}5Qiqn6d4U4U9b1G8A7dKmJAkJcUOA4fE #保存,后面会用到
②.vim chrootpw.ldif
# specify the password generated above for "olcRootPW" section
dn: olcDatabase={0}config,cn=config
changetype: modify
add: olcRootPW
olcRootPW: 上面生成的密码
ldapadd -Y EXTERNAL -H ldapi:/// -f chrootpw.ldif
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif

三、在数据库中设置你的域名
1.生成密码
slappasswd
2.vi chdomain.ldif
# replace to your own domain name for "dc=***,dc=***" section
# specify the password generated above for "olcRootPW" section
dn: olcDatabase={1}monitor,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth"
read by dn.base="cn=admin,dc=hello,dc=com" read by * none

dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=hello,dc=com

dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=admin,dc=hello,dc=com
dn: olcDatabase={2}hdb,cn=config
changetype: modify
add: olcRootPW
olcRootPW: 步奏1中生成的密码

dn: olcDatabase={2}hdb,cn=config
changetype: modify
add: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange by
dn="cn=admin,dc=hello,dc=com" write by anonymous auth by self write by * none
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to * by dn="cn=admin,dc=hello,dc=com" write by * read
三、ldapmodify -Y EXTERNAL -H ldapi:/// -f chdomain.ldif
四、vi basedomain.ldif
# replace to your own domain name for "dc=***,dc=***" section
dn: dc=hello,dc=com
objectClass: top
objectClass: dcObject
objectclass: organization
o: qiqiu com
dc: qiqiu
dn: cn=admin,dc=hello,dc=com
objectClass: organizationalRole
cn: admin
description: Directory admin
dn: ou=People,dc=hello,dc=com
objectClass: organizationalUnit
ou: People
dn: ou=Group,dc=hello,dc=com
objectClass: organizationalUnit

ou: Group
5.ldapadd -x -D cn=admin,dc=hello,dc=com -W -f basedomain.ldif

最新文章

  1. Resharper让我们的asp.net开发效率提高三分之一
  2. 2016年iOS笔试题
  3. XCode 中的代码块导出与导入
  4. css总集
  5. hud 2602 Bone Collector
  6. linux-01Red Hat Enterprise Linux 7(RHEL7)配置静态IP地址
  7. Part 1: Running Oracle E-Business Suite on Oracle Cloud
  8. Sql发布订阅设置不初始化订阅库架构的设置
  9. javascript函数中的三个技巧【一】
  10. POJ2836 Rectangular Covering(状压DP)
  11. Hibernate3回顾-5-简单介绍Hibernate session对数据的增删改查
  12. Xcode中添加代码块的方式
  13. php获取文章内容中的全部图片数组
  14. Swift中的ViewController
  15. 玩转html5(四)----使用canvas画一个时钟(可以动的哦!)
  16. (大数据工程师学习路径)第二步 Vim编辑器----高级功能入门
  17. 基于哈夫曼编码的文件压缩(c++版)
  18. Holer服务端软件使用
  19. 【转】const int *p和int * const p的区别(常量指针与指向常量的指针)
  20. FileWriter向文件中写入内容

热门文章

  1. 错误C2280 Union:尝试引用已删除的函数
  2. MongoDB快速入门教程 (3.2)
  3. Python 中的元类到底是什么?这篇恐怕是最清楚的了
  4. oracle数据库插入日期格式字符串给date类型字段
  5. Tornado的使用
  6. Intellij idea2020永久激活,亲测可用!!!(持续更新)
  7. day19 生成器+函数递归
  8. LintCode笔记 - 8. 旋转字符串
  9. mysql numeric
  10. es6新增特性总结