LDAP 安装

安装 OpenLDAP 组件

1
[root@server ~]# yum -y install openldap openldap-servers openldap-clients openldap-devel compat-openldap

初始化 LDAP 配置

1
2
3
4
[root@server ~]# cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
[root@server ~]# cp /usr/share/openldap-servers/slapd.ldif /etc/openldap/slapd.conf
[root@server ~]# chown -R ldap:ldap /etc/openldap/
[root@server ~]# chown -R ldap:ldap /var/lib/ldap/

启动 LDAP 服务

1
2
[root@server ~]# systemctl restart slapd
[root@server ~]# systemctl enable slapd

查看端口监听

1
2
3
[root@server ~]# netstat -ntplu | grep -i :389
tcp 0 0 0.0.0.0:389 0.0.0.0:* LISTEN 2023/slapd
tcp6 0 0 :::389 :::* LISTEN 2023/slapd

查看进程

1
2
[root@server ~]# ps aux | grep slapd | grep -v grep
ldap 2023 0.0 1.6 471844 31200 ? Ssl 11:27 0:00 /usr/sbin/slapd -u ldap -h ldapi:/// ldap:///