码迷,mamicode.com
首页 > 其他好文 > 详细

nfs服务的搭建

时间:2017-02-27 21:54:28      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:配置文件   服务器   ip地址   客户端   操作系统   

系统环境

1. 操作系统:redhat6.5

2. 已关闭NetworkManager
3. 已关闭iptables
4. 已关闭SELinux
5. 已配置固定的IP地址


软件环境

nfs-utils-lib.x86_64 0:1.1.5-6.el6           

rpcbind.x86_64 0:0.2.0-11.el6  提供rpc协议 nfs需要rpcbind来进行通信确认


网络环境

服务器ip:192.168.1.20

客户端ip:192.168.1.25


服务器:

1. 安装软件

    yum -y install nfs-utils

2. 启动服务

    /etc/init.d/nfs start

3. 开机自启

    chkconfig nfs on

4. 配置

以读写的方式共享 

mkdir -p /share/dir2
chmod 757 /share/dir2
vim /etc/exports
/share/dir1     192.168.1.25(rw,sync)  //共享给指定主机
exportfs -r   重新加载配置文件/etc/exports
exportfs -v     检查当前主机的NFS输出(共享)


客户端:

1. 安装软件

    yum -y install nfs-utils


2. 查看存储端共享
showmount -e 192.168.1.20
Export list for 192.168.1.20:
/share/dir1   192.168.1.25(rw,sync)


3. 手动挂载NFS
mkdir /mnt/nfs1       //创建挂载点(根据生产需求而定)
mount -t nfs 192.168.1.20:/share/dir1 /mnt/nfs1/
ls /mnt/nfs1/
cp -r /etc/hosts /mnt/nfs1/ 因为需要rpcbind进行确认通信,所以客户端第一次创建文件是非常慢的


4. 客户端实现自动挂载NFS
fstab自动挂载
vim /etc/fstab
192.168.1.20:/share/dir1     /mnt/nfs1       nfs         defaults,_netdev        0  0
mount -a

本文出自 “雨夜星空” 博客,请务必保留此出处http://rainy1119.blog.51cto.com/12555635/1901741

nfs服务的搭建

标签:配置文件   服务器   ip地址   客户端   操作系统   

原文地址:http://rainy1119.blog.51cto.com/12555635/1901741

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!