六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 27|回复: 0

Linux之间NFS方式共享文件

[复制链接]

升级  76%

8

主题

8

主题

8

主题

童生

Rank: 1

积分
38
 楼主| 发表于 2013-2-4 12:52:38 | 显示全部楼层 |阅读模式
Linux服务器间共享文件的方式有很多种(ftp、smba、nfs)这里给介绍以下,Linux下nfs文件共享方式和实现的方法。

1、首先要开启portmap和nfs服务。

   service portmap start

   service nfs start

2、查看服务是否开启。

   netstat -ntpl

3、修改 /etc/exports

   vi /etc/exports

#/home/temp *(rw,sync,no_root_squash,all_squash)
/home/temp *(ro,sync,no_root_squash,all_squash)  (/home/temp 表示要被共享的目录)
/mnt/inst *(ro,sync)                             (* 表示任意地址)
4、exportfs -a                                   (到处所以共享的目录)

5、showmount -e 127.0.0.1                        (查被共享的目录)
  Export list for 127.0.0.1:
/mnt/inst  *
/home/temp *
6、在客户端输入所需要的共享文件。

mount -t nfs 192.168.111.1:/mnt/inst /mnt        (mount服务器上的共享目录)

7、在客户端使用mount命令,就可以看到刚才被mount的文件了。

这样简单的就是实现了文件共享。


实例:
192.168.10.1 操作:
vi /etc/exports ×添加下面这一行
     /home/temp *(ro,sync)   (/home/temp 表示要被共享的目录)
service portmap start
service nfs start
netstat -ntpl

192.168.10.2 操作:
mount -t nfs 192.168.111.1:/mnt/inst /mnt
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表