阿里云服务器Ubuntu 14.04.2和centos7.5实现nfs挂载
前提条件,确保两个ip可以正常通信
确认服务端是否安装nfs-utils和rpcbind
[root@localhost /]# rpm -qa|grep "nfs"
nfs4-acl-tools-0.3.3-17.el7.x86_64
libnfsidmap-0.25-19.el7.x86_64
nfs-utils-1.3.0-0.61.el7.x86_64
[root@localhost /]# rpm -qa|grep "rpc"
xmlrpc-c-client-1.32.5-1905.svn2451.el7.x86_64
libtirpc-0.2.4-0.10.el7.x86_64
rpcbind-0.2.0-47.el7.x86_64
xmlrpc-c-1.32.5-1905.svn2451.el7.x86_64
mkdir /data/sharestore 创建共享目录
chmod -Rf 777 /data/sharestore 确保其他用户对该目录具备读写权限(该步骤可以不执行)
服务端配置
cat /etc/exports
/data/sharestore *(insecure,rw,no_root_squash,no_all_squash,async)
exports参数相关可以参考:https://blog.csdn.net/qq_36357820/article/details/78488077
cat /etc/sysconfig/nfs|grep -v '#'
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
RPCNFSDARGS="-N 4"
MOUNTD_PORT=10892
STATD_PORT=10662
STATD_OUTGOING_PORT=12020
GSS_USE_PROXY="yes"
systemctl restart rpcbind
systemctl restart nfs-server
systemctl enable rpcbind
systemctl enable nfs-server
exportfs -r 使配置文件立即生效
客户端配置:
确认是否安装:nfs-common 该包提供showmount等功能
执行:dpkg-query -l nfs-common
出现以下信息说明已安装
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==================================================-==============================-==============================-=========================================================================================================
ii nfs-common 1:1.2.8-6ubuntu1.2 amd64 NFS support files common to client and server
mkdir /nfsfile 创建挂载目录
chmod -Rf 777 /nfsfile(具备读写权限即可,可以不给777)
showmount -e 服务端ip(如果出现服务端共享的目录信息说明目录共享成功)
rpcinfo -p 服务端ip地址 ---查看服务端rpc进程(该命令不指定ip地址可以用于获取本地rpc进程)
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100005 1 udp 20048 mountd
100005 1 tcp 20048 mountd
100005 2 udp 20048 mountd
100005 2 tcp 20048 mountd
100005 3 udp 20048 mountd
100005 3 tcp 20048 mountd
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049 nfs_acl
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 3 udp 2049 nfs_acl
100021 1 udp 31206 nlockmgr
100021 3 udp 31206 nlockmgr
100021 4 udp 31206 nlockmgr
100021 1 tcp 31241 nlockmgr
100021 3 tcp 31241 nlockmgr
100021 4 tcp 31241 nlockmgr
客户端iptables配置策略如下(需要开放的端口请参考以上查询到的rpc进程信息)
iptables -I INPUT -p tcp -s x.x.x.x --dport 111 -j ACCEPT(x.x.x.x为服务端ip地址)
iptables -I INPUT -p udp -s x.x.x.x --dport 111 -j ACCEPT
iptables -I INPUT -p tcp -s x.x.x.x --dport 2049 -j ACCEPT
iptables -I INPUT -p udp -s x.x.x.x --dport 2049 -j ACCEPT
iptables -I INPUT -p tcp -s x.x.x.x --dport 20048 -j ACCEPT
iptables -I INPUT -p udp -s x.x.x.x --dport 20048 -j ACCEPT
iptables -I INPUT -p tcp -s x.x.x.x --dport 31206 -j ACCEPT
iptables -I INPUT -p udp -s x.x.x.x --dport 31206 -j ACCEPT
挂载命令:mount -t nfs 服务端ip地址:/home/nfs /home/nfs
执行df -h查询目录是否挂载成功
如系统版本较高导致挂载失败问题可以参考如下:
https://blog.csdn.net/qq_30951423/article/details/85890581
Ubuntu 18.04 nfs 默认为协议3和协议4,但是默认启动的是协议2的形式
如:/data/sharestore *(insecure,rw,no_root_squash,no_all_squash,async)
若想要求 nfs 支持协议2,就在/etc/default/nfs-kernel-server末尾加一句:
RPCNFSDOPTS="--nfs-version 2,3,4 --debug --syslog"
vim /etc/default/nfs-kernel-server
RPCNFSDOPTS="--nfs-version 2,3,4 --debug --syslog"
阿里云服务器Ubuntu 14.04.2和centos7.5实现nfs挂载的更多相关文章
- 阿里云服务器Ubuntu 16.04 3安装mysql
.更新系统 apt-get update [注意:要在root用户下] .安装mysql-server apt-get install mysql-serverapt-get install mysq ...
- 阿里云服务器ubuntu安装redis2.8.13
阿里云服务器ubuntu安装redis2.8.13 2014-09-04 16:14 | coding云 | 2198次阅读 | 暂无评论 一.下载redis 可以先下载到本地,然后ftp到服 ...
- 服务器 阿里云服务器Ubuntu挂载数据盘
服务器 阿里云服务器Ubuntu挂载数据盘 转自:http://www.codingyun.com/article/24.html coding云运行在阿里云的Ubuntu 12.04 64位操作系 ...
- 阿里云服务器ubuntu安装java运行环境
服务器 阿里云服务器ubuntu安装java运行环境 转:http://www.codingyun.com/article/45.html 今天来给大家介绍一下在阿里云ubuntu服务器下安装java ...
- 阿里云服务器(Ubuntu16.04 64位)远程连接
购买阿里云服务器 1.打开阿里云官方网站,账号登录,选择产品中的云服务器 ECS 2.根据自身需求,选择合适的阿里云服务器系统,(1)点击一键购买,(2)选择地域,(3)根据自身需求,选择系统,这里选 ...
- 阿里云服务器(Ubuntu16.04 64位)的使用
购买阿里云服务器 1.打开阿里云官方网站,账号登录,选择产品中的云服务器 ECS 2.根据自身需求,选择合适的阿里云服务器系统,(1)点击一键购买,(2)选择地域,(3)根据自身需求,选择系统,这里选 ...
- 阿里云服务器 Ubuntu 安装 LNMP
1.设定实例化服务器IP密码. 2.设定安全组件端口 80 和 3306 系统默认提供端口 22. //阿里云需要设定安全组件端口必须设定. 3.安装一键lnmp系统. 教程地址 https://ln ...
- 阿里云 Server (Ubuntu 12.04) 配置 FTP
来自 http://blog.csdn.net/zgrjkflmkyc/article/details/45510345 这个是阿里云的官方用户手册 http://bbs.aliyun.com/re ...
- 阿里云服务器ECS Ubuntu16.04 初次使用配置教程(图形界面安装)
原文链接:? 传送门 前一阵子购买了阿里云的云服务器ECS(学生优惠),折腾了一阵子后对有些东西不太满意,所以就重新初始化了磁盘,刚好要重新安装图形界面,于是就顺手写了这么一篇文章. 第一次登陆服务器 ...
随机推荐
- Python进阶3---python类型注解、functools
函数定义的弊端 函数注解Function Annotations 业务应用 inspect模块 #示例 import inspect def add(x,y:int,*args,**kwargs) - ...
- vue 点击当前元素添加class 去掉兄弟的class 获取当前点击元素的文字
点击当前标签给其添加class,兄弟标签class删除 然后获取当前点击元素的文字 演示地址: https://xibushijie.github.io/static/addClass.html &l ...
- bzoj3277-串
Code #include<cstdio> #include<iostream> #include<cmath> #include<cstring> # ...
- 用python 发 帝国cms 文章
在e\extent下面放一个jiekou.php #!/usr/bin/env python3 # -*- coding: utf-8 -*- import time import urlli ...
- Kibana登录认证设置
Kibana从5.5开始不提供认证功能,想用官方的认证,X-Pack,收费滴 . 所以就自己动手吧,用nginx的代理功能了. 1.安装Nginx: [root@ELK /]# yum -y inst ...
- log4j 初体验
1.Log4j简介 在应用程序中添加日志记录目的基于三个: 监视代码中变量的变化情况,周期性的记录到文件中供其他应用进行统计分析工作 跟踪代码运行时轨迹,作为日后审计的依据 担当集成开发环境 ...
- 常见Web攻击
一.SQL注入 1. sql注入的危害 非法读取.篡改.删除数据库中的数据 盗取用户的各类敏感信息,获取利益 通过修改数据库来修改网页上的内容 注入木马等 2. 实例 MYSQLDB # 通过在用户名 ...
- CMDB服务器管理系统【s5day90】:创建资产更新服务器硬盘信息
1.创建硬件资产信息 import json from django.shortcuts import render,HttpResponse from django.views.decorators ...
- JAVA实现C/S结构小程序
程序功能: 客户端向服务器发送一个本地磁盘中的文件, 服务器程序接受后保存在其他位置. 客户端实现步骤: 创建一个客户端对象Socket,构造方法中绑定服务器的IP地址 和 端口号 使用Socket对 ...
- volative 与处理器的嗅探技术
在<java并发编程的艺术>这本书中,关于volatile的内存原理本质的描述如下: 有volatile变量修饰共享变量在编译器编译后,后多出一个“lock” 来(lock前缀指令相当于一 ...