NIS下solaris和linxu的client实现AutoFS(转)

NIS下solaris和linxu的client实现AutoFS(转)[@more@]这是我同事(alex)原创,写的很好,抄过来,大家学习研究分享之用,谢谢!
-----------------------------------------------------------------
这几天,做了试验 是用solaris做nis server和 client 用solaris和linux实现auto_home和autofs
找了不少资料,都不完整,自己断断续续的写和装,可能有狠多错误.
slave server 没做,是网上找的,因为现实用的不多,为了完整凑的


NIS 管理域testdomain
NIS master server ip address: 10.1.100.2 ,hostname:SUN-2
NIS slave server ip address: 10.1.100.1 ,hostname:SUN-1

Default: NIS source files 存放在/etc目录下,这样map 的内容会与Master server的local files 相同,建议不要存放在/etc目录下。可通过修改/var/yp/Makefile,更改/etc换成你想要的directory。


# Set the following variable to "-b" to have NIS servers use the domain
name
# resolver for hosts not in the current domain.
#B=-b
B=
DIR =/etc
#
# If the passwd, shadow and/or adjunct files used by rpc.yppasswdd
# live in directory other than /etc then you'll need to change the
# following line.
# DO NOT indent the line, however, since /etc/init.d/yp attempts
# to find it with grep "^PWDIR" ...
#
PWDIR =/etc
DOM = `domainname`
NOPUSH = ""
ALIASES = /etc/mail/aliases
YPDIR=/usr/lib/netsvc/yp

NIS Master Server ---------solaris
1、#cp /etc/nsswitch.nis /etc/nsswitch.conf
2、#domainname testdomain
3、#domainname >; /etc/defaultdomain

4、#vi /etc/hosts
10.1.100.2 SUN-2
5、# vi /etc/auto_home
SUN-2:/export/home/&(如果 不配置slave server 可以不写)
6、#touch /etc/ethers /etc/bootparams /etc/netgroup /etc/netmasks. (系统不能建立,不建立可能报错)


7、#ypinit –m
In order for NIS to operate successfully, 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: SUN-2
next host to add: SUN-1 (如果 不配置slave server 可以不写)
next host to add:^D
The current list of yp servers looks like this:
server1
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] n
OK, please remember to go back and redo manually whatever fails. If you
don't, some part of the system (perhaps the yp itself) won't work.

#/usr/lib/netsvc/yp/ypstart

# ypwhich –m :如果能看到Master server的信息说明configure 成功


NIS Client --------solaris
1、#cp /etc/nsswitch.nis /etc/nsswitch.conf
2、#vi /etc/hosts
10.1.100.2SUN-2 loghost
10.1.100.1 SUN-1
3、#domainname testdomain
4、#domainname >; /etc/defaultdomain
5、#ypinit –c
(when prompted for a list of NIS servers,enter the names of the NIS master
and all slave servers)
6、#/usr/lib/netsvc/yp/ypstart

# ypwhich –m :如果能看到Master server的信息说明configure 成功




NIS slave server --------solaris
1、#cp /etc/nsswitch.nis /etc/nsswitch.conf
2、edit the /etc/hosts file to ensure that the NIS master and all
NIS slave servers have been defined
3、#domainname testdomain
4、#domainname >; /etc/defaultdomain
5、#ypinit -c
(when prompted for a list of NIS servers,enter the names of the NIS master
and all slave servers)
(on the NIS master,ensure the ypserv process is running ,we can use
#ps –ef|grep ypserv)
6、#/usr/lib/netsvc/yp/ypstart
7、#ypinit –s
(if you did not add the name of the NIS slave server when you initially
configured the NIS master server,you should run #ypinit –m once more on
the NIS master server)
NIS client--------linux


先看 ypbind是否起来,否则用 rpm 安裝。省略..
ntsysv﹐确定 ypbind 选择


1/bin/nisdomainname testdomain


2然后修改 /etc/yp.conf﹐加入

domain testdomain
ypserver SUN-2 或主机的ip



3修改 /etc/sysconfig/network
加入
NISDOMAIN=testdomain

4修改 /etc/nsswitch﹐修改
passwd: files nis nisplus
shadow: files nis nisplus
group: files nis nisplus

修改 /etc/passwd﹐在末尾加入﹕

+:::::: # 就是 + 号和6个冒号,(看文档说的 ,不知道原因,请高手指点)

然后启动ypbind﹕
service ypbind restart
应该就OK了
AUTOFS—solaris
首先 建立好你要mount的目录
这里主要是对Makefile文件的修改 ./var/yp下的
1,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.test
2
...
auto.master: auto.master.time
auto.home: auto.home.time
auto.test: auto.test.time
auth.attr:auth.attr.time
exec.attr:exec.attr.time
prof.attr:prof.attr.time
user.attr:user.attr.time
audit.user:audit.user.time
$(DIR)/netid:
$(DIR)/timezone:
$(DIR)/auto_master:
$(DIR)/auto_home:
$(DIR)/auto_test:
$(PWDIR)/shadow:
3这个文件要自己添加的,注意 空格,和TAB 是区分的,不然,等会Make你就死的狠难看啊..(当时 痛苦死…)

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
4
然后,执行
/usr/ccs/bin/make
Atuofs----Linux
确定autofs服务的running.然后运行 ntsysv 选择 autofs

修改/etc/auto.master ﹐加入如下句子﹕

/home /etc/auto.home --timeout=60


然后 vi /etc/auto.home
* test:/export/home/&

mkdir /home/yphome


最后执行 autofs 和 ypbind 服务﹕
servcie autofs restart
service ypbind restart



注意: 1有时候出现make正常但,autofs不上,我的原因是 域名的原因,请注意,有域名和管理域名的区别吧..
2,可能出现什么 RPC错误的用rpcinfo命令查看,我没遇到,所以不说了

关于Linux的NFS与Solaris不同点:

1. Solaris的目录共享设置文件是/etc/dfs/dfstab, 而RadHat Linux共享目录设置文件是/etc/exports
2. Solaris开机自动mount设置文件是/etc/vfstab, 而RadHat Linux开机自动mount设置文件是/etc/fstab

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10617542/viewspace-963014/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10617542/viewspace-963014/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值