实验条件:
两台装有ubuntu的电脑(虚拟机)
服务器端IP192.168.1.103 客户端IP192.168.1.102
注意:为了实验方便,两台电脑连在同一路由器上。
服务器端配置:
1.安装nfs相关服务
apt-get install nfs-kernel-server
2.创建服务器所要分享的文件夹nfsfile,并且设置权限
mkdir /nfsfile
chmod 777 nfsfile/
3.编辑/etc/exports的信息
vim /etc/exprots
添加内容如下:
/nfsfile 192.168.1.102 (insecure,rw,sync,no_root_squash)
4.启动NFS服务
/etc/init.d/nfs-kernel-server start
5.为了方便检验有没有成功,在nfsfile文件里加一些文件
echo "Welcome" > /nfsfile/readme
客户端配置:
1.安装NFS服务
apt-get install nfs-common
2.挂载
mount 192.168.1.103:/nfsfile /share/
检验: