服务端安装
使用yum方式,如果yum源有问题,可以使用阿里云yum源。如果是没有网络,请自行下载离线包安装
1、安装服务端nfs
yum install nfs-utils rpcbind -y
2、启动RPC
systemctl start rpcbind
3、开启自启动
systemctl enable rpcbind
4、检查端口有无启动
rpcinfo -p 127.0.0.1
5、启动NFS
systemctl start nfs
6、创建文件夹
mkdir /home/nfs
7、配置NFS
vim /etc/exports
写入一下文件 如果网段不铜,这里还需增加(如“/home/nfs 10.207.192.0/24,110.27.181.0/24,10.217.9.0/24,10.227.113.0/24”)
/home/nfs 10.207.192.0/24(rw,sync,no_root_squash,no_all_squash)
8、重启NFS
systemctl reload nfs
9、授权
chown -R nfsnobody.nfsnobody /home/nfs
客户端安装
yum install nfs-utils rpcbind -y
systemctl start rpcbind
systemctl enable rpcbind
showmount -e 10.207.192.151
mkdir /home/nfs
# 10.207.192.151 nfs server 所在服务器,这里是客户端挂server的某个文件夹
mount -t nfs 10.207.192.151:/home/nfs /home/nfs
防止服务器重启以后会失效
参考:
https://support.huawei.com/enterprise/zh/doc/EDOC1100198772?sendFrom=mobile
vim /etc/rc.d/rc.local
# 增加以下内容
mount -t nfs -o vers=3,proto=tcp,rsize=262144,wsize=262144,hard,intr,timeo=600 10.207.192.151:/home/nfs /home/nfs
最后
可以重启linux服务器,验证
reboot