<转>CentOS 7 安装配置 NFS
CentOS 7 安装配置 NFS
环境
nps 192.168.1.97
client 192.168.1.98
一、yum 安装
yum -y install nfs-utils rpcbind
nfs 的配置文件 /etc/expots
默认为空
vi /etc/exports
/opt/test/ 192.168.1.0/24(rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501)
二、使配置生效
exportfs -r
注:配置文件说明:
/opt/test 为共享目录
192.168.1.0/24 可以为一个网段,一个IP,也可以是域名,域名支持通配符 如: *.qq.com
rw:read-write,可读写;
ro:read-only,只读;
sync:文件同时写入硬盘和内存;
async:文件暂存于内存,而不是直接写入内存;
no_root_squash:NFS客户端连接服务端时如果使用的是root的话,那么对服务端分享的目录来说,也拥有root权限。显然开启这项是不安全的。
root_squash:NFS客户端连接服务端时如果使用的是root的话,那么对服务端分享的目录来说,拥有匿名用户权限,通常他将使用nobody或nfsnobody身份;
all_squash:不论NFS客户端连接服务端时使用什么用户,对服务端分享的目录来说都是拥有匿名用户权限;
anonuid:匿名用户的UID值,可以在此处自行设定。
anongid:匿名用户的GID值。
三、启动 nfs
service rpcbind start
service nfs start
chkconfig rpcbind on
chkconfig nfs on
四、客户端挂载:
showmount -e 192.168.1.97 #查看可挂载
Export list for 192.168.1.97:
/opt/test 192.168.1.0/24
客户端挂载
mount -t nfs 192.168.1.97:/opt/test /mnt
无提示 既为成功
客户端在挂载的时候遇到的一个问题如下,可能是网络不太稳定,NFS默认是用UDP协议,换成TCP协议即可:
mount -t nfs 192.168.1.97:/opt/test /mnt -o proto=tcp -o nolock
------------------------------------------------------以上来自linux.it.net.cn
PS:报错:mount.nfs: access denied by server while mounting
Jun
29 00:49:04 lzgonline mountd[1644]: refused mount request from
192.168.3.12 for /home/lzgonline/rootfs (/home/lzgonline/rootfs): illegal port 1689
Jun
29 00:51:02 lzgonline mountd[1644]: refused mount request from
192.168.3.12 for /home/lzgonline/rootfs (/home/lzgonline/rootfs):
illegal port 1710
Jun 29 01:02:17 lzgonline mountd[1644]: refused
mount request from 192.168.3.12 for /home/lzgonline/rootfs
(/home/lzgonline/rootfs): illegal port 1916
Jun 29 01:09:51 lzgonline
mountd[1644]: refused mount request from 192.168.3.12 for
/home/lzgonline/rootfs (/home/lzgonline/rootfs): illegal port 2157
Jun
29 01:17:02 lzgonline mountd[1644]: refused mount request from
192.168.3.12 for /home/lzgonline/rootfs (/home/lzgonline/rootfs):
illegal port 2318
denied by server while mounting 192.168.3.12:/home/lzgonline/rootfs
被拒绝的原因是因为使用了非法端口,功夫总没白费,终于在一个linux技术论坛上找到了答案:
I googled and found that since the port is over 1024 I needed to add the "insecure" option to the relevant line in /etc/exports on the server. Once I did that (and ran exportfs -r), the mount -a on the client worked.
//如果端口号大于1024,则需要将 insecure 选项加入到配置文件(/etc/exports)相关选项中mount客户端才能正常工作:
查看 exports 手册中关于 secure 选项说明也发现确实如此
[root@lzgonline init.d]# man exports
secure,This
option requires that requests originate on an Internet port less than
IPPORT_RESERVED (1024). This option is on by default. To turn it off,
specify insecure.
//secure 选项要求mount客户端请求源端口小于1024(然而在使用 NAT 网络地址转换时端口一般总是大于1024的),默认情况下是开启这个选项的,如果要禁止这个选项,则使用 insecure 标识
修改配置文件/etc/exports,加入 insecure 选项
/home/lzgonline/rootfs *(insecure,rw,async,no_root_squash)
保存退出
然后重启nfs服务:service nfs restart
-------------------------以上来自http://liuzhigong.blog.163.com/blog/static/17827237520115305226932/
实际使用时,在message中没有看到 illegal port 相关日志。 但是加入 insecure配置后,问题解决
<转>CentOS 7 安装配置 NFS的更多相关文章
- CentOS 7 安装配置 NFS
CentOS 7 安装配置 NFS 环境 nps 192.168.1.97 client 192.168.1.98 一.yum 安装 yum -y install nfs-utils rpcbind ...
- CentOS下安装配置NFS并通过Java进行文件上传下载
1:安装NFS (1)安装 yum install nfs-utils rpcbind (2)启动rpcbind服务 systemctl restart rpcbind.service 查看服务状态 ...
- 【转】CentOS 7 安装配置 NFS
环境 nps 192.168.1.97 client 192.168.1.98 一.yum 安装 yum -y install nfs-utils rpcbind nfs 的配置文件 /etc/exp ...
- CentOS 6.5配置nfs服务
CentOS 6.5配置nfs服务 网络文件系统(Network File System,NFS),一种使用于分散式文件系统的协议,由升阳公司开发,于1984年向外公布.功能是通过网络让不同的机器.不 ...
- (转)Centos7安装配置NFS服务和挂载
Centos7安装配置NFS服务和挂载 原文:https://www.u22e.com/601.html NFS简介 NFS(Network File System)即网络文件系统,是FreeBSD支 ...
- linux 安装配置NFS服务器
一.Ubuntu安装配置NFS 1.安装NFS服务器 sudo apt-get install nfs-kernel-server 安装nfs-kernel-server时,apt会自动安装nfs-c ...
- Centos下安装配置LAMP(Linux+Apache+MySQL+PHP)
Centos下安装配置LAMP(Linux+Apache+MySQL+PHP) 关于LAMP的各种知识,还请大家自行百度谷歌,在这里就不详细的介绍了,今天主要是介绍一下在Centos下安装,搭建一 ...
- CentOS 7安装配置Apache HTTP Server
原文 CentOS 7安装配置Apache HTTP Server RPM安装httpd # yum -yinstall httpd //安装httpd会自动安装一下依赖包: apr apr-ut ...
- 分布式文件系统 FastDFS 5.0.5 & Linux CentOS 7 安装配置(单点安装)——第一篇
分布式文件系统 FastDFS 5.0.5 & Linux CentOS 7 安装配置(单点安装)--第一篇 简介 首先简单了解一下基础概念,FastDFS是一个开源的轻量级分布式文件系统,由 ...
随机推荐
- JSP报错01
ZC: 创建一个JSP之后,就报如下错误. 1.错误: 1.1. 2.处理: Exlipse for JEE --> Project Explorer 中选择项目 --> 右击项目名 -- ...
- git常用操作 配置用户信息、拉取项目、提交代码、分支操作、版本回退...
git常用操作 配置用户信息.拉取项目.提交代码.分支操作.版本回退... /********git 配置用户信息************/ git config --global user.name ...
- python学习笔记(session)
昨天提到想加入cookies 测试登录后的接口 尝试了下 只要用 session方法即可 代码如下 #!/usr/bin/env python # -*- coding: utf_8 -*- impo ...
- 【C#笔札】 界面逐渐显现的实现
如果labview做 就如同上图,so eazy! 现改C#实现这个简单的功能. 在工具箱找到Timer控件 双击 思路如下,界面打开时触发timer事件,每隔一段时间调整界面透明度 开搞 属性框中的 ...
- 51nod 1154 dp
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1154 1154 回文串划分 基准时间限制:1 秒 空间限制:131072 ...
- Spring属性注入、构造方法注入、工厂注入以及注入参数(转)
Spring 是一个开源框架. Spring 为简化企业级应用开发而生(对比EJB2.0来说). 使用 Spring 可以使简单的 JavaBean 实现以前只有 EJB 才能实现的功能.Spring ...
- Mac下webpack安装
最近开始接触构建工具webpack,公司电脑是 windows,而我自己的呢是mac.本来以为在自己电脑安装很简单,但是出了点问题,所以写出来分享下. 这里用npm的方式安装,首先你要安装node.j ...
- 数据分析笔试-sql
题目说明及要求: 以下是模似数据库里的表单信息,请根据要求写出SQL语句 表1:职工信息 表结构如下: 表名:Employee 职工ID 职工姓名 入职年份 部门ID A1 ...
- 安卓开发第一记 android stdio 安装后 新建测试项目报错
Failed to resolve:com.android.support:appcompat-v7:报错处理 你在使用android studio时是否也出现过上图的报错,你还在为它的出现烦恼? ...
- SCARA——OpenGL入门学习一、二
参考博客:http://www.cppblog.com/doing5552/archive/2009/01/08/71532.html 简介 最近开始一个机械手臂的安装调试,平面关节型机器人又称SCA ...