1、关闭防火墙

![]()
2、查看是否安装nfs、rpcbind
rpm -qa |grep nfs
rpm -qa |grep rpcbind
2、安装NFS:yum -y install nfs-utils rpcbind
3、设置开机启动
chkconfig rpcbind on
chkconfig nfs on
4、启动服务
service rpcbind start
service nfs start
5、查询NFS服务器状态
service nfs status
6、在其他节点
执行:yum -y install nfs-utils
设置recbind开机启动:chkconfig rpcbind on
启动rpcbind服务:service rpcbind start
7、在服务端设置共享目录
vim /etc/exports
添加:/home/grid *(rw,sync,no_root_squash)
8、重启服务
service rpcbind restart
service nfs restart
9、可在其他节点查看共享的目录
showmount -e 172.20.8.178
10、将共享目录挂载到其他节点本地目录中
创建目录:mkdir /nfs_share
挂载目录:mount -t nfs 172.20.8.178:/home/grid /nfs_share
11、在各个节点设置共享目录开机自动挂载
vim /etc/fstab
在末尾添加:172.20.8.178:/home/grid /nfs_share nfs defaults 1 1
12、在NFS服务器,及各个节点生成秘钥信息
ssh-keygen -t rsa
13、在NFS服务端,拷贝id_rsa.pub文件生成authorized_keys文件,并且将各节点公钥信息发送并保存在authorized_keys文件中。
修改authorized_keys文件的权限
cat id_rsa.pub >> authorized_keys
ssh 172.20.8.179 cat ~/.ssh/id_rsa.pub >> authorized_keys
chmod 644 authorized_keys
14、在各节点创建共享目录文件authorized_keys的软连接
软连接:相当于windows里面的快捷方式
ln -s /nfs_share/.ssh/authorized_keys authorized_keys