Chinaunix首页 | 论坛 | 博客
  • 博客访问: 319008
  • 博文数量: 72
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 748
  • 用 户 组: 普通用户
  • 注册时间: 2018-09-21 18:49
文章分类

全部博文(72)

我的朋友

分类: LINUX

2018-11-09 11:34:32

一 需求

       实现两台虚拟机之间的文件共享

二 需求分析

  1.首先在VMware中装两台虚拟机(项目一)

  2.安装nfs(项目二)

  3.关闭firewalldlelinux防火墙(项目三)

  4.配置好IP,保持与外网相通(项目四)

三.步骤

     Centos7(server)192.168.18.9

  1.安装nfs

    rpm -qa | grep nfs     #检查nfs是否安装

    yum  -y install nfs-utils    #安装nfs服务

  2.启动nfs服务

    systemctl enable rpcbind.service

    systemctl start rpcbind.service

    systemctl status rpcbind.service

 

    systemctl enable nfs.service

    systemctl start nfs.service

    systemctl status nfs.service

 3.配置

  准备工作:在根下建一个空目录,并授权

    mkdir /sharefile

    chmod 777 /sharefile

  打开配置文件 /etc/exports(vim  /etc/exports)编辑内容如下

    /sharefile 192.168.18.128(rw)     

    意思:我将共享目录/sharefile,  ip地址是192.168.18.128的主机都能访问

 4.刷新     

   exportfs -rv

 

centos7(client):192.168.18.128

 1.安装nfs

   rpm -qa | grep nfs     #检查nfs是否安装

   yum  -y install nfs-utils    #安装nfs服务

 2.启动nfs服务

   systemctl enable rpcbind.service

   systemctl start rpcbind.service

   systemctl status rpcbind.service

 3.检查 NFS 服务器端是否有目录共享 showmount -e nfs服务器的IP

   showmount -e 192.168.18.9

  4.挂载   

   mkdir nfstest  #创建挂载点

   mount -t nfs 192.168.18.9:/sharefile /nfstest  #挂载共享目录

      

   #设置开机自动挂载

    编辑/etc/fstab

   192.168.18.9:/data /data   nfs     defaults        0 0

 

   df -h   #查看是否挂载成功

      

说明:

  1.挂载命令

    mount -t nfs ServerIP:/ShareDIR /Path


         



阅读(953) | 评论(0) | 转发(0) |
0

上一篇:DHCP介绍

下一篇:SAMBA服务

给主人留下些什么吧!~~