安装NFS:
[root@yan ~]# yum install -y rpcbind nfs-utils
启动服务:
[root@yan ~]# systemctl restart rpcbind nfs
开机自启:
[root@yan ~]# systemctl enable nfs
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
编辑配置文件:
在服务端上编写
[root@yan ~]# vim /etc/exports
/NFS 192.168.93.143/24(rw,sync)
意思是共享给主机192.168.93.143 本主机下的 /NFS 文件
重启服务:
[root@yan ~]# systemctl restart rpcbind nfs
在客户端上安装nfs服务并挂载实现文件共享
mkdir /NFS
mount -t nfs 192.168.93.142:/NFS /NFS
把服务端上的文件共享到/NFS下
操作实例: