5 NFS NFS Server NFS Client NIS NIS
5-0 (Network File System, NFS) Unix NFS mount NFS... Network Information Service NIS Linux NIS NIS NIS / / /etc/passwd /etc/group NFS NIS 5-1 NFS 5-1-1 NFS NFS Network File System 1984 UNIX/Linux NFS NFS, NFS NFS RPM NFS NFS-Serve NFS client NFS-Server NFS Server daemon 156
NFS NIS 5-1-2 NFS 5-1 NFS 5-1-3 NFS Unix/Linux 5-1-4 NFS Server 1 NFS rpm -qa grep nfs nfs-unils -0.3.3-5 # nfs 2 NFS mount /mnt/cdrom cd /mnt/cdrom/redhat/rpms ls nfs* 157
rpm ivh nfs-utils -0.3.1.1-3.i386.rpm 3 rpm -Uvh nfs-utils -0.3.1.1-3.i386.rpm 4 NFS rpm -qa grep nfs nfs-utils -0.3.3-5 5 rpm -ql nfs-utils -0.3.3-5 5-1-5 NFS Remote Procedure Call RPC rpcinfo -p ntsysv portmap /etc/rc.d/init.d/portmap start 5-2 NFS 5-1-6 NFS 1 158
NFS NIS /etc/rc.d/init.d/nfs start Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS mountd: [ OK ] Starting NFS daemon: [ OK ] NFS 8 ps ax grep nfsed 2 Status- : /etc/rc.d/init.d/nfs status rpc.mountd pid 31447 is running... nfsd pid 31465 31464...31458 is running... rpc.rquotad pid 31437 is running... Restart- NFS stop- NFS Reload- NFS 3 NFS chkconfig --level 5 nfs on level 5 NFS chkconfig --list grep nfs list run level NFS 159
5-2 NFS Server 1. Webmin NFS -> ->NFS 5-3 Webmin NFS http://www.linux.com/search/index.phtml/nfs 2. NFS 5-4 ( ) 3. /etc/export 160
NFS NIS 1. /home/yjhwang 2. ip 3. 4. 6. -> 5. 5-5 /etc/exports 5-1 /etc/exports ( )?... IP WebNFS Sun WebNFS NIS 192.168.2.0/255.255.255.0 IP 192.168.2.1 192.168.2.254? NFS 1024 UDP Unix NFS 161
? Unix? root root PC UID "," 510,511,520-525,1100-1150 GID "," 510,511,520-525,1100-1150 4. 5-6 162
NFS NIS 5. 1 NFS /etc/exports pico/etc/exports 2 /etc/exports /home/yjhwang /home 3 exportfs -rv 192.168.0.0/255.255.255.0 rw dns2.drserv.com.tw rw,no_root_squash exporting dns2.drserv.com.tw:/home exporting 192.168.0.0/255.255.255.0:/home/yjhwang exporting dns2.drserv.com.tw:/home to kernel 6. exportfs -v demo:/tmp -o ro # /tmp domo 163
5-3 NFS Client 1. NFS showmount NFS showmount -e servername-- showmount -a mount mkdir /mnt/nfs2 mount servername:/home /mnt/nfs2 cd /mnt/nfs2 ls -l 2. NFS Server mount mount -t nfs 192.168.1.100:/tmp /mnt/nfs 3. NFS, /etc/fstab pico /etc/fstab nfs:/home/ftp/pub /mnt/nfs2 nfs rw 0 0 0, ext2 1 0 0 0 4. NFS umount /mnt/nfs2 164
NFS NIS 5-4 NIS 5-4-1 NIS NIS Network Information Service Sun Microsystems Sun Yellow Pages YP YP Yellow Pages Sun NIS yp 5-4-2 NIS Internet IP IP Address IP IP IP TCP/IP IP 4 IP host table Linux/UNIX /etc/hosts 2 IP IP IP host unknown NIS NIS domain NIS Client NIS Server IP 165
5-4-3 NIS NIS Domain NIS Domain NIS Server NIS Server Domain NIS Domain /etc/passwd /etc/hosts NIS Server Server NIS MAP NIS Client NIS Server A NIS Server Master B ypserv NIS Client Linux Server ypbind Internet D NIS Client Linux Server C NIS Server Slave ypbind ypserv 5-7 NIS 5-5 NIS 5-5-1 NIS NIS Server NIS Client Red Hat 7.3 rpm -qa grep yp NIS 166
NFS NIS [root@localhost root]# rpm qa grep yp yp-tools-2.6.4 freetype-2.0.3-7 ypbind-1.10-7 ypserv-2.2-9 yp 4 yp-tool-2.6-4 ypbind-1.10-7 NIS Client ypserv -2.2-9 NIS Server freetype NIS RedHat 7.3 NIS 167
NIS Server RedHat RPMS rpm ivh ypserv2.2-9.i386.rpm [root@localhost RPMS]# pwd /mnt/cdrom/redhat/rpms [root@loachost RPMS]# rpm ivh ypserv-2.2-9.i386.rpm Prepaeing ####################################### [100%] packagke ypserv-2.2-9 is already installed mnt/cdrm/redhat/rpms/ RedHat RPMS ypserv -2.2-9.i386.rpm RPM NIS Server RPM Client Server rpm ivh ypbind1.10-7.i386.rpm rpm ivh yptools2.6-4.i386.rpm ypbind-1.10-7.i386.rpm [root@localhost RPMS]# rpm ivh ypbind-1.10-7.i386.rpm Preparing #################################### [100%] package ypbind-1.10-7 is already installed 168
NFS NIS yptools -2.6.4.i386.rpm [root@localhost RPMS]# rpm ivh yp-tools-2.6.4.i386.rpm Preparing #################################### [100%] package yp-tools-2.6-4 is already installed 5-5-2 NIS Server Domainname NIS domain NIS Server NIS Server domain domain NIS Client NIS Server Domainname domainname none domainname [root@localhost /]# domainname none domainname linuxnis domainname linuxnis /etc/sysconfig/network domainname linuxnis [root@localhost /]# domainname linuxnis linuxnis [root@loalhoat /]# pico /etc/sysconfig/network 169
domainname linuxnis domainname linuxnis pico /etc/sysconfig/network domainname linuxnis pico/etc/sysconfig/network NIS_DOMAIN=linuxnis domainname linuxnis /etc/sysconfig/network... NETWORKING=yes HOSTNAME=localhost.localdomain NIS_DOMAIN=linuxnis /etc/sysconfig/network NIS domainname linuxnis /var/yp/makefile /var/yp/makefile NIS Server Map Map NIS Map Map passwd /etc/passwd /var/yp/makefile $ YPPWDDIR /var/yp/makefile /etc $ YPPWDDIR /hosts /etc/hosts 170
NFS NIS /var/yp/makefile 2-9 passwd group hosts rpc... NIS Map # If you don't want some of these maps built, feel free to comment # them out from this list. all: passwd group hosts rpc services netid protocols mail \ # netgrp shadow publickey networks ethers bootparams printcap \ # amd.home auto.master auto.home auto.local passwd.adjunct \ # timezone locale netmasks /var/yp/makefile 5-5-3 NIS Server Map NIS server NIS Server /etc/rc.d/init.d./ypserv start /etc/rc.d/init.d/ypserv start 171
NIS Client NIS Server Server yppasswdd 5-8 ypbind, yppasswdd,ypserv NIS Server MAP NIS MAP /usr/lib/yp/ypinit -m NIS Server MAP MAP NIS Server Database /var/yp/linuxnis next host to add Slave Server MAP 172
NFS NIS Webmin NIS Server NIS Server Master Slave NIS MAP 5-9 Webmin NIS Server 173
5-5-4 NIS Client NIS Client domainname NIS Server NIS Client Daemon ntsysv NIS Client Daemon ypbind NIS Client yppasswd passwd NIS Server passwd NIS Server /etc/passwd yppasswd NIS Server Client NIS Client /etc/passwd NIS Map NIS Client /etc/passwd /etc/passwd +::0:0::: NIS Client NIS Server /etc/hosts ypbind /etc/hosts NIS Server Map NIS Client ypwhich NIS Server 5-6 1. NFS rpc.portmap NFS 174
NFS NIS rpc.nsfd NFS rpc.mountd 2. NFS Server NFS Client /etc/exports /etc/fstab mount 3. NIS Server domainname domainname none domainname /var/yp/makefile NIS Server Map Map /usr/lib/yp/ypinit m NIS MAP 4. NIC Client : ntsysv ypbind ypwhich NIS Server 175