nfs 作用:linux系统文件共享
server端
安装
[root@NFSserver ~]# yum install -y rpcbind nfs-utils
[root@NFSserver ~]# rpm -qa rpcbind nfs-utils
rpcbind-1.2.5-4.el8.x86_64
nfs-utils-2.3.3-26.el8.x86_64
启动服务
[root@NFSserver ~]# systemctl start rpcbind
[root@NFSserver ~]# systemctl enable rpcbind
[root@NFSserver ~]# systemctl start nfs
Failed to start nfs.service: Unit nfs.service not found.
[root@NFSserver ~]# systemctl start nfs-server
[root@NFSserver ~]# systemctl enable nfs-server
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /usr/lib/systemd/system/nfs-server.service.
设置共享目录
[root@NFSserver ~]# vim /etc/exports
[root@NFSserver ~]# cat /etc/exports
/nfsdir 10.0.0.0/24(ro,rw)
重启服务
[root@NFSserver ~]# systemctl restart nfs-server
客户端
安装服务,并启动
mount.nfs 192.168.199.1:/nfsdir /sharedir
设置开机自动挂载
[root@nfsclient ~]# vim /etc/fstab
.........
192.168.199.1:/nfsdir /sharedir nfs default,_rnetdev 0 0