安装nfs服务

apt-get install nfs-kernel-server

修改配置文件,共享目录为/var/www,*号可替换为客户端IP地址,*默认为任何部署了nfs客户端的IP可以挂载该目录(默认共享目录仅支持一台客户端挂载)

root@CS151230001:~# cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
#/data2/html1/ *(rw,sync,no_root_squash,no_subtree_check)
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
/var/www/ *(insecure,rw,sync,no_root_squash,no_subtree_check)

配置固定端口,方便添加防火墙策略,尤其是云服务器

root@CS151230001:~# cat /etc/default/nfs-kernel-server
# Number of servers to start up
RPCNFSDCOUNT=8 # Runtime priority of server (see nice(1))
RPCNFSDPRIORITY=0 # Options for rpc.mountd.
# If you have a port-based firewall, you might want to set up
# a fixed port here using the --port option. For more information,
# see rpc.mountd(8) or http://wiki.debian.org/SecuringNFS
# To disable NFSv4 on the server, specify '--no-nfs-version 4' here
RPCMOUNTDOPTS="--manage-gids --port 32767" # Do you want to start the svcgssd daemon? It is only required for Kerberos
# exports. Valid alternatives are "yes" and "no"; the default is "no".
NEED_SVCGSSD="" # Options for rpc.svcgssd.
RPCSVCGSSDOPTS="" # Options for rpc.nfsd.
RPCNFSDOPTS="--nfs-version 2,3,4 --debug --syslog"

  

root@CS151230001:~# cat /etc/default/nfs-common
# If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are "yes" and "no". # Do you want to start the statd daemon? It is not needed for NFSv4.
NEED_STATD= # Options for rpc.statd.
# Should rpc.statd listen on a specific port? This is especially useful
# when you have a port-based firewall. To use a fixed port, set this
# this variable to a statd argument like: "--port 4000 --outgoing-port 4001".
# For more information, see rpc.statd(8) or http://wiki.debian.org/SecuringNFS
STATDOPTS="--port 32765 --outgoing-port 32766" # Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=

  

重启以下服务

/etc/init.d/rpcbind restart
/etc/init.d/nfs-kernel-server restart

重载配置文件

 exportfs -rv

查询监听端口

rpcinfo -p

测试是否共享目录成功

showmount -e 服务器IP地址

  

参考:

https://blog.csdn.net/yuanhangq220/article/details/82421183

NFS挂载时出现"access denied by server while mounting"的解决方法

1、使用了非法端口,也就是使用了大于1024的端口。
这个错误,可以通过查看日志确认:
[root@local~ /]# cat /var/log/messages | grep mount
Jan 2 12:49:04 localhost mountd[1644]: refused mount request from 192.168.0.100 for /home/nfsshare/ (/home/nfsshare): illegal port 1689
 
解决办法:
修改配置文件/etc/exports,加入 insecure 选项,重启nfs服务,再尝试挂载。
/home/nfsshare/  *(insecure,rw,async,no_root_squash)

http://www.heminjie.com/system/linux/2998.html

ubuntu14.04 部署nfs服务的更多相关文章

  1. [原创]ubuntu14.04部署ELK+redis日志分析系统

    ubuntu14.04部署ELK+redis日志分析系统 [环境] host1:172.17.0.4 搭建ELK+redis服务 host2:172.17.0.3 搭建logstash+nginx服务 ...

  2. ubuntu14.04 server ftp 服务安装配置详解

    ubuntu14.04 server ftp 服务安装配置详解 cheungmine 2016-01-27 http://wiki.ubuntu.com.cn/Vsftpd 0 安装好vsftpd服务 ...

  3. day03 部署NFS服务

    day03 部署NFS服务 NFS的原理 1.什么是NFS 共享网络文件存储服务器 2.NFS的原理 1.用户访问NFS客户端,将请求转化为函数 2.NFS通过TCP/IP连接服务端 3.NFS服务端 ...

  4. ubuntu14.04部署kickstart

    转自:http://www.mamicode.com/info-detail-1646465.html kickstart用于在内网自动安装系统. 使用pxe安装系统需要安装dhcp,tftp,htt ...

  5. LINUX 系统下部署 NFS服务

    NFS服务 NFS,是Network File System的简写,即网络文件系统.也被称为NFS: NFS允许一个系统在网络上与他人共享目录和文件. NFS通常运行于2049端口. 部署NFS 前提 ...

  6. Linux部署NFS服务共享文件

    NFS(网络文件系统)用于linux共享文件 第1步:配置所需要的环境 使用两台Linux主机 主机名称 操作系统 IP地址 NFS Centos7 192.168.218.139 NFSa Cent ...

  7. ubuntu12.04配置NFS服务详解

    1:安装nfs sudo apt-get install nfs-kernel-server 2:配置服务 sudo vim /etc/exports 在末尾添加 /home/jyg *(rw,syn ...

  8. 阿里云 Ubuntu14.04 部署 LAMP

    1.更新软件源 sudo apt-get update 2.安装Apache sudo apt-get install apache2 3.查看Apache是否安装成功 apache2 –v 如下所示 ...

  9. CentOS7 部署nfs服务

    参考博客 参考博客 https://blog.51cto.com/addam/1576144 错误1: 客户端挂载nfs报错mount: wrong fs type, bad option, bad ...

随机推荐

  1. Java多线程-同步:synchronized 和线程通信:生产者消费者模式

    大家伙周末愉快,小乐又来给大家献上技术大餐.上次是说到了Java多线程的创建和状态|乐字节,接下来,我们再来接着说Java多线程-同步:synchronized 和线程通信:生产者消费者模式. 一.同 ...

  2. kmeans 对表达量进行聚类

    代码如下 df = pd.read_csv("../kmeans/gene.fpkm.csv",header=None) print df.head() #去掉第一行 tdf = ...

  3. 【Linux】Linux下进程间的通信方式

    本文内容: 1.进程通信的目的 2.介绍Linux下进程间的4种通信方式:管道,消息队列,共享内存,信号量 ps:套接字也可以用于进程间的通信,不过是不同物理机器上的进程通信,本章讨论是是同一台物理机 ...

  4. TCP协议的11种状态及其变化过程?传输的内容又是什么?

    在TCP的11种状态变迁中,我们需要用到TCP头部的三个标志位: 1.SYN,SYN=1表示这是一个连接请求报文或者连接接受报文 2.ACK,ACK=1,表示确认号生效 3.FIN,FIN=1表示发送 ...

  5. Django中的admin

    1.基本知识 在用Django框架写了一个网站之后,我们添加数据大概有两种方式: 1.在连接的数据库中添加数据 2.登录admin,进入后台添加数据 创建一个Django项目后,我们在url.py中会 ...

  6. 【scratch3.0教程】1.2 下载安装scratch

    第2课  下载安装Scratch 1 . 什么是Scratch?                                Scratch将程序语言设计成一块块积木,你只要用拖拉的方式,将程序积木 ...

  7. AS3中 is,as,typeof的区别

    AS3中 is,as,typeof的区别 . var my_num:Number=9;trace(typeof my_num);var my_object:Array=["语文", ...

  8. -Dmaven.test.skip=true 和 -DskipTests

    -DskipTests,不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下. -Dmaven.test.skip=true,不执行测试用例,也不编译测试 ...

  9. 成员函数内定义static变量(不安全,各对象之间共享)

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/u012317833/article/de ...

  10. gensim快速上手教程

    1 gensim是什么?        gensim是一个Python常用的的自然语言处理开发包, 主要用于词向量训练和加载词向量,以下解释其正确使用姿势. 2 正确使用姿势 from gensim. ...