3.6.1 安装nfs软件
[root@web01 ~]# yum install nfs-utils rpcbind -y
检查安装结果
[root@web01 ~]# rpm -qa nfs-utils rpcbind
nfs-utils-1.2.3-70.el6_8.1.x86_64
rpcbind-0.2.0-12.el6.x86_64
3.6.2 启动rpc服务
[root@web01 ~]# /etc/init.d/rpcbind start
Starting rpcbind: [ OK ]
[root@web01 ~]# /etc/init.d/rpcbind status
rpcbind (pid 24265) is running…
[root@web01 ~]# chkconfig rpcbind on
[root@web01 ~]# chkconfig —list rpcbind
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
3.6.3 挂载共享
[root@web01 ~]# showmount -e 172.16.1.31 <= 先检查
Export list for 172.16.1.31:
/data 172.16.1.0/24
[root@web01 ~]# mount -t nfs 172.16.1.31:/data /mnt/ <= 执行挂载
[root@web01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 19G 1.5G 17G 9% /
tmpfs 238M 0 238M 0% /dev/shm
/dev/sda1 190M 38M 142M 22% /boot
172.16.1.31:/data 19G 1.6G 17G 9% /mnt
3.6.4 写入文件测试
[root@web01 ~]# cd /mnt/
[root@web01 mnt]# ls
[root@web01 mnt]# echo good > oldboy.txt
[root@web01 mnt]# ll
total 4
-rw-r—r— 1 nfsnobody nfsnobody 5 Sep 20 22:19 oldboy.txt