1.关闭防火墙
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config && setenforce 0&& systemctl disable firewalld.service && systemctl stop firewalld.service && shutdown -r now
2.安装ldap依赖及服务包
yum -y install openldap compat-openldap openldap-clients \
openldap-servers openldap-servers-sql openldap-devel migrationtools
3.查看版本
slapd -VV
4.创建ldap管理员密码
slappasswd -s 123456 > 1.txt
5.修改ldap配置文件
vi /etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif
vi /etc/openldap/slapd.d/cn=config/olcDatabase\=\{1\}monitor.ldif
6.检测是否有错误
slaptest -u
7.启动ldap
systemctl enable slapd
systemctl start slapd
systemctl status slapd
8.查看端口
netstat -anpl|grep 389
9.配置openldap数据库
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
chown ldap:ldap -R /var/lib/ldap
chmod 700 -R /var/lib/ldap
ll /var/lib/ldap/
10.导入schema
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
11.修改migrate_common.ph配置
vi /usr/share/migrationtools/migrate_common.ph
12.安装ldap管理工具
yum -y install httpd php php-ldap php-gd php-mbstring php-pear php-bcmath php-xml
yum -y install epel-release
yum --enablerepo=epel -y install phpldapadmin
13.修改配置文件
vi /etc/phpldapadmin/config.php
vi /etc/httpd/conf.d/phpldapadmin.conf
14.启动管理工具
systemctl enable httpd systemctl start httpd
15.验证管理工具
http://ip/ldapadmin/
16.导入根数据
vi /etc/openldap/ldap/base.ldif
dn: dc=ldap,dc=com
o: ldap
objectclass: dcobject
objectclass: organization
ldapadd -x -w "123456" -D "cn=Manager,dc=ldap,dc=com" -f base.ldif
17.登陆ldap管理页面验证
ldap创建用户
1.创建OU组:groups
2.创建ou组:users组
3.在users组创建用户user1
4.在groups下创建用户组
至此创建完毕