ubuntu搭建NFS服务 磁盘共享 nfs 搭建

服务端(1.1.1.1这台服务器):
1.安装nfs服务模块(直接装nfs-kernel-server就好了,其中apt会自动解决依赖,主要是nfs-common和rpcbind 这两个包) 默认装好的

arm包和文档 下载地址

我这里的物理机是arm环境 kylin系统

apt install nfs-kernel-server
systemctl start nfs-kernel-server
systemctl status nfs-kernel-server

ubuntu搭建NFS服务 磁盘共享 nfs 搭建_第1张图片
ubuntu搭建NFS服务 磁盘共享 nfs 搭建_第2张图片
2.修改/etc/exports文件(需要1.1.1.2服务器作为客户端来同步.1机器的指定目录): 假设需要共享/etc/network/123123目录

 vim /etc/exports
增加如下内容: 
/etc/network/123123 1.1.1.2(rw,sync,no_root_squash,no_subtree_check)

ubuntu搭建NFS服务 磁盘共享 nfs 搭建_第3张图片
3.重启nfs服务

systemctl restart nfs-kernel-server

至此 NFS服务端搭建完毕
客户端(1.1.1.2这台服务器):
4.启动nfs客户端模块:

systemctl start nfs-server

5.检查客户端和服务端网络是否连通:

ping1.1.1.1

6.查看服务端的共享目录:

showmount -e 1.1.1.1

在这里插入图片描述
7.将服务端目录挂载到本地:

 mount 1.1.1.1:/etc/network/123123 /mnt

8.添加开机自动挂载:

vim /etc/rc.local
添加如下内容: 
服务端 mount /dev/sdb /目标目录
客户端mount 1.1.1.1:/etc/network/123123 /mnt

你可能感兴趣的:(linux,linux,网络,ubuntu,nfs,linux磁盘共享)