- 论坛徽章:
- 0
|
![]()
文件:
install NIS.rar
大小:
80KB
下载:
下载
install NIS
注:OS的主机名不可以大小混合
整体架构:
NIS系统中有
一台Master NIS服务器 ( hostname: sun3)
一台Slave NIS服务器 (hostname: sun4)
一台Client NIS (hostname: sun5)
NIS domainname: testnis.com.cn
实现的功能:
1. 每个nis帐号在nis服务器中有个和用户名一样的个人目录.nis帐号在client上登陆后,能够自动挂接到nis服务器中的用户目录
2. 同时,nis服务器中还有一个共享目录.全部用户只能进行只读.
服务类型: ip地址 主机名
master nis: 192.168.6.191 sun3
slave nis: 192.168.6.200 sun4
client nis: 192.168.6.211 sun5
nis帐号在NIS服务器中的目录: /export/home
NIS服务器中共享目录:/opt/software
configure master nis
修改/var/yp/Makefile
root@sun3#cp /var/yp/Makefile /var/yp/Makefile.bak //备份Makefile文件
root@sun3#vi /var/yp/Makefile
增加(加黑粗体)
all: passwd group hosts ipnodes ethers networks rpc services protocols \
netgroup bootparams aliases publickey netid netmasks c2secure \
timezone auto.master auto.home auto.direct \
auth.attr exec.attr prof.attr user.attr audit.user
auto.direct.time: $(DIR)/auto_direct
-@if [ -f $(DIR)/auto_direct ]; then \
sed -e "/^#/d" -e s/#.*$$// $(DIR)/auto_direct \
| $(MAKEDBM) - $(YPDBDIR)/$(DOM)/auto.direct; \
touch auto.direct.time; \
echo "updated auto.direct"; \
if [ ! $(NOPUSH) ]; then \
$(YPPUSH) auto.direct; \
echo "pushed auto.direct"; \
else \
: ; \
fi \
else \
echo "couldn't find $(DIR)/auto_direct"; \
fi
auto.master: auto.master.time
auto.home: auto.home.time
auto.direct: auto.direct.time
auth.attr:auth.attr.time
$(DIR)/auto_master:
$(DIR)/auto_home:
$(DIR)/auto_direct:
$(PWDIR)/shadow:
如果在配置后修改,需要执行: #cd /var/yp;/usr/ccs/bin/make
1.
root@sun3#cp /etc/nsswitch.conf /etc/nsswitch.conf.bak //备份/etc/nsswitch.conf
root@sun3#cp /etc/nsswitch.nis /etc/nsswitch.conf
2.
root@sun3#domainname testnis.com.cn
root@sun3#domainname > /etc/defaultdomain
3.
root@sun3#vi /etc/hosts
添加备用服务器和客户端服务器
192.168.6.200 sun4
192.168.6.211 sun5
3.
root@sun3#vi /etc/locale
testnis.com.cn en_US
4.
root@sun3#touch /etc/ethers /etc/netgroup /etc/bootparams /etc/timezone
root@sun3#cd /etc/security
root@sun3# cp audit_user exec_attr auth_attr prof_attr /etc/
5.
root@sun3# ypinit -m
in order for NIS to operate sucessfully, we have to construct a list of the
NIS servers. Please continue to add the names for YP servers in order of
preference, one per line. When you are done with the list, type a
or a return on a line by itself.
next host to add: sun3
next host to add: sun4 加上备服务器sun4
next host to add: ^D
The current list of yp servers looks like this:
sun3
sun4
Is this correct? [y/n: y] y
Installing the YP database will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.
Do you want this procedure to quit on non-fatal errors? [y/n: n] y
The yp domain directory is /var/yp/testnis.com.cn
Can we destroy the existing /var/yp/testnis.com.cn and its contents? [y/n: n] y
There will be no further questions. The remainder of the procedure should take
5 to 10 minutes.
Building /var/yp/testnis.com.cn/ypservers...
Running /var/yp /Makefile...
updated passwd
updated group
updated hosts
updated ipnodes
updated ethers
updated networks
updated rpc
updated services
updated protocols
updated netgroup
updated bootparams
/var/yp/testnis.com.cn/mail.aliases: 3 aliases, longest 10 bytes, 52 bytes total
/usr/lib/netsvc/yp/mkalias /var/yp/`domainname`/mail.aliases /var/yp/`domainname`/mail.byaddr;
updated aliases
updated publickey
updated netid
/usr/sbin/makedbm /etc/netmasks /var/yp/`domainname`/netmasks.byaddr;
updated netmasks
updated timezone
updated auto.master
updated auto.home
updated auto.direct
updated auth_attr
updated exec_attr
updated prof_attr
updated user_attr
updated audit_user
sun3 has been set up as a yp master server without any errors.
If there are running slave yp servers, run yppush now for any data bases
which have been changed. If there are no running slaves, run ypinit on
those hosts which are to be slave servers.
#
6.
root@sun3#/usr/lib/netsvc/yp/ypstart
starting NIS (YP server) services: ypserv ypbind ypxfrd rpc.yppasswdd rpc.ypupdated done. /必须是五个进程都启动(如果主机混合大小写,这里就只能启动ypserv ypbind)
root@sun3#ypwhich -m
root@sun3#ypcat hosts
root@sun3#ypcat passwd
7.
root@sun3#vi /etc/auto_home
add:
* sun3:/export/home/&
root@sun3#vi /etc/auto_direct
+auto_direct
/software sun3:/opt/software
8.
root@sun3#vi /etc/dfs/dfstab
add:
share -F nfs /export/home
share –F nfs /opt/software
root@sun3#mkdir /opt/software
root@sun3#unshareall
root@sun3#shareall
root@sun3#share
root@sun3#
root@sun3#
root@sun3#
root@sun3#
root@sun3#
root@sun3#
configure slave NIS-----
1.
root@sun4 #cp /etc/nsswitch.conf /etc/nsswitch.conf.bak
root@sun4 #cp /etc/nsswitch.nis /etc/nsswitch.conf
2. root@sun4 #domainname testnis.com.cn
root@sun4 #domainname >/etc/defaultdomain
3. root@sun4 #vi /etc/hosts
add:
192.168.6.191 sun3
192.168.6.211 sun5
4.
root@sun4 # ypinit -c
In order for NIS to operate sucessfully, we have to construct a list of the
NIS servers. Please continue to add the names for YP servers in order of
preference, one per line. When you are done with the list, type a
or a return on a line by itself.
next host to add: sun3
next host to add: sun4
next host to add: ^D
The current list of yp servers looks like this:
sun3
sun4
Is this correct? [y/n: y] y
root@sun4 #
5.
root@sun4 #/usr/lib/netsvc/yp/ypstart
starting NIS (YP server) services: ypbind done.
6.
root@sun4 #ypinit -s sun3
Installing the YP database will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.
Do you want this procedure to quit on non-fatal errors? [y/n: n] y
The yp domain directory is /var/yp/testnis.com.cn
Can we destroy the existing /var/yp/testnis.com.cn and its contents? [y/n: n] y
There will be no further questions. The remainder of the procedure should take
a few minutes, to copy the data bases from sun3.
Transferring audit_user...
Transferring user_attr...
Transferring prof_attr...
Transferring exec_attr...
Transferring auth_attr...
Transferring auto.direct...
Transferring auto.home...
Transferring auto.master...
Transferring timezone.byname...
Transferring netmasks.byaddr...
Transferring netid.byname...
Transferring mail.byaddr...
Transferring mail.aliases...
Transferring bootparams...
Transferring netgroup.byhost...
Transferring netgroup.byuser...
Transferring netgroup...
Transferring protocols.byname...
Transferring protocols.bynumber...
Transferring services.byservicename...
Transferring services.byname...
Transferring rpc.bynumber...
Transferring networks.byaddr...
Transferring networks.byname...
Transferring ethers.byname...
Transferring ethers.byaddr...
Transferring ipnodes.byaddr...
Transferring publickey.byname...
Transferring ipnodes.byname...
Transferring hosts.byaddr...
Transferring hosts.byname...
Transferring group.bygid...
Transferring group.byname...
Transferring passwd.byuid...
Transferring passwd.byname...
Transferring ypservers...
sun4's nis data base has been set up
without any errors.
root@sun4 #
configure NIS Client
1. root@sun5 #cp /etc/nsswitch.nis /etc/nsswitch.conf
2. root@sun5#domainname testnis.com.cn
root@sun5#domainname >/etc/defaultdomain
3. root@sun5#vi /etc/hosts
add
192.168.6.191 sun3
192.168.6.200 sun4
4.
root@sun5# ypinit -c
In order for NIS to operate sucessfully, we have to construct a list of the
NIS servers. Please continue to add the names for YP servers in order of
preference, one per line. When you are done with the list, type a
or a return on a line by itself.
next host to add: sun3
next host to add: sun4
next host to add: ^D
The current list of yp servers looks like this:
sun3
sun4
Is this correct? [y/n: y] y
root@sun5 #
5.
root@sun5#/usr/lib/netsvc/yp/ypstart
starting NIS (YP server) services: ypbind done.
root@sun5#ypwhich –m (/如果能看到Master server的信息说明configure 成功)
root@sun5#vi /etc/auto_master
root@sun5# Master map for automounter
#
+auto_master
/net -hosts -nosuid,nobrowse
/home auto_home -nobrowse
/xfn -xfn
/- auto_direct
root@sun5#vi /etc/auto_home
+auto_home
* sun3:/export/home/&
root@sun5#vi /etc/auto_direct
+auto_direct
/software sun3:/opt/software
root@sun5#/etc/rc2.d/S74autofs stop
root@sun5#/etc/rc2.d/S74autofs start
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/16077/showart_255169.html |
|