我是靠谱客的博主 苹果彩虹,这篇文章主要介绍NFS服务器搭建 unbuntu,现在分享给大家,希望可以做个参考。

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
1. 查看是否有NFS服务 hduser[@master](https://my.oschina.net/u/48054):/home/nfs-free$ sudo /etc/init.d/nfs-kernel-server status [sudo] password for hduser: nfsd running 2. 如果没有安装 apt-get install nfs-kernel-server nfs-common 3. 启动NFS服务器 hduser[@master](https://my.oschina.net/u/48054):/home/nfs-free$ sudo /etc/init.d/nfs-kernel-server start * Exporting directories for NFS kernel daemon... [ OK ] * Starting NFS kernel daemon [ OK ] hduser[@master](https://my.oschina.net/u/48054):/home/nfs-free$ 4. 创建挂载目录 a. 在挂载目录中写入共享文件 5. 修改/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) # # 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) # 第二列:可访问主机 192.168.152.13 指定IP地址的主机 nfsclient.test.com 指定域名的主机 192.168.1.0/24 指定网段中的所有主机 *.test.com 指定域下的所有主机 * 所有主机 来自 <http://www.linuxidc.com/Linux/2012-05/61527.htm> 最好在/etc/exports中的权限中加入no_subtree_check,可以提高传输率 6. 本地挂载 hduser[@master](https://my.oschina.net/u/48054):/home/nfs-free$ sudo mount -t nfs master:/home/nfs-free /mnt hduser[@master](https://my.oschina.net/u/48054):/home/nfs-free$ cd /mnt hduser@master:/mnt$ ls free.txt 7. 在客户端查看共享目录 hduser@data1:/mnt$ showmount -e 192.168.56.100 Export list for 192.168.56.100: /home/nfs-free data1 hduser@data1:/mnt$ showmount -e master Export list for master: /home/nfs-free data1 8. 挂载目录 hduser@data1:/mnt$ sudo mount master:/home/nfs-free /mnt [sudo] password for hduser: mount.nfs: /mnt is busy or already mounted hduser@data1:/mnt$ ls free.txt free.txt~ 9. 查看NFS状态 hduser@data1:/mnt$ mount /dev/sda1 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/cgroup type tmpfs (rw) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev) none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755) none on /sys/fs/pstore type pstore (rw) tracefs on /var/lib/ureadahead/debugfs/tracing type tracefs (rw,relatime) rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw) systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd) gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=hduser) /dev/sr0 on /media/hduser/VBOXADDITIONS_5.1.8_111374 type iso9660 (ro,nosuid,nodev,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2) master:/home/nfs-free on /mnt type nfs (rw,vers=4,addr=192.168.56.100,clientaddr=192.168.56.101) gvfsd-fuse on /home/hduser/.gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev) hduser@data1:/mnt$ mount |grep nfs master:/home/nfs-free on /mnt type nfs (rw,vers=4,addr=192.168.56.100,clientaddr=192.168.56.101) 10. 对共享目录下的文件操作 hduser@data1:~$ cp /mnt/free.txt ~/Desktop/ 11. 开机自动挂载 修改/etc/fstab ubuntu /etc/fstab解析

转载于:https://my.oschina.net/spacewe/blog/897576

最后

以上就是苹果彩虹最近收集整理的关于NFS服务器搭建 unbuntu的全部内容,更多相关NFS服务器搭建内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(77)

评论列表共有 0 条评论

立即
投稿
返回
顶部