Centos5.6安装并部署LDAP服务
2011-11-17 15:24
459 查看
LDAP是轻量目录访问协议,英文全称是Lightweight Directory Access Protocol,一般都简称为LDAP。它是基于X.500标准的,但是简单多了并且可以根据需要定制。与X.500不同,LDAP支持TCP/IP,这对访问Internet是必须的。LDAP的核心规范在RFC中都有定义,所有与LDAP相关的RFC都可以在LDAPman RFC网页中找到。简单说来,LDAP是一个得到关于人或者资源的集中、静态数据的快速方式。
1、CentOS上yum方式安装openldap
查看有没下面4个相关的openldap包;
Shell脚本代码
[root@RDCenter125 yzwei]# rpm -qa|grep openldap
openldap-servers-2.3.27-8.el5_2.4
openldap-devel-2.3.27-8.el5_2.4
openldap-clients-2.3.27-8.el5_2.4
openldap-2.3.27-8.el5_2.4
[root@RDCenter125 yzwei]# rpm -qa|grep openldap
openldap-servers-2.3.27-8.el5_2.4
openldap-devel-2.3.27-8.el5_2.4
openldap-clients-2.3.27-8.el5_2.4
openldap-2.3.27-8.el5_2.4
没有的话通过下面命令安装;
Java代码
[root@RDCenter125 yzwei]# yum install openldap openldap-servers openldap-clients openldap-devel
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Setting up Install Process
Parsing package install arguments
。。。。。。
[root@RDCenter125 yzwei]#
[root@RDCenter125 yzwei]# yum install openldap openldap-servers openldap-clients openldap-devel
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Setting up Install Process
Parsing package install arguments
。。。。。。
[root@RDCenter125 yzwei]#
yum命令一个好处就是解决了大部分的包依赖关联,不用自己去安装,比如openldap默认存储的数据放在bdb中,这些包我们不用关心就帮我们安装好啦!yum方式安装的openldap命令在”/usr/bin”,”/usr/sbin”目录下,
如:
/usr/bin/ldapsearch
/usr/bin/ldapadd
/usr/sbin/slapadd
/usr/sbin/slapdel
2、ldap配置
修改slapd.conf配置文件, 主要修改部分如下;
配置脚本代码
database bdb
suffix “dc=chinahcn,dc=com” #修改domain信息
rootdn “cn=Manager,dc=chinahcn,dc=com” #修改domain信息
# Cleartext passwords, especially for the rootdn, should
# be avoided. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
# rootpw secret
# rootpw {crypt}ijFYNcSNctBYg
rootpw secret #打开密码保护
建立ldap到bdb的连接,并启动ldap;
Shell脚本代码
[root@RDCenter125 yzwei]# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
[root@RDCenter125 yzwei]#
[root@RDCenter125 yzwei]# service ldap start
Checking configuration files for slapd: config file testing succeeded
[ OK ]
Starting slapd: [ OK ]
[root@RDCenter125 yzwei]# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
[root@RDCenter125 yzwei]#
[root@RDCenter125 yzwei]# service ldap start
Checking configuration files for slapd: config file testing succeeded
[ OK ]
Starting slapd: [ OK ]
3、ldap数据导入
先停掉ldap服务,然后导入用户数据(数据在附件压缩包中).
Shell脚本代码
[root@RDCenter125 data]# service ldap stop
……
[root@RDCenter125 data]# slapadd -v -l root-unit.ldif
……
[root@RDCenter125 data]# slapadd -v -l users.ldif
……
[root@RDCenter125 data]# service ldap stop
……
[root@RDCenter125 data]# slapadd -v -l root-unit.ldif
……
[root@RDCenter125 data]# slapadd -v -l users.ldif
……
ldap的数据默认放在”/var/lib/ldap”目录下,通过root账户运行slapadd命令添加的数据产生的文件属性属于root用户root组,但是service启动ldap是用ldap用户启动的,所以需要把这些文件的属性修改一下。下面这句脚本代码非常重要,否则数据只能读不能修改删除,血的教训。
Shell脚本代码
[root@RDCenter125 data]# chown -R ldap.ldap /var/lib/ldap/
[root@RDCenter125 data]# service ldap start
……
[root@RDCenter125 data]# chown -R ldap.ldap /var/lib/ldap/
[root@RDCenter125 data]# service ldap start
……
至此服务器端ldap完成,服务器端占用的端口默认是389。
1、CentOS上yum方式安装openldap
查看有没下面4个相关的openldap包;
Shell脚本代码
[root@RDCenter125 yzwei]# rpm -qa|grep openldap
openldap-servers-2.3.27-8.el5_2.4
openldap-devel-2.3.27-8.el5_2.4
openldap-clients-2.3.27-8.el5_2.4
openldap-2.3.27-8.el5_2.4
[root@RDCenter125 yzwei]# rpm -qa|grep openldap
openldap-servers-2.3.27-8.el5_2.4
openldap-devel-2.3.27-8.el5_2.4
openldap-clients-2.3.27-8.el5_2.4
openldap-2.3.27-8.el5_2.4
没有的话通过下面命令安装;
Java代码
[root@RDCenter125 yzwei]# yum install openldap openldap-servers openldap-clients openldap-devel
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Setting up Install Process
Parsing package install arguments
。。。。。。
[root@RDCenter125 yzwei]#
[root@RDCenter125 yzwei]# yum install openldap openldap-servers openldap-clients openldap-devel
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Setting up Install Process
Parsing package install arguments
。。。。。。
[root@RDCenter125 yzwei]#
yum命令一个好处就是解决了大部分的包依赖关联,不用自己去安装,比如openldap默认存储的数据放在bdb中,这些包我们不用关心就帮我们安装好啦!yum方式安装的openldap命令在”/usr/bin”,”/usr/sbin”目录下,
如:
/usr/bin/ldapsearch
/usr/bin/ldapadd
/usr/sbin/slapadd
/usr/sbin/slapdel
2、ldap配置
修改slapd.conf配置文件, 主要修改部分如下;
配置脚本代码
database bdb
suffix “dc=chinahcn,dc=com” #修改domain信息
rootdn “cn=Manager,dc=chinahcn,dc=com” #修改domain信息
# Cleartext passwords, especially for the rootdn, should
# be avoided. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
# rootpw secret
# rootpw {crypt}ijFYNcSNctBYg
rootpw secret #打开密码保护
建立ldap到bdb的连接,并启动ldap;
Shell脚本代码
[root@RDCenter125 yzwei]# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
[root@RDCenter125 yzwei]#
[root@RDCenter125 yzwei]# service ldap start
Checking configuration files for slapd: config file testing succeeded
[ OK ]
Starting slapd: [ OK ]
[root@RDCenter125 yzwei]# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
[root@RDCenter125 yzwei]#
[root@RDCenter125 yzwei]# service ldap start
Checking configuration files for slapd: config file testing succeeded
[ OK ]
Starting slapd: [ OK ]
3、ldap数据导入
先停掉ldap服务,然后导入用户数据(数据在附件压缩包中).
Shell脚本代码
[root@RDCenter125 data]# service ldap stop
……
[root@RDCenter125 data]# slapadd -v -l root-unit.ldif
……
[root@RDCenter125 data]# slapadd -v -l users.ldif
……
[root@RDCenter125 data]# service ldap stop
……
[root@RDCenter125 data]# slapadd -v -l root-unit.ldif
……
[root@RDCenter125 data]# slapadd -v -l users.ldif
……
ldap的数据默认放在”/var/lib/ldap”目录下,通过root账户运行slapadd命令添加的数据产生的文件属性属于root用户root组,但是service启动ldap是用ldap用户启动的,所以需要把这些文件的属性修改一下。下面这句脚本代码非常重要,否则数据只能读不能修改删除,血的教训。
Shell脚本代码
[root@RDCenter125 data]# chown -R ldap.ldap /var/lib/ldap/
[root@RDCenter125 data]# service ldap start
……
[root@RDCenter125 data]# chown -R ldap.ldap /var/lib/ldap/
[root@RDCenter125 data]# service ldap start
……
至此服务器端ldap完成,服务器端占用的端口默认是389。
相关文章推荐
- Centos5.6 x86下部署安装DRBD+Heartbeat+MySQL
- centos6.4安装配置LDAP服务
- 【CNMP系列】CentOS7.0下安装MySql5.6服务
- CentOS 7部署OpenStack(2)―安装keystone服务
- CentOS 7下tomcat应用服务简易安装部署
- 【CNMP系列】CentOS7.0下安装MySql5.6服务
- Centos7手动部署Openstack Mitaka版安装配置--(四)安装镜像服务glance
- centos5.6安装部署cobbler
- 第三百九十九节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署CentOS6.5安装mysql5.6
- centos 下安装 thrift(为部署 vddk 服务做准备)
- Linux服务器 CentOS 6.0 安装 jdk1.7 tomcat7 mysql5.6 【云服务器部署 x64】 推荐
- Centos7 Gogs服务安装部署
- Centos5.6 x86下部署安装DRBD+Heartbeat+MySQL
- Centos5.6 x86下部署安装DRBD+Heartbeat+MySQL
- [shell]CentOS 5.6安装web服务及相关软件(php 5.3, MySQL Server, memcache, spawn-fcgi, nginx, coreseek)
- centos6.5安装配置LDAP服务[转]
- CentOS 5.6 下离线部署NodeJS环境和工程代码,并添加forever的开机自启动服务
- centos5.6安装后部署全过程记录20120225
- [shell]CentOS 5.6安装web服务及相关软件(php 5.3, MySQL Server, memcache, spawn-fcgi, nginx, coreseek)
- CentOS 7部署OpenStack(2)―安装keystone服务