RHEL7 部署 NFS 文件共享
- Linux
- 2024-07-25
- 48热度
- 0评论
一、NFS 服务端配置:
1、安装 NFS 服务:
rpm -qa | grep nfs-utils
yum install nfs-utils rpcbind
2、启动 NFS 服务:
systemctl start nfs-server
systemctl status nfs-server
systemctl status rpcbind
systemctl restart nfs-server
systemctl enable nfs-server
systemctl enable rpcbind
3、创建共享目录:
mkdir /home/UploadFile
4、vim /etc/exports,内容如下:
/home/UploadFile *(rw,sync,no_root_squash,no_subtree_check)
5、生效配置:
exportfs -r
6、查看服务端共享目录:
showmount -e 服务端IP
showmount -e 10.10.4.53
7、防火墙开放端口:
#firewall-cmd --add-service=nfs --zone=internal --permanent
#firewall-cmd --add-service=mountd --zone=internal --permanent
#firewall-cmd --add-service=rpc-bind --zone=internal --permanent
执行下边 public 的:
firewall-cmd --add-service=nfs --zone=public --permanent
firewall-cmd --add-service=mountd --zone=public --permanent
firewall-cmd --add-service=rpc-bind --zone=public --permanent
firewall-cmd --reload
firewall-cmd --list-ports
firewall-cmd --zone=internal --list-all
firewall-cmd --zone=public --list-all
二、NFS 客户端配置:
1、安装 NFS 服务:
rpm -qa | grep nfs-utils
yum install nfs-utils rpcbind
2、创建挂载点目录:
mkdir /nfsmount
3、查看服务端共享目录:
showmount -e 服务端IP
4、手动挂载:
#mount -t nfs -o options remote_host:/remote_directory /local_directory
示例:mount -t nfs 10.10.4.53:/home/UploadFile /home/UploadFile
5、查看所有挂载的文件系统:
mount | grep nfs
6、卸载挂载:
umount /home/UploadFile
7、系统启动时自动挂载:
vim /etc/fstab,增加:
服务端IP:/共享目录 /nfsmount nfs defaults 0 0
示例:10.10.4.53:/home/UploadFile /home/JianGong/wwwroot/upload nfs defaults 0 0
8、查看磁盘信息:
df -h
参考:
RHEL 7配置NFS服务 https://segmentfault.com/a/1190000008522916

鲁ICP备19063141号
鲁公网安备 37010302000824号