安装nfs和rpcbind设置linux服务器共享磁盘

1、安装nfs和rpcbind

1.1 检查服务器是否安装nfs和rpcbind,执行下命令,检查服务器是否安装过。

rpm -qa|grep nfs

rpm -qa|grep rpcbind

说明服务器以安装了,如果没有就需要自己安装

2、安装nfs和rpcbind

将rpm安装包:

libtirpc-0.2.4-0.10.el7.x86_64、nfs-utils-1.2.3-54.el6.x86_64、nfs-utils-lib-1.1.5-9.el6.x86_64、rpcbind-0.2.0-11.el6.x86_64 4个包传到服务器(nfs服务端:172.31.5.130 客户端:172.31.5.134)

用rpm --ivh 安装包名 --nodeps 命令安装这个4个包,优先装libtirpc-0.2.4-0.10.el7.x86_64

2.1检查nfs和rpcbind执行命令查看:

bash 复制代码
rpm -qa|grep nfs
rpm -qa|grep rpcbind

将172.31.5.130 /home/download 目录共享给172.31.5.134服务器

现在172.31.3.130 /home/下建立download文件夹:mkdir download

给文件赋较大的权限

在nfs服务端172.31.5.130服务上执行命令,vi /etc/exports编辑。内容如下

bash 复制代码
/home/download 172.31.5.134(insecure,rw,sync,no_root_squash)

:wq! 保存

2.2 启动nfs和rpcbind

2台服务器都要启动

先启动rpcbind:

bash 复制代码
service rpcbind start

检查rpcbind 状态:

bash 复制代码
service rpcbind status

在启动nfs:

bash 复制代码
service nfs start

检查nfs状态:

bash 复制代码
service nfs status

3、到客户端挂载(172.31.5.134)

为方便记忆我们建一个和172.31.5.130一样的文件路径,/home/download

bash 复制代码
mount -t nfs 172.31.5.130:/home/download /home/download

或者

bash 复制代码
mount -t nfs -o nolock,nfsvers=3,vers=3 172.31.5.130:/home/download

挂载成功后执行:df --h 命令查看挂载情况。

注意;

每次修改exports文件都需要重启nfs 和rpcbind或者重新挂载其他共享磁盘的时候均需要重启rpcbind和nfs

在目标服务器上修改exports,vi /etc/exports

然后service rpcbind restart

再重启service nfs restart

相关推荐
青青草原技术员灰太狼4 分钟前
Nginx的https搭建
linux·服务器·网络
xu_yule14 分钟前
网络和Linux网络-4(应用层)序列化和反序列化(网络计算器)
linux·网络
宇钶宇夕18 分钟前
三旺 INP314T 网关快速入门指南:从登录到基础配置
运维·自动化·软件工程
2***s6721 小时前
Failed to restart nginx.service Unit nginx.service not found
运维·nginx
拿破轮1 小时前
使用通义灵码解决复杂正则表达式替换字符串的问题.
java·服务器·前端
YongCheng_Liang2 小时前
Zabbix 6.4 完整部署教程:从环境准备到监控实战
linux·运维·zabbix
&&Citrus2 小时前
【杂谈】SNNU公共计算平台:深度学习服务器配置与远程开发指北
服务器·人工智能·vscode·深度学习·snnu
小白电脑技术2 小时前
旧电脑安装流畅的系统?用虚拟机先体验一下Linux Mint!
linux·电脑
数字化顾问2 小时前
(65页PPT)大型集团物料主数据管理系统建设规划方案(附下载方式)
大数据·运维·人工智能
翼龙云_cloud2 小时前
阿里云渠道商:新手怎么操作阿里云无影云电脑?
运维·服务器·阿里云·云计算·电脑