服務器端
NFS服務器分配IP為192.168.1.100
NFS客戶端分配IP為192.168.1.200
nfs-server.example.com配置如下:
[root@nfs-server ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=nfs-server.example.com
[root@nfs-server ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.200 nfs-client.example.com nfs-client
默認安裝下已經裝好NFS服務了,所以只用開啟服務器即可。
[root@nfs-server ~]# chkconfig nfs on
比如要共享/data/目錄:
[root@nfs-server ~]# mkdir /data
[root@nfs-server ~]# vi /etc/exports
/data/ 192.168.1.200(rw,no_root_squash,no_all_squash,sync)
現在就可以啟動NFS服務了。
[root@nfs-server ~]# service nfs start
服務器端結束