Contents

Centos-搭建NFS共享

Centos-搭建NFS共享

系统:Centos-8 Linux master 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux 1.更换yum 源 关于Centos-8更换yum源方式请查看我以前文章–点击前往» 2.安装nfs-utils.x86_64 [root@master ~]# yum install nfs-utils.x86_64

上次元数据过期检查:0:00:13 前,执行于 2022年06月24日 星期五 23时54分53秒。 软件包 nfs-utils-1:2.3.3-41.el8.x86_64 已安装。 依赖关系解决。

软件包 架构 版本 仓库 大小

升级: nfs-utils x86_64 1:2.3.3-46.el8 BaseOS 500 k

事务概要

升级 1 软件包

总下载:500 k 确定吗?[y/N]: y

#———————–输入 y 进行确认————————-

下载软件包: nfs-utils-2.3.3-46.el8.x86_64.rpm 4.1 MB/s | 500 kB 00:00

总计 3.9 MB/s | 500 kB 00:00
警告:/var/cache/dnf/BaseOS-06809f5d8c62ad31/packages/nfs-utils-2.3.3-46.el8.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY CentOS-8 - Base - repo.huaweicloud.com 20 kB/s | 1.6 kB 00:00
导入 GPG 公钥 0x8483C65D: Userid: “CentOS (CentOS Official Signing Key) security@centos.org ” 指纹: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D 来自: https://repo.huaweicloud.com/centos/RPM-GPG-KEY-CentOS-Official 确定吗?[y/N]: y

#———————–输入 y 进行确认————————-

导入公钥成功 运行事务检查 事务检查成功。 运行事务测试 事务测试成功。 运行事务 准备中 :
运行脚本: nfs-utils-1:2.3.3-46.el8.x86_64
运行脚本: nfs-utils-1:2.3.3-46.el8.x86_64
升级 : nfs-utils-1:2.3.3-46.el8.x86_64
运行脚本: nfs-utils-1:2.3.3-46.el8.x86_64
运行脚本: nfs-utils-1:2.3.3-41.el8.x86_64
清理 : nfs-utils-1:2.3.3-41.el8.x86_64
运行脚本: nfs-utils-1:2.3.3-41.el8.x86_64
验证 : nfs-utils-1:2.3.3-46.el8.x86_64
验证 : nfs-utils-1:2.3.3-41.el8.x86_64

已升级: nfs-utils-1:2.3.3-46.el8.x86_64

完毕!

3.安装rpcbind (我的系统上竟然有这个包) [root@master ~]# yum install rpcbind

上次元数据过期检查:0:01:28 前,执行于 2022年06月24日 星期五 23时54分53秒。 软件包 rpcbind-1.2.5-8.el8.x86_64 已安装。 依赖关系解决。 无需任何处理。 完毕!

4.编辑NFS的配置文件 [root@master ~]# vim /etc/exports

/storage *(rw,sync,insecure,no_subtree_check,no_root_squash)

5.启动/重启服务 [root@master ~ ]# systemctl restart nfs-server [root@master ~ ]# systemctl restart rpcbind

6.查看服务运行状态 [root@master ~]# sudo service nfs-server status

Redirecting to /bin/systemctl status nfs-server.service ● nfs-server.service - NFS server and services Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled) Active: active (exited) since Sat 2022-06-25 00:00:55 CST; 3s ago Process: 33119 ExecStart=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi (code=exited, status=0/SUCCESS) Process: 33108 ExecStart=/usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS) Process: 33106 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS) Main PID: 33119 (code=exited, status=0/SUCCESS)

6月 25 00:00:55 storage systemd[1]: Starting NFS server and services… 6月 25 00:00:55 storage systemd[1]: Started NFS server and services.

7.查看nfs共享是否运行 [root@master ~]# showmount -e localhost

Export list for localhost: /storage *