首页 > 其他分享 >Install nfs (network file system)

Install nfs (network file system)

时间:2024-01-31 18:22:06浏览次数:35  
标签:maye network sudo server nfs file directory home

1. what is nfs used for?

nfs is network file system, it is used when multiple computers need to access one directory.

2. Computer Environment

OS: Ubuntu 20.04

3. Install and config nfs server

3.1. Install nfs server

#执行以下命令安装NFS服务器,
​#apt会自动安装nfs-common、rpcbind等13个软件包
​sudo apt install nfs-kernel-server

3.2 create directory to share

# create directory /home/maye/nfs  to share on nfs server host
# Attention: It's better to create directory to share under directory home, not under root directory, 
# because It may have error: permission not allowed to read or write the directory, 
# if under root directory.
sudo mkdir -p /home/maye/nfs
​

3.3 write config file to set exported directories.

sudo gedit /etc/exports

-->
#设置共享目录
/home/maye/nfs *(rw,sync,no_subtree_check,no_root_squash)```

Note:
* means any ip can mount this exported directory.

3.4 start nfs service

# before starting nds serivce, rpcbind service needs to be active.
# check status of rpcbind service
$ systemctl status rpcbind
# if rpcbind service not active, start it.
$ systemctl start rpcbind  
$ systemctl start nfs-kernel-server

# see the export list for localhost
$ showmount -e

-->
Export list for maye-Inspiron-5547:
/home/maye/nfs *

4. Install and config nfs client

4.1 install nfs client

#在需要连接到NFS服务器的客户端机器上,
#需要执行以下命令,安装nfs-common软件包。
#apt会自动安装nfs-common、rpcbind等12个软件包
sudo apt install nfs-common

#显示指定的NFS服务器上export出来的目录
sudo showmount -e nfs-server-ip

4.2 create directory which the nfs server exported directory will mount to.

sudo mkdir -p /home/maye/mnt/nfs

4.3 mount shared directory

# on nfs client
# /home/maye/nfs is the directory exported on nfs server in this example, 
# /home/maye/mnt/nfs is the directory on nfs server to which 
# to mount the shared directory in this example,
# change them to the actual pathes in your case.
sudo mount -t nfs nfs-server-ip:/home/maye/nfs /home/maye/mnt/nfs 

# check the mounted directory
$ sudo df -h

-->
nfs-server-ip:/home/maye/nfs 457G 182G 253G 42% /home/maye/mnt/nfs

5. stop nfs service

# on nfs server
$ sudo systemctl stop nfs-kernel-server

References:
https://zhuanlan.zhihu.com/p/606174368?utm_id=0

标签:maye,network,sudo,server,nfs,file,directory,home
From: https://www.cnblogs.com/zhenxia-jiuyou/p/17999749

相关文章

  • CSharp: create pdf file using iText 8.0 in donet 8.0
     /*IDE:VS202217.5OS:windows10.net8.0iText8.0System.Text.Encoding.CodePages*/namespaceConsoleAppPdfdemo{usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.IO;usingSystem.Text;......
  • makefile学习--------1
    为什么要使用makefile:这是在linux下编译一个c语言文件时需要的指令,如果需要编译的文件不在同一个路径时,还需要将路径写上,十分麻烦,而且要是修改之后想重新编译,就需要再一次输入这些繁琐的指令。为了避免这种情况,采用了makefile,makefile里可以放这些执行指令,只需要使用的时候mak......
  • 神经网络优化篇:将 Batch Norm 拟合进神经网络(Fitting Batch Norm into a neural netwo
    将BatchNorm拟合进神经网络假设有一个这样的神经网络,之前说过,可以认为每个单元负责计算两件事。第一,它先计算z,然后应用其到激活函数中再计算a,所以可以认为,每个圆圈代表着两步的计算过程。同样的,对于下一层而言,那就是\(z_{1}^{[2]}\)和\(a_{1}^{[2]}\)等。所以如果没有应用Bat......
  • OGG-00303 Problem at line 37. Expecting file, table, or record definition: TimeZ
    由于源端和目标端表结构不一致(列顺序有差异),因此使用def文件来同步。在源端配置好def文件后,启动复制进程报错,具体信息如下:2024-01-3111:24:16ERROROGG-00303OracleGoldenGateDeliveryforOracle,r_bszj.rp:Problematline37.Expectingfile,table,orrecorddefin......
  • file uoload
    什么是文件上传漏洞?文件上传漏洞是指Web服务器允许用户将文件上传到其文件系统,而无需充分验证其名称、类型、内容或大小等内容。如果不能正确实施限制,可能意味着即使是基本的图片上传功能也可用于上传任意和有潜在危险的文件。这甚至可能包括支持远程代码执行的服务器端脚本文件......
  • dockerfile安装jenkins 并配置构建工具(node、npm、maven、git)
    dockerfile安装jenkins并配置构建工具(node、npm、maven、git):https://blog.csdn.net/weixin_39660224/article/details/88775707?ops_request_misc=&request_id=&biz_id=102&utm_term=dockerfile%20%E5%88%9B%E5%BB%BAjenkins&utm_medium=distribute.pc_search_result.......
  • vs+qt中使用opengl及关键报错“无法打开包括文件: no such file or directory”与“err
    参考链接https://blog.csdn.net/qq_22533607/article/details/79792083http://t.csdnimg.cn/T8II5http://t.csdnimg.cn/JP8k7基础准备:vs中配置qt插件(略)关键步骤:创建QtWidgetApplication项目将BaseClass修改成QWidget,方框中的内容可以不勾,个人习惯ui文件中添加open......
  • CentOS启动nginx出现nginx: [emerg] open() "/var/run/nginx/nginx.pid" failed (2: N
    问题:1.进入sbin:cd/usr/local/nginx/sbin/2.启动nginx:./nginx3.出现问题:nginx:[emerg]open()"/var/run/nginx/nginx.pid"failed(2:Nosuchfileordirectory) 原因:没有nginx文件夹,且其下没有nginx.pid文件。 解决办法:创建文件1.进入run下:cd/var/run2.创建nginx......
  • makefile使用摘要
    问题1:多个源文件参与的编译过程中,全部重新编译不合理;gcc-c*.c问题2:在手动处理过程中,由于一个基础文件的更改,导致后续的编译过程非常容易出错。解决方法:编写makefile文件$(sources:.c=.d)是一个变量替换语法,把sources变量中每一项的.c替换成.d特殊变量:$^表示规则中的......
  • linux内核-2.Linux 内核makefile编译过程
    1zImage编译_all是默认目标,如果使用命令make或者makeall编译Linux的话此目标就会被匹配。KBUILD_EXTMOD为空的,因此194行的代码成立,因此_all依赖all。all又依赖vmlinux,开始编译vmlinux。makeARCH=armCROSS_COMPILE=arm-linux-gnueabihf-distcleanmakeARCH=armCR......