[转]CENTOS LINUX安装并使用NFS共享文件

FROM : http://www.qiansw.com/centos-linux-nfs.html

NFS是linux常用的一种文件分享工具。

下面介绍安装及使用方法。

 

CentOS 5.5

yum -y install setup-*  initscripts-*  nfs-utils-*  portmap-*  quota-* chkconfig nfs on chkconfig portmap on service nfs restart service portmap restart

CentOS 6.3

yum -y install nfs-utils rpcbind chkconfig nfs on chkconfig rpcbind on service rpcbind restart service nfs restart

共享文件

以共享/var/ftp和/nfs目录为例:
编辑/etc/exports文件

/var/ftp 192.168.16.0/255.255.255.0(rw,no_root_squash) /nfs 192.168.16.0/255.255.255.0(ro,sync)

挂载共享

以挂载192.168.16.170上的nfs共享/nfs到本地/var/www/html为例:
编辑/etc/fstab文件,添加下面一行至末尾。

192.168.16.170:/nfs /var/www/html nfs defaults 0 0

然后执行下面命令进行挂载

mount -a

可以通过下面命令查看挂载情况

df -hT
原文地址:https://www.cnblogs.com/Athrun/p/centos-linux-nfs.html