在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

相关内容

热门资讯

透视教程!wepokerplu... 透视教程!wepokerplus外挂(透视)好像存在有挂(2025教程);1、下载好wepokerp...
透视辅助!德普之星有透视辅助吗... 透视辅助!德普之星有透视辅助吗,如何下载德普之星辅助软件,总结教程(有挂规律)是一款可以让一直输的玩...
透视免费!aapoker俱乐部... 透视免费!aapoker俱乐部靠谱吗(透视)破解侠是真的(总是真的有挂)1、金币登录送、破产送、升级...
透视教学!wepoker插件程... 透视教学!wepoker插件程序激活码(透视)真是是真的有挂(微扑克教程)1、wepoker插件程序...
透视私人局!如何下载德普之星辅... 透视私人局!如何下载德普之星辅助软件,德普之星辅助器,2024新版总结(有挂辅助);人气非常高,ai...
透视挂透视!aapoker透视... 透视挂透视!aapoker透视方法(透视)可以提高中牌率(好像真的有挂)1、进入到aapoker透视...
透视游戏!德扑圈有透视吗,德普... 1、透视游戏!德扑圈有透视吗,德普之星透视辅助软件,AI教程(有挂工具);代表性(透视辅助软件透明挂...
透视黑科技!wepoker智能... 透视黑科技!wepoker智能辅助插件(透视)果然有挂(系统教程)1、首先打开wepoker智能辅助...
透视app!aapoker怎么... 透视app!aapoker怎么拿好牌(透视)可以拿好牌(竟然是有挂)1、操作简单,无需注册,只需要使...
透视代打!德普辅助器辅助器怎么... 透视代打!德普辅助器辅助器怎么用,德扑圈有透视吗,可靠教程(有挂脚本)1)德普辅助器辅助器怎么用辅助...