05
2012
03

Solaris 10安装配置NIS服务及RHEL客户端配置

前面介绍过RHEL下的NIS安装及配置[Redhat Linux安装配置NIS服务],作为从SUN Solaris系统移植过来的服务,这里看看solaris下是如何配置的。

实验环境:

  • NIS服务器:Solaris 10
  • NIS客户端:RHEL 6

Solaris服务器端的配置:

修改hosts文件,使服务器端及客户端的域名可以得到解析

 # cat /etc/hosts

192.168.1.211 solaris.liusuping.com

192.168.1.202 client.liusuping.com  ##RHEL 客户端

设置NIS 域名

#domainname liusuping.com 

将nis域名设置为默认域名

#cat /etc/defaultdomain 

liusuping.com 

 修改 /etc/nsswitch.conf配置文件

# cat /etc/nsswitch.conf

#

# /etc/nsswitch.files:

#

# An example file that could be copied over to /etc/nsswitch.conf; it

# does not use any naming service.

#

# "hosts:" and "services:" in this file are used only if the

# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.

passwd:     files nis

group:      files nis

hosts:      files nis

 添加几个用户:

# useradd liu

# useradd suping

# passwd liu

# passwd suping

 建立以下文件,否则初始化时有报错。

# touch /etc/ethers

# touch /etc/netgroup

# touch /etc/bootparams

创建时区文件,用来同步时间。

# vi  /etc/timezone

GMT+8:00 en_US

 初始化NIS服务

# 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 <control D>

or a return on a line by itself.

        next host to add:  solaris

        next host to add:  ^D

The current list of yp servers looks like this:

 

solaris

 

Is this correct?  [y/n: 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]  

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.

The yp domain directory is /var/yp/liusuping.com

Can we destroy the existing /var/yp/liusuping.com 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/liusuping.com/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/liusuping.com/mail.aliases: 12 aliases, longest 10 bytes, 138 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 ageing

updated auth_attr

updated exec_attr

updated prof_attr

updated user_attr

updated audit_user

 

solaris 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.

完成初始化后服务自动启动 

# ps -ef |grep yp

  daemon   113     1   0 21:03:18 ?           0:00 /usr/lib/crypto/kcfd

    root  2176     1   0 21:56:18 ?           0:00 /usr/lib/netsvc/yp/ypbind

    root  2177  1185   0 21:57:14 pts/3       0:00 grep yp

    root  1486     1   0 21:41:20 ?           0:00 /usr/lib/netsvc/yp/ypxfrd

    root  1497     1   0 21:41:21 ?           0:00 /usr/lib/netsvc/yp/rpc.ypupdated

    root  1494     1   0 21:41:20 ?           0:00 /usr/lib/netsvc/yp/rpc.yppasswdd -m

    root  1485     1   0 21:41:20 ?           0:00 /usr/lib/netsvc/yp/ypserv -d

 RHEL Client客户端配置

 修改/etc/hosts文件

192.168.1.211 solaris.liusuping.com

192.168.1.202 client.liusuping.com  ##RHEL 客户端

 修改/etc/nsswitch.conf 

[root@client ~]# vi /etc/nsswitch.conf 

passwd:     files nis

shadow:     files nis

group:      files nis

 

#hosts:     db files nisplus nis dns

hosts:      files nis dns

 安装ypbind

[root@client ~]# yum install ypbind

 修改主机名及nis域名

[root@client ~]# vi /etc/sysconfig/network

 NETWORKING=yes

HOSTNAME=client.liusuping.com

NISDOMAIN=liusuping.com

 开机自动加入nis域

[root@client ~]# cat /etc/rc.local 

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.

/bin/nisdomainname liusuping.com

touch /var/lock/subsys/local

 启动ypbind服务

[root@client ~]# service ypbind restart

关闭 NIS 服务:[确定]

启动 NIS 服务:[确定]

绑定 NIS 服务:.[确定]

 查看nis服务器

[root@client ~]# ypwhich

solaris.liusuping.com

 完成安装。

« 上一篇下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。