OpenLDAP 基本配置
目录服务其实也是一种数据库服务,只是这种数据库是一种
树形结构,而不是通常使用的关系数据库。目录服务与关系数据库之间的主要区别在于:二者都允许对存储数据进行访问,只是目录主要用于读取,其查询的效率很高,而关系数据库则是为读写而设计的。
下面搭建一基本可用的OpenLDAP服务器:
1、服务器安装ldap服务
?2、服务器安装nfs服务
?3、客户机配置身份验证方式
?4、客户机配置自动挂载
?5、测试和验证
clip_p_w_picpath002
1、安装配置ldap服务:
[root@localhost ~]# mount /dev/cdrom /mnt
[root@localhost ~]#service iptables stop
[root@localhost ~]#setenforce 0
[root@localhost ~]# cat /etc/yum.repos.d/rhel.repo
[rhel-local]
name=Red Hat Enterprise Linux
baseurl=file:///mnt/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@localhost ~]# yum install openldap-servers
[root@localhost ~]# cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf
[root@localhost ~]# mv /etc/openldap/slapd.d/ /etc/openldap/slapd.d.bak
[root@localhost ~]# vi /etc/openldap/slapd.conf
database bdb
suffix "dc=stlong,dc=com"
checkpoint 1024 15
rootdn "cn=root,dc=stlong,dc=com"

rootpw secret

rootpw 123123

导入账号信息:
[root@localhost ~]# yum install migrationtools
[root@localhost ~]# vi /usr/share/migrationtools/migrate_common.ph
# Default DNS domain
$DEFAULT_MAIL_DOMAIN = "stlong.com";
# Default base
$DEFAULT_BASE = "dc=stlong,dc=com";
[root@localhost ~]# /usr/share/migrationtools/migrate_base.pl >abc
[root@localhost ~]# /usr/share/migrationtools/migrate_passwd.pl /etc/passwd >>abc
[root@localhost ~]# /usr/share/migrationtools/migrate_group.pl /etc/group >>abc
[root@localhost ~]# service slapd start
[root@localhost migrationtools]# ldapadd -x -D 'cd=root,dc=stlong,dc=com' -W -f abc
配置NFS服务:
[root@localhost ~]#yum install nfs-utils
[root@localhost ~]# vi /etc/exports
/home *(rw)
[root@localhost ~]# service nfs start
配置客户端:
[root@localhost ~]# yum install nss-pam-ldapd
[root@localhost ~]# authconfig-tui
clip_p_w_picpath004
clip_p_w_picpath006
[root@localhost ~]service nscd start
[root@localhost ~]chkconfig nscd on
设置客户端自动挂载:
[root@localhost ~]# yum install nfs-utils autofs
[root@localhost ~]# vi /etc/auto.master
/home /etc/auto.home
[root@localhost ~]# vi /etc/auto.home
* -fstype=nfs 192.168.8.43:/home/
[root@localhost ~]# service autofs start
[root@localhost ~]# chkconfig autofs on
验证:
clip_p_w_picpath008