⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0430nis.htm

📁 鸟哥LINUX 学习课本
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<li><font color="#000066" face="SimSun">portmap&#160; :就是 RPM 一定需要的数据啊!</font></li></ul> <br>我是在 Red Hat 系统上面使用的设定,所以档名是这样的一个模样,你可以使用『 	<font color="#000066" face="SimSun">rpm-qa | grep yp</font> 』来检查一下是否真的有安装这些个套件才行!不过,为什么NIS Server 的套件名称会是 yp 呢?还记得我们在上面提到的信息吗? NIS 最早的名称是Sun Yellow Pages ,所以啰,套件名称才会是 yp 啊! ^_^!这样好记多了吧!闲话不多说,马上来进行设定吧!</ul><hr width="100%"><a name="server"></a><font size="+1" color="#000099">Server端设定:</font><ul><font color="#000000">终于来到了设定的地方了, NIS 的设定与 NFS 的设定有点小小的相同之处,就是他的设定『粉简单!』的啦!架设他吧!</font><br><font color="#000000"> </font><br><hr width="100%"><a name="server_nis"></a><font size="+1" color="#000099">NISServer 的结构</font><br> <br>NIS Server 主要以 ypserv 这个套件提供的数据来进行设定的,他主要的内容有:<br> <ul><li><font color="#000066" face="SimSun">/etc/ypserv.conf&#160;&#160;&#160;&#160;&#160;&#160;:就是主要的设定档了</font></li><li><font color="#000066" face="SimSun">/usr/sbin/ypserv&#160;&#160;&#160;&#160;&#160;&#160;:主要的服务(daemon)执行档</font></li><li><font color="#000066" face="SimSun">/usr/sbin/rpc.yppasswdd:RPC的服务啰!</font></li><li><font color="#000066" face="SimSun">/usr/sbin/rpc.ypxfrd&#160;&#160;:同样的, RPC 的服务啰!</font></li><li><font color="#000066" face="SimSun">/usr/lib/yp/ypinit&#160;&#160;&#160;&#160;:建立 NIS 数据库的执行程序</font></li></ul> <br>所以,事实上我们最重要的就是设定 ypserv.conf 这个档案而已啦!至于 RPC的设定,就直接启动他即可!另外,还有 yp-tools 会提供的相关数据喔:<br> <ul><li><font color="#000066" face="SimSun">/usr/bin/yppasswd :更改你在NIS database (NIS Server 所制作的数据库) 的密码</font></li><li><font color="#000066" face="SimSun">/usr/bin/ypchsh&#160;&#160; :同上,但是是更改shell</font></li><li><font color="#000066" face="SimSun">/usr/bin/ypchfn&#160;&#160; :同上,但是是更改一些使用者的讯息!</font></li></ul> <br><hr width="100%"><a name="server_nis_setup"></a><font size="+1" color="#000099">NISServer 设定流程</font><br> <br>开始设定吧!在我的系统当中,假定我的网络状况如下:<br> <ul><li><font color="#000066">网域为 192.168.10.0/24</font></li><li><font color="#000066">NIS Server 的 IP 为 192.168.10.30,对应的主机名称为server.cluster</font></li><li><font color="#000066">NIS 的领域名称设定为 cluster</font></li></ul> <br>在 NIS Server 端以 root 身份登入后,进行下面的工作:<br> <ol><li><b><font color="#000099">启动 portmap 并设定开机时启动:</font></b></li><br>这个应该不难吧!使用:<table bgcolor="#000000" border="1" cols="1" width="550"><tbody><tr><td><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">/etc/rc.d/init.d/portmap start</font></font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]#</font><font color="#ffff00"> netstat -tl</font></font><br><font size="-1" color="#ffffff" face="SimSun">Active Internetconnections (only servers)</font><br><font size="-1" color="#ffffff" face="SimSun">Proto Recv-QSend-Q Local Address&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Foreign Address&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; State</font><br><font size="-1" face="SimSun"><font color="#ffffff">tcp&#160;&#160;&#160;&#160;&#160;&#160;&#160;0&#160;&#160;&#160;&#160;&#160; 0 *:</font><font color="#ffffcc">sunrpc</font><font color="#ffffff">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;*:*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;LISTEN</font></font><br><font size="-1" color="#ff6666" face="SimSun"># 如果看到sunrpc 的话,就表示启动成功了!</font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">chkconfig --level 35 portmap on</font></font><br><font size="-1" color="#ff6666" face="SimSun"># 上面这一行在设定portmap 在 run-level 为 3, 5 的时候就开机时启动!</font></td></tr></tbody></table>很简单吧!这样 portmap 就启动了!<br> <li><b><font color="#000099">启动 time 与 time-udp :</font></b></li><br>由于 time 与 time-upd 是在 NIS 运作时所需要的 daemon ,所以也必须要启动他啦!启动的方式也很简单,就是利用xinet 这个 super daemon 来进行即可!<table bgcolor="#000000" border="1" cols="1" width="550"><tbody><tr><td><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">vi /etc/xinetd.d/time</font></font><br><font size="-1" color="#ff6666" face="SimSun"># 找到底下这一行:</font><br><font size="-1" color="#ffffff" face="SimSun">disable = yes</font><br><font size="-1" color="#ff6666" face="SimSun"># 将他改成&#160;</font><br><font size="-1" color="#ffff00" face="SimSun">disable = no</font><br><font size="-1" color="#ff6666" face="SimSun"># 储存后离开</font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">vi /etc/xinetd.d/time-udp</font></font><br><font size="-1" face="SimSun"><font color="#ff6666"># 同样的将</font><font color="#ffffcc">disable= yes</font><font color="#ff6666"> 改成 </font><font color="#ffffcc">disable= no</font><font color="#ff6666"> 即可!</font></font><br><font size="-1" color="#ffffff" face="SimSun"> </font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">/etc/rc.d/init.d/xinetd restart</font></font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">netstat -utl</font></font><br><font size="-1" color="#ffffff" face="SimSun">Active Internetconnections (only servers)</font><br><font size="-1" color="#ffffff" face="SimSun">Proto Recv-QSend-Q Local Address&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Foreign Address&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; State</font><br><font size="-1" color="#ffffff" face="SimSun">tcp&#160;&#160;&#160;&#160;&#160;&#160;&#160;0&#160;&#160;&#160;&#160;&#160; 0 *:time&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;*:*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;LISTEN</font><br><font size="-1" color="#ffffff" face="SimSun">tcp&#160;&#160;&#160;&#160;&#160;&#160;&#160;0&#160;&#160;&#160;&#160;&#160; 0 *:sunrpc&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;*:*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;LISTEN</font><br><font size="-1" color="#ffffff" face="SimSun">udp&#160;&#160;&#160;&#160;&#160;&#160;&#160;0&#160;&#160;&#160;&#160;&#160; 0 *:time&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;*:*</font><br><font size="-1" color="#ffffff" face="SimSun">udp&#160;&#160;&#160;&#160;&#160;&#160;&#160;0&#160;&#160;&#160;&#160;&#160; 0 *:sunrpc&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;*:*</font></td></tr></tbody></table>注意喔!目前至少也要有上面四个 LISTEN 的 port 才行喔!分别是 UDP 与 TCP封包的啦!<br> <li><b><font color="#000099">建立 NIS 的领域名称 ( nisdomainname )</font></b></li><br><font color="#000000">在 NIS 的系统当中,他的领域名称 (domain name)是与 DNS 没有绝对关系的,由于这个领域名称会常被使用到,因此我们需要将他建立起来!建立起来的方法很简单,直接执行一个指令,并修改一个档案即可!</font><table bgcolor="#000000" border="1" cols="1" width="550"><tbody><tr><td><font size="-1" color="#ffffcc" face="SimSun">1. 建立 NIS的领域名称 (我这里是设定为 cluster ):</font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">nisdomainname cluster</font></font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">vi /etc/rc.d/rc.local</font></font><br><font size="-1" color="#ff6666" face="SimSun"># 将底下这一行加入这个档案的最后一行内:</font><br><font size="-1" color="#ffff00" face="SimSun">&#160;/bin/nisdomainnamecluster</font><br><font size="-1" color="#ffffff" face="SimSun"> </font><br><font size="-1" color="#ffffcc" face="SimSun">2. 设定好网络参数:</font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">vi /etc/sysconfig/network</font></font><br><font size="-1" color="#ff6666" face="SimSun"># 加入底下这一行:</font><br><font size="-1" color="#ffff00" face="SimSun">NISDOMAIN=cluster</font></td></tr></tbody></table><font color="#000000"> </font><li><b><font color="#000099">设定 ypserv 的设定档: ypserv.conf</font></b></li><br>这个设定档的内容其实也是很简单,大概只有几行而已,设定的主要语法为:<table bgcolor="#000000" border="1" cols="1" width="550"><tbody><tr><td><font size="-1" color="#ffffff" face="SimSun">&lt;设定项目&gt;:&lt;设定项目的值&gt;</font></td></tr></tbody></table>我们先谈一谈他里面的几个设定细项:<table bgcolor="#000000" border="1" cols="1" width="550"><tbody><tr><td><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">vi /etc/ypserv.conf</font></font><br><font size="-1" color="#ffff00" face="SimSun">files: 30</font><br><font size="-1" color="#ff6666" face="SimSun"># 这说的是『有多少数据库档案(databasefile)会被先读进高速缓存当中』</font><br><font size="-1" color="#ff6666" face="SimSun"># 的意思,一般来说,30 是已经很足够的数值了,不需要更动他;</font><br><font size="-1" color="#ffffff" face="SimSun"> </font><br><font size="-1" color="#ffff00" face="SimSun">trusted_master:your.master.servers.name</font><br><font size="-1" color="#ffff00" face="SimSun">xfr_check_port:yes</font><br><font size="-1" color="#ff6666" face="SimSun"># 上面这两个都仅与Master + Slave 架构有关的设定值,一般来说,</font><br><font size="-1" color="#ff6666" face="SimSun"># 只有一部主要NIS Server 的系统中是用不到这两个设定值的!</font><br><font size="-1" color="#ff6666" face="SimSun"># 如果你的NIS 是 slave 的架构,那么需要指定一部 master 做为数据库内容的</font><br><font size="-1" color="#ff6666" face="SimSun"># 同步时候的主机,那就是trusted_master 的设定内容啰!</font><br><font size="-1" color="#ff6666" face="SimSun"># 如果没有master/slave 架构时,那就不需要 trusted_master 这个设定了!</font><br><font size="-1" color="#ff6666" face="SimSun"># 至于 xfr_check_port则是指定 master 与 slave 是否都要以 &lt; 1024&#160;</font><br><font size="-1" color="#ff6666" face="SimSun"># 以下的 port来进行沟通的讯息!通常预设就是 yes ,不需要更动他!</font>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -