1.CentOS 6.4系统下查看nfs软件是否安装和启动服务
[root@localhost ~]# rpm -aq |egrep 'nfs|rpcbind'
rpcbind-0.2.0-11.el6.i686
nfs-utils-1.2.3-36.el6.i686
nfs-utils-lib-1.1.5-6.el6.i686
[root@localhost ~]# /etc/init.d/rpcbind restart
Stopping rpcbind: [ OK ]
Starting rpcbind: [ OK ]
[root@localhost ~]# /etc/init.d/nfs restart
Shutting down NFS daemon: [ OK ]
Shutting down NFS mountd: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
[root@localhost ~]#
2.修改配置文件
[root@localhost ~]# vim /etc/exports
/home/nfs 2.2.2.10(ro) --这个IP是能读不能写
/home/nfs *(rw,sync,no_root_squash) --其它IP可以读写
3.关于nfs服务端的端口管理
[root@localhost ~]# vim /etc/sysconfig/nfs
RQUOTAD_PORT=875 --开户以下四行
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
4.开启包过滤
[root@localhost ~]# iptables -I INPUT -p tcp -m multiport --ports 111,875,892,2049,32769 -j ACCEPT
[root@localhost ~]# iptables -I INPUT -p udp -m multiport --ports 111,875,892,2049,32769 -j ACCEPT
[root@localhost ~]#
5.查看服务器共享的文件
[root@localhost ~]# showmount -e
Export list for node1:
/home/nfs (everyone)
[root@localhost ~]#
6.客户端挂载
[root@centos media]# /etc/init.d/rpcbind restart
Stopping rpcbind: [ OK ]
Starting rpcbind: [ OK ]
[root@centos media]# showmount -e 2.2.2.27
Export list for 2.2.2.27:
/home/nfs (everyone)
[root@centos media]# mount -t nfs 2.2.2.27:/home/nfs /media/
[root@centos media]# mkdir 2
[root@centos media]# ll
total 4
drwxr-xr-x 2 root root 4096 Jan 13 10:22 2
[root@centos media]#
相关阅读:
Ubuntu 12.04安装NFS server
NFS服务器安装配置实现Ubuntu 12.04与ARM文件共享
Heartbeat_ldirector+LB+NFS实现HA及LB、文件共享