你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

CentOS7 NFS服务器搭建

2021/11/25 8:23:39

NFS服务端配置
[root@dns ~]# yum install nfs-utils -y
#第五行 取消注释并更改为自身的域名
[root@dns ~]# vim /etc/idmapd.conf
5 Domain = skills.com
#设置文件共享目录与IP地址
[root@dns ~]# vim /etc/exports
/home 192.168.199.0/24(rw,no_root_squash)

启动服务
[root@dns ~]# systemctl start rpcbind nfs-server
[root@dns ~]# systemctl enable rpcbind nfs-server
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.

防火墙放行服务
[root@dns ~]# firewall-cmd --add-service=nfs --permanent
success
[root@dns ~]# firewall-cmd --reload
success

NFS客户端配置
[root@www1 /]# yum install nfs-utils -y
[root@www1 /]# vim /etc/idmapd.conf
5 Domain = skills.com

启动服务
[root@www1 /]# systemctl start rpcbind
[root@www1 /]# systemctl enable rpcbind

挂载共享目录
[root@www1 /]# mount -t nfs dns.skills.com:/home /home
[root@www1 /]# df -hT #查看是否挂载成功
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root xfs 17G 1.7G 16G 10% /
devtmpfs devtmpfs 478M 0 478M 0% /dev
tmpfs tmpfs 489M 8.0K 489M 1% /dev/shm
tmpfs tmpfs 489M 13M 476M 3% /run
tmpfs tmpfs 489M 0 489M 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 125M 890M 13% /boot
tmpfs tmpfs 98M 0 98M 0% /run/user/0
dns.skills.com:/home nfs4 17G 1.9G 16G 11% /home

配置自动挂载
[root@www1 /]# vim /etc/fstab
#添加到最后
dns.skills.com:/home /home nfs defaults 0 0