NFS部署
一、环境介绍
客户端-------192.168.2.40
服务端-------192.168.88.72
二、安装RPC(客户端192.168.2.40)
1、安装RPC(客户端192.168.2.40)
//安装rpc # yum install rpcbind -y //启动rpc服务 # /etc/init.d/rpcbind start //rpc设置开机自启动 # chkconfig rpcbind on //查看是否可以连接到72 # showmount -e “192.168.88.72” //将data挂在到mnt下 # mount -t nfs 192.168.88.72:/data /mnt/ //查看是否挂在成功 # df -h //设置开机自启动 # echo "mount -t nfs 192.168.88.72:/data /mnt/" >>/etc/rc.local
2、NFS、RPC安装(服务端192.168.88.72)
//创建data目录,将此目录作为共享目录 # mkdir -p /data //yum安装nfs、rpc # yum install nfs-utils rpcbind -y //启动rpc服务 # /etc/init.d/rpcbind start //查看rpc是否启动成功 # ps -ef |grep rpc //查看是否有111端口,111为rpc默认端口 # rpcinfo -p localhost //启动nfs服务 # /etc/init.d/nfs start //查看是否有可用端口 # rpcinfo -p localhost //nfs设置开机自启动 # chkconfig nfs on //rpc设置开机自启动 # chkconfig rpcbind on //编辑nfs配置文件,添加共享目录,添加以下内容 # vi /etc/exports #shared data for bbs by /data 192.168.0.0/16(rw,sync) //共享data目录,并之润许192.168网段访问,有rw权限,和sync将缓存向磁盘写入权限 :wq //保存退出 //平滑重启nfs服务,reload表示重启是不影响正在访问的客户 # /etc/init.d/nfs reload //查看是否共享成功 # showmount -e localhost