# yum list openldap*
# yum install openldap-clients.i386 openldap-servers.i386 -y
# yum list db4*
# yum install db4-devel.i386 db4-utils.i386 -y
# vi adu.sh
-------------
#!/bin/bash
mkdir /lhome
for i in `seq 1 10`
do
useradd -d /lhome/luser$i luser$i
echo 123456 | passwd luser$i --stdin
done
-------------
# cd /etc/openldap
# cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
# vi /etc/openldap/slapd.conf
------------------
 86 suffix          "dc=uplooking,dc=com"
 87 rootdn          "cn=Manager,dc=uplooking,dc=com"
 91 rootpw          uplooking
------------------

# cd /usr/share/openldap/migration/
# vi migrate_common.ph
------------------
 71 $DEFAULT_MAIL_DOMAIN = "uplooking.com";
 74 $DEFAULT_BASE = "dc=uplooking,dc=com";
------------------
# ./migrate_base.pl > /root/base.ldif
# vi /root/base.ldif
------------------
dn: dc=uplooking,dc=com
dc: uplooking
objectClass: top
objectClass: domain

dn: ou=People,dc=uplooking,dc=com
ou: People
objectClass: top
objectClass: organizationalUnit

dn: ou=Group,dc=uplooking,dc=com
ou: Group
objectClass: top
objectClass: organizationalUnit
--------------------

# slapadd -vl /root/base.ldif 
bdb_db_open: Warning - No DB_CONFIG file found in directory /var/lib/ldap: (2)
Expect poor performance for suffix dc=uplooking,dc=com.
added: "dc=uplooking,dc=com" (00000001)
added: "ou=People,dc=uplooking,dc=com" (00000002)
added: "ou=Group,dc=uplooking,dc=com" (00000003)


#cd /var/lib/ldap
#chown ldap.ldap *
#tail /etc/passwd > /root/p1
#tail /etc/group > /root/g1
#cd /usr/share/openldap/migration
# ./migrate_passwd.pl /root/p1 > /root/passwd.ldif
# ./migrate_group.pl /root/g1 > /root/group.ldif

# ldapadd -xWD "cn=Manager,dc=uplooking,dc=com" -f passwd.ldif 
Enter LDAP Password: 
adding new entry "uid=luser1,ou=People,dc=uplooking,dc=com"
adding new entry "uid=luser2,ou=People,dc=uplooking,dc=com"
adding new entry "uid=luser3,ou=People,dc=uplooking,dc=com"
adding new entry "uid=luser4,ou=People,dc=uplooking,dc=com"
adding new entry "uid=luser5,ou=People,dc=uplooking,dc=com"
adding new entry "uid=luser6,ou=People,dc=uplooking,dc=com"
adding new entry "uid=luser7,ou=People,dc=uplooking,dc=com"
adding new entry "uid=luser8,ou=People,dc=uplooking,dc=com"
adding new entry "uid=luser9,ou=People,dc=uplooking,dc=com"
adding new entry "uid=luser10,ou=People,dc=uplooking,dc=com"

# ldapadd -xWD "cn=Manager,dc=uplooking,dc=com" -f group.ldif 
Enter LDAP Password: 
adding new entry "cn=luser1,ou=Group,dc=uplooking,dc=com"
adding new entry "cn=luser2,ou=Group,dc=uplooking,dc=com"
adding new entry "cn=luser3,ou=Group,dc=uplooking,dc=com"
adding new entry "cn=luser4,ou=Group,dc=uplooking,dc=com"
adding new entry "cn=luser5,ou=Group,dc=uplooking,dc=com"
adding new entry "cn=luser6,ou=Group,dc=uplooking,dc=com"
adding new entry "cn=luser7,ou=Group,dc=uplooking,dc=com"
adding new entry "cn=luser8,ou=Group,dc=uplooking,dc=com"
adding new entry "cn=luser9,ou=Group,dc=uplooking,dc=com"
adding new entry "cn=luser10,ou=Group,dc=uplooking,dc=com"

# ldapsearch -xWD "cn=Manager,dc=uplooking,dc=com" -b "uid=luser1,ou=People,dc=uplooking,dc=com" -LLL

#vi /etc/exports
-----------
/lhome *(rw,sync)
-----------
#service nfs restart

# slappasswd -h {sha}
New password: 
Re-enter new password: 
{SHA}PHZ8Qa+xKtoUAZDtgts/2TDi76M=

# vi /etc/openldap/slapd.conf 
----------------------------------------------
rootpw    {SHA}PHZ8Qa+xKtoUAZDtgts/2TDi76M=
----------------------------------------------
# service ldap restart