01 Solaris 111配置NIS.docx
《01 Solaris 111配置NIS.docx》由会员分享,可在线阅读,更多相关《01 Solaris 111配置NIS.docx(12页珍藏版)》请在冰豆网上搜索。
01Solaris111配置NIS
技术文档模板
(v140110)
作者
王卫锋
审核
分类
Solaris
子类
NIS
更新时间
2014-01-10
关键字
Solaris11.1
摘要
Solaris11.1,NIS
主要适用环境
Solaris11.1
版本说明
版本号
拟制/修改责任人
拟制/修改日期
修改内容/理由
V140110
王卫锋
2014-01-10
新建
目录
版本说明2
1系统和软硬件环境说明4
2配置NISMaster4
2.1安装所需的软件包4
2.2配置NIS域名5
2.3为NFSv4配置域名5
2.4确认/etc/hosts中有NISMaster和NISSlave(s)条目5
2.5创建原目录并复制源文件过去6
2.6编辑NISMakefile6
2.7初始化服务器6
2.8允许rpcbind远程访问(Solaris11.1新特性)7
3配置NISSlave8
3.1准备NISSlave服务器8
3.2启动NISClient服务8
3.3配置name-service/switch使用NIS8
3.4初始化NISSlave服务器9
3.5启动NISServer服务10
3.6允许rpcbind远程访问(Solaris11.1新特性)10
4配置NISClient10
4.1准备NISClient10
4.2初始化NISClient10
4.3配置name-service/switch使用NIS11
4.4启动NISClient服务11
4.5检查NISmaps能够被检索11
1系统和软硬件环境说明
硬件环境:
SPARC服务器
软件环境:
Solaris11.1
2配置NISMaster
使用root用户执行以下操作。
2.1安装所需的软件包
检查软件包是否已经安装
#pkginfoservice/network/nis
pkg:
info:
nopackagesmatchingthefollowingpatternsyouspecifiedare
installedonthesystem.Tryspecifying-rtoqueryremotely:
service/network/nis
以上的输出表明"service/network/nis"还没有安装,下面开始安装软件包
#pkginstallservice/network/nis
Packagestoinstall:
2
Createbootenvironment:
No
Createbackupbootenvironment:
No
Servicestochange:
1
DOWNLOADPKGSFILESXFER(MB)SPEED
Completed2/257/570.3/0.36.8M/s
PHASEITEMS
Installingnewactions101/101
UpdatingpackagestatedatabaseDone
UpdatingimagestateDone
CreatingfastlookupdatabaseDone
2.2配置NIS域名
在配置NIS域名之前,服务“svc:
/network/nis/domain”是disabled
#svcsnetwork/nis/domain
STATE STIME FMRI
disabled 10:
17:
04svc:
/network/nis/domain:
default
使用下面的命令配置NIS域名,例子使用“”
#domainname
文件/etc/defaultdomain自动被创建,服务“svc:
/network/nis/domain”状态为online。
#cat/etc/defaultdomain
#svcsnetwork/nis/domain
STATE STIME FMRI
online 10:
17:
08svc:
/network/nis/domain:
default
2.3为NFSv4配置域名
在所有的server和client上,NFSv4域名必须与NIS域名一样
#sharectlset-pnfsmapid_domain=nfs
2.4确认/etc/hosts中有NISMaster和NISSlave(s)条目
#cat/etc/hosts
#
#Copyright2009SunMicrosystems,Inc. Allrightsreserved.
#Useissubjecttolicenseterms.
#
#Internethosttable
#
:
:
1nis-masterlocalhost
127.0.0.1nis-masterlocalhostloghost
192.168.25.111 nis-master
192.168.25.112 nis-slave
2.5创建原目录并复制源文件过去
#mkdir-p/var/yp/src
#cd/etc
#cpauto_homeauto_masterbootparamsethersgrouphostsnetgroupnetmasksnetworkspasswdprotocolspublickeyrpcservicesshadowtimezoneuser_attr/var/yp/src
cp:
cannotaccessbootparams
cp:
cannotaccessethers
cp:
cannotaccessnetgroup
cp:
cannotaccesstimezone
注意:
bootparams,ethers,netgroup和timezone文件不存在
2.6编辑NISMakefile
如果没有安装“service/network/nis”服务,就不会有Makefile文件。
使用vi编辑器修改Makefile文件,“DIR”和“PWDIR”条目改为第5步中创建的目录。
如果你希望NIS使用DNS解析hosts,在Makefile文件中注释掉“B=”并取消注释“B=-b”。
“all:
”移除没有正确定义文件位置的映射,比如bootparams,ethers,netgroup和timezone文件默认不存在或被移除。
因为那样会导致编译过程中发生错误。
#cp/var/yp/Makefile/var/yp/Makefile.orig
#vi/var/yp/Makefile
DIR=/var/yp/src
PWDIR=/var/yp/src
all:
passwdgrouphostsipnodesnetworksrpcservicesprotocols\
netgrouppublickeyc2secureauto.masterauto.homeageing\
auth.attrexec.attrprof.attruser.attr
注意:
如果后面要使用netgroup映射,而文件还不存在,需在目标目录中创建文件:
#touch/var/yp/src/netgroup
2.7初始化服务器
进入目录“/var/yp”,然后运行命令“/usr/sbin/ypinit-m”初始化NIS服务器
#/usr/sbin/ypinit-m
InorderforNIStooperatesuccessfully,wehavetoconstructalistofthe
NISservers.PleasecontinuetoaddthenamesforYPserversinorderof
preference,oneperline.Whenyouaredonewiththelist,typea
orareturnonalinebyitself.
nexthosttoadd:
nis-master
nexthosttoadd:
nis-slave
nexthosttoadd:
^D
Thecurrentlistofypserverslookslikethis:
nis-master
nis-slave
Isthiscorrect?
[y/n:
y]
InstallingtheYPdatabasewillrequirethatyouanswerafewquestions.
Questionswillallbeaskedatthebeginningoftheprocedure.
Doyouwantthisproceduretoquitonnon-fatalerrors?
[y/n:
n]
OK,pleaseremembertogobackandredomanuallywhateverfails.Ifyou
don't,somepartofthesystem(perhapstheypitself)won'twork.
Theypdomaindirectoryis/var/yp/
Therewillbenofurtherquestions.Theremainderoftheprocedureshouldtake
5to10minutes.
Building/var/yp/
Running/var/yp/Makefile...
updatedpasswd
updatedgroup
updatedhosts
updatedipnodes
updatednetworks
updatedrpc
updatedservices
updatedprotocols
updatednetgroup
updatedpublickey
updatedauto.master
updatedauto.home
updatedageing
updatedauth_attr
updatedexec_attr
updatedprof_attr
updateduser_attr
nis-masterhasbeensetupasaypmasterserverwithoutanyerrors.
Iftherearerunningslaveypservers,runyppushnowforanydatabases
whichhavebeenchanged.Iftherearenorunningslaves,runypiniton
thosehostswhicharetobeslaveservers.
2.8允许rpcbind远程访问(Solaris11.1新特性)
默认rpcbind仅限于只能本地,允许rpcbind远程访问,参数“config/local_only”必须设置为false。
他是NISclient基于网络和NISserver沟通所必须的。
#svccfg-snetwork/rpc/bind
svc:
/network/rpc/bind>listpropconfig
config application
config/allow_indirect boolean true
config/enable_tcpwrappers boolean false
config/local_only boolean true
config/value_authorizationastring solaris.smf.value.rpc.bind
config/verbose_logging boolean false
svc:
/network/rpc/bind>setpropconfig/local_only=boolean:
false
svc:
/network/rpc/bind>exit
root@nis-master:
~#svcadmrefreshnetwork/rpc/bind
确认服务“network/rpc/bind”在修改后refresh。
3配置NISSlave
使用root用户执行以下操作。
3.1准备NISSlave服务器
同配置NISMaster服务器的第1-4步骤。
3.2启动NISClient服务
运行以下命令enableNISclient服务:
#svcadmenablesvc:
/network/nis/client:
default
运行以下命令确认NISclient服务已经运行:
#svcsnetwork/nis/client
3.3配置name-service/switch使用NIS
在Solaris11.1,文件/etc/nsswitch.conf不能直接被修改,通过ServiceManagementFacility(SMF)来修改:
#svccfg-sname-service/switch
svc:
/system/name-service/switch>listpropconfig
configapplication
config/defaultastringfiles
config/value_authorizationastringsolaris.smf.value.name-service.switch
config/hostastring"filesdnsmdns"
config/printerastring"userfiles"
svc:
/system/name-service/switch>setpropconfig/password=astring:
"filesnis"
svc:
/system/name-service/switch>setpropconfig/group=astring:
"filesnis"
svc:
/system/name-service/switch>exit
#svcadmrefreshname-service/switch
3.4初始化NISSlave服务器
运行命令“/usr/sbin/ypinit-smaster_machine_name”初始化NISSlave服务器
#/usr/sbin/ypinit-snis-master
InstallingtheYPdatabasewillrequirethatyouanswerafewquestions.
Questionswillallbeaskedatthebeginningoftheprocedure.
Doyouwantthisproceduretoquitonnon-fatalerrors?
[y/n:
n]
OK,pleaseremembertogobackandredomanuallywhateverfails. Ifyou
don't,somepartofthesystem(perhapstheypitself)won'twork.
Theypdomaindirectoryis/var/yp/
Therewillbenofurtherquestions.Theremainderoftheprocedureshouldtake
afewminutes,tocopythedatabasesfromnis-master.
Transferringnetworks.byaddr...
Transferringnetgroup.byuser...
Transferringhosts.byname...
Transferringprotocols.bynumber...
Transferringipnodes.byname...
Transferringprotocols.byname...
Transferringipnodes.byaddr...
Transferringpasswd.byname...
Transferringpasswd.byuid...
Transferringpublickey.byname...
Transferringageing.byname...
Transferringauth_attr...
Transferringnetworks.byname...
Transferringrpc.bynumber...
Transferringuser_attr...
Transferringhosts.byaddr...
Transferringauto.home...
Transferringauto.master...
Transferringservices.byservicename...
Transferringgroup.bygid...
Transferringypservers...
Transferringnetgroup...
Transferringexec_attr...
Transferringprof_attr...
Transferringgroup.byname...
Transferringnetgroup.byhost...
Transferringservices.byname...
nis-slave'snisdatabasehasbeensetup
withoutanyerrors.
3.5启动NISServer服务
运行以下命令enableNISserver服务:
#svcadmenablesvc:
/network/nis/server:
default
运行以下命令确认NISserver服务已经运行:
#svcsnetwork/nis/server
3.6允许rpcbind远程访问(Solaris11.1新特性)
同配置NISMaster服务器的第8步骤。
4配置NISClient
使用root用户执行以下操作。
4.1准备NISClient
同配置NISMaster服务器的第2-4步骤。
4.2初始化NISClient
运行命令“/usr/sbin/ypinit-c”初始化NISClient
#/usr/sbin/ypinit-c
InorderforNIStooperatesuccessfully,wehavetoconstructalistofthe
NISservers.PleasecontinuetoaddthenamesforYPserversinorderof
preference,oneperline.Whenyouaredonewiththelist,typea
orareturnonalinebyitself.
nexthosttoadd:
nis-master
nexthosttoadd:
nis-slave
nexthosttoadd:
^D
Thecurrentlistofypserverslookslikethis:
nis-master
nis-slave
Isthiscorrect?
[y/n:
y]
4.3配置name-service/switch使用NIS
在Solaris11.1,文件/etc/nsswitch.conf不能直接被修改,通过ServiceManagementFacility(SMF)来修改:
#svccfg-sname-service/switch
svc:
/system/name-service/switch>listpropconfig
configapplication
config/defaultastringfiles
config/value_authorizationastringsolaris.smf.value.name-service.switch
config/hostastring"filesdnsmdns"
config/printerastring"userfiles"
svc:
/system/name-service/switch>setpropconfig/password=astring:
"filesnis"
svc:
/system/name-service/switch>setpropconfig/group=astring:
"filesnis"
svc:
/system/name-service/switch>exit
#svcadmrefreshname-service/switch
4.4启动NISClient服务
运行以下命令enableNISclient服务:
#svcadmenablesvc:
/network/nis/client:
default
运行以下命令确认NISclient服务已经运行:
#network/nis/client
4.5检查NISmaps能够被检索
运行命令“ypwhich-m”查看NISmaps是否能够被检索:
#ypwhich-m
networks.byaddrnis-master
netgroup.byusernis-master
hosts.bynamenis-master
protocols.bynumbernis-master
ipnodes.bynamenis-master
protocols.bynamenis-master
ipnodes.by