[root@local /]# yum -y install nfs-utils rpcbind
3、创建共享目录:
[root@local /]# mkdir /sharestore
4、NFS共享文件路径配置:
编辑/etc/exports添加下面一行,添加后保存退出。
[root@local /]# vi /etc/exports
/sharestore *(rw,sync,no_root_squash)
5、启动NFS服务(先启动rpcbind,再启动nfs;如果服务器自身已经安装过NFS,那就用restart重启两个服务):
[root@local /]# service rpcbind start
Starting rpcbind: [ OK ]
[root@local /]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Stopping RPC idmapd: [ OK ]
Starting RPC idmapd: [ OK ]
Starting NFS daemon: [ OK ]
[root@local /]#
6、设置NFS服务开机自启动:
[root@local /]# chkconfig rpcbind on
[root@local /]# chkconfig nfs on
三、客户端挂载配置
1、创建一个挂载点:
[root@localhost ~]# mkdir /mnt/store
2、查看NFS服务器上的共享:
[root@localhost /]# showmount -e 192.168.0.10
Export list for 192.168.0.10:
/sharestore *
3、挂载:
[root@localhost ~]# mount -t nfs 192.168.0.10:/sharestore /mnt/store
4、查看已挂载共享:
[root@localhost ~]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/VolGroup-lv_home on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
192.168.0.10:/mailstore1/ on /mailstore_new type nfs (rw,vers=4,addr=192.168.0.10,clientaddr=192.168.0.10
5、开机自动挂载
[root@localhost ~]# vim /etc/fstab
nfs 192.168.0.10:/sharestore /mnt/store nfs defaults 0 0
以上部分来自网络博客,本人做了一些总结