NFS的配置

来源:互联网 发布:2017淘宝充值网店 编辑:程序博客网 时间:2024/06/06 04:44
#############NFS服务端###############
1.系统版本
cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
2.检查并安装NTF服务
rpm -qa  nfs-utils portmap rpcbind
yum install nfs-utils rpcbind -y
rpm -qa  nfs-utils portmap rpcbind
3.启动RPC及NFS服务并检查
systemctl start rpcbind
systemctl status rpcbind
rpcinfo -p localhost
systemctl start nfs
systemctl status nfs
rpcinfo -p localhost
4.设置开机自启动并检查
systemctl enable rpcbind  
systemctl list-unit-files | grep rpcbind
systemctl enable nfs
systemctl list-unit-files | grep nfs
5.配置共享/var/ftp目录
cat >>/etc/exports<<EOF
#shared data for nfs-mywebserver by dexter-wang at 20170301
/var/ftp 10.1.0.0/16(rw,sync)
EOF


cat /etc/exports


或者


vim /etc/exports
#shared data for nfs-mywebserver by dexter-wang at 20170301
/var/ftp 10.1.0.0/16(rw,sync)


6.创建共享目录
mkdir -pv /var/ftp
ll /var/ftp
chown -R nfsnobody.nfsnobody /var/ftp
chmod 777 /var/ftp
7.平滑加载NFS服务并检查服务
systemctl reload nfs
showmount -e localhost




###########NFS客户端###############
1.系统版本
cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
2.安装rpc服务并检查
yum install nfs-utils rpcbind -y
rpm -qa nfs-utils rpcbind
3.启动rpc服务并检查
systemctl start rpcbind
systemctl status rpcbind
4.开机自启动并检查
systemctl enable rpcbind
systemctl list-unit-files | grep rpcbind
5.检查服务端的NFS是否OK
showmount -e 10.1.41.54


故障排查
ping 10.1.41.54
telnet 10.1.41.54 111


6.挂载并测试


mount -t nfs 10.1.41.54:/var/ftp /var/ftp


cd /var/ftp
ls -lh
touch dexter.log
ls -lh


设置开机自动挂载
echo "mount -t nfs 10.1.41.54:/var/ftp /var/ftp" >>/etc/rc.local

0 0
原创粉丝点击