CentOS 5 安裝 OpenLdap 管理通訊錄

  • compat-openldap-2.3.27_2.2.29-5
  • openldap-2.3.27-5
  • openldap-devel-2.3.27-5
  • openldap-clients-2.3.27-5
  • openldap-servers-2.3.27-5
  • openldap-servers-sql-2.3.27-5
  • 透過 slappasswd 產生主要的密碼
[root@pd920 ~]# slappasswd
New password:
Re-enter new password:
{SSHA}N3Xr7mUajfh9BY_________xx_WfWgb
  • vi /etc/openldap/slapd.conf
:
suffix          "dc=ichiayi,dc=com"
rootdn          "cn=Manager,dc=ichiayi,dc=com"
:
rootpw          {SSHA}N3Xr7mUajfh9BY_________xx_WfWgb
:
  • 將 DB_CONFIG.example → /var/lib/ldap/DB_CONFIG
cd /etc/openldap
cp DB_CONFIG.example /var/lib/ldap/DB_CONFIG
  • 編輯與匯入組織結構檔

root_unit.ldif

slapadd -v -l root_unit.ldif
----
[root@pd920 openldap]# slapadd -v -l /tmp/root_unit.ldif
added: "dc=ichiayi,dc=com" (00000001)
added: "ou=login,dc=ichiayi,dc=com" (00000002)
added: "ou=user,ou=login,dc=ichiayi,dc=com" (00000003)
added: "ou=group,ou=login,dc=ichiayi,dc=com" (00000004)
added: "ou=company,dc=ichiayi,dc=com" (00000005)
added: "ou=unit,ou=company,dc=ichiayi,dc=com" (00000006)
added: "ou=hr,ou=unit,ou=company,dc=ichiayi,dc=com" (00000007)
added: "ou=mis,ou=unit,ou=company,dc=ichiayi,dc=com" (00000008)
added: "ou=tech,ou=unit,ou=company,dc=ichiayi,dc=com" (00000009)
added: "ou=customer,ou=company,dc=ichiayi,dc=com" (0000000a)
----
chown -R ldap /var/lib/ldap/*
  • service ldap start
  • ldapsearch -x -b “dc=ichiayi,dc=com”

實際過程

實際安裝過程

  • 將通訊錄資料會出成 jonathan.ldif
  • 使用 slapadd -v -l jonathan.ldif 匯入
[root@pd920 tmp]# slapadd -v -l jonathan.ldif

bdb_db_open: Warning - No DB_CONFIG file found in directory /var/lib/ldap: (2)
Expect poor performance for suffix dc=ichiayi,dc=com.
<= str2entry: str2ad(mozillaNickname): attribute type undefined
slapadd: could not parse entry (line=742)
[root@pd920 tmp]#

[root@pd920 openldap]# service ldap start
正在為 slapd 檢查設定檔案:  config file testing succeeded
                                                           [  確定  ]
正在啟動 slapd:                                            [  確定  ]
[root@pd920 openldap]#
  • tech/openldap.txt
  • 上一次變更: 2009/06/05 07:18
  • jonathan