在CentOS 7 中配置NFS服务器
创始人
2025-01-17 01:04:09
0

目录

1、克隆两个虚拟机

2、安装 NFS 服务

3、NFS 服务使用


1、克隆两个虚拟机

nfs-server  nfs-client(修改ip地址)  [root@xnode1 ~]# cd /etc/sysconfig/network-scripts/  [root@xnode1 network-scripts]# vi ifcfg-eno16777736

#修改内容如下

BOOTPROTO=static

ONBOOT=yes

IPADDR=192.168.224.4(网络nat网段)

NETMASK=255.255.255.0

GATEWAY=192.168.224.2

DNS1=8.8.8.8

[root@xnode1 network-scripts]#cd(退出)

[root@xnodel~]#systemctl restart network

 CRT连接(root密码:000000)

(2)主机名配置及解释

[root@demo ~]# hostnamectl set-hostname nfs-server [root@demo ~]# bash [root@nfs-server ~]# vi /etc/hosts

#增加

192.168.224.3 nfs-server

192.168.224.4 nfs-client

[root@demo ~]# hostnamectl set-hostname nfs-client [root@demo ~]# bash [root@nfs-client ~]# vi /etc/hosts

#增加

192.168.224.3 nfs-server

192.168.224.4 nfs-client

2、安装 NFS 服务

[root@nfs-server ~]# yum -y install nfs-utils rpcbind [root@nfs-client ~]#  yum -y install nfs-utils rpcbind

3、NFS 服务使用

[root@nfs-server ~]# mkdir /mnt/test [root@nfs-server ~]# vi /etc/exports

#增加

/mnt/test 192.168.224.0/24(rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501)

[root@nfs-server ~]# exportfs -r

nfs-server 端启动 NFS 服务,命令如下:

[root@nfs-server ~]# systemctl start rpcbind  [root@nfs-server ~]# systemctl start nfs

nfs-server 端查看可挂载目录,命令如下:

[root@nfs-server ~]# showmount -e 192.168.224.3

转到 nfs-client 端,在客户端挂载前,先要将服务器的 SELinux 服务和防火墙服务关闭, 命令如下:

[root@nfs-client ~]# setenforce 0 [root@nfs-client ~]# systemctl stop firewalld

在 nfs-client 节点,进行 NFS 共享目录的挂载,命令如下:

[root@nfs-client ~]# mount -t nfs 192.168.224.3:/mnt/test /mnt/

查看挂载情况

[root@nfs-client ~]# df -h

4.验证 NFS 共享存储

[root@nfs-client ~]# cd /mnt/  [root@nfs-client mnt]# ll  total 0  [root@nfs-client mnt]# touch abc.txt  [root@nfs-client mnt]# md5sum abc.txt d41d8cd98f00b204e9800998ecf8427e abc.txt  [root@nfs-server ~]# cd /mnt/test/  [root@nfs-server test]# ll  total 0  -rw-r--r--. 1 root root 0 Oct 30 07:18 abc.txt  [root@nfs-server test]# md5sum abc.txt d41d8cd98f00b204e9800998ecf8427e abc.txt

相关内容

热门资讯

今天下午!微信老铁13水辅助,... 今天下午!微信老铁13水辅助,潮汕雀友会辅助,总结教程(有挂细节)-哔哩哔哩1、微信老铁13水辅助辅...
详情透视!xpoker辅助!分... 详情透视!xpoker辅助!分辨真假辅助攻略(有挂教程)-哔哩哔哩小薇(辅助器软件下载)致您一封信;...
据监测!欢游互动辅助,蜀山四川... 据监测!欢游互动辅助,蜀山四川破解好友版辅助,手册教程(有挂分析)-哔哩哔哩1、蜀山四川破解好友版辅...
科普透视!wepoker有没有... 科普透视!wepoker有没有插件!每日必看辅助攻略(今日头条)-哔哩哔哩1、操作简单,无需wepo...
据权威媒体报道!雀姬辅助器,四... 据权威媒体报道!雀姬辅助器,四川家园辅助软件,讲义教程(有挂技巧)-哔哩哔哩一、四川家园辅助软件可以...
专业透视!pokemmo辅助官... 专业透视!pokemmo辅助官网!玩家必看教程辅助神器(有挂头条)-哔哩哔哩1、进入到pokemmo...
普及透视!wepoker软件安... 普及透视!wepoker软件安装包!重大通报辅助技巧(真是有挂)-哔哩哔哩暗藏猫腻,小编详细说明we...
有消息称!衢州都莱有没有辅助器... 有消息称!衢州都莱有没有辅助器,钱塘十水三挂件,攻略教程(有挂教学)-哔哩哔哩衢州都莱有没有辅助器破...
关于透视!hhpoker德州牛... 关于透视!hhpoker德州牛仔视频!总算清楚辅助技巧(有挂解惑)-哔哩哔哩1、点击下载安装,hhp...
针对!天天微友辅助器通用版,广... 针对!天天微友辅助器通用版,广东雀神智能辅助照片,学习教程(有挂教学)-哔哩哔哩1、下载好天天微友辅...