`
peikona
  • 浏览: 50229 次
  • 性别: Icon_minigender_1
  • 来自: 珠海
社区版块
存档分类
最新评论

Ubuntu 8.10 Server版使用NFS

阅读更多
今天有个同事有这样一个需求:
他们ICT测试的HP3070的硬盘太小(2G),导致测试程序放在本地后系统的空闲空间太小,甚至有一台的空闲空间为零了!严重影响了正常生产,他们就想能不能把程序放到一个共享服务器上,但是不能放到Windows上,因为程序的文件名有“:”这个字符,Windows下是非法字符,所以就想弄个Linux或Unix系统。

而我手上只有RHEL5和Ubuntu 8.10 Server,而我常使用的是Ubuntu,所以就顺手装了,不过在配置的过程中有一些问题,所以在这里把它写下来以作备忘(本人是菜鸟)。

1. 安装的步骤不细说了,我使用了自动使用整个硬盘的方式
    swap 2.7G, 其他的给了/,硬盘共160G

2. 配置源,从网上搜的,添加了台湾源,更新速度很快,开始在做dist-upgrade时就怎么也连不上了,却能ping通它们,不知道是不是看我更新的速度太快把我给临时禁了,没办法只好换一个,这次用dormforce的源(因为还没装nfs-server呢)。然后作dist-upgrade后,重启,安装nfs-kernel-server

3. sudo apt-get install nfs-kernel-server
    配置portmap, sudo dpkg-reconfigure portmap, 对Should portmap be bound to the loopback address? 选No。

注:因为我是在局域网里用的,所以不用配置/etc/hosts.deny和/etc/hosts.allow
4. 配置网络
我要连接2个网段(172.30.53.*和172.30.188/189/190, 后一个已经打通了)
sudo vi /etc/network/interfaces,完整的内容如下:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# 172.30.188/189/190 network
auto eth0
iface eth0 inet static
address 172.30.188.235
netmask 255.255.252.0

# 172.30.53.*  network
auto eth1
iface eth1 inet static
address 172.30.53.247
netmask 255.255.255.0

# not used
#auto eth2
#iface eth2 inet dhcp

注:在编辑时不小心把netmask写成了network,结果导致网卡起不来,说什么
not all variables in the file之类的东西(具体的没记下来),后来检查了一下改正后就好了,结果只有172.30.53.*能连通,经反复验证,配置文件没问题,网段已经找电脑部的给跳通了,后来询问一个同事说,可能是网线没接对(电脑上有3个网卡),就把网线换一个口,就好了,真是郁闷啊。
5. 配置exports
sudo vi /etc/exports
/mnt/ictdata/one 172.30.188.*(rw,sync) 172.30.189.*(rw,sync) 172.30.190.*(rw,sync)
/mnt/ictdata/two 172.30.53.*(rw,sync)
/mnt/ictdata/three 172.30.53.*(rw,sync)

然后,sudo exportfs -r,结果出现下面的东西:
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "172.30.188.*:/mnt/ictdata/one".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified for export "172.30.189.*:/mnt/ictdata/one".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exportfs: /etc/exports [3]: Neither 'subtree_check' or 'no_subtree_check' specified for export "172.30.190.*:/mnt/ictdata/one".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exportfs: /etc/exports [4]: Neither 'subtree_check' or 'no_subtree_check' specified for export "172.30.53.*:/mnt/ictdata/two".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exportfs: /etc/exports [5]: Neither 'subtree_check' or 'no_subtree_check' specified for export "172.30.53.*:/mnt/ictdata/three".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x
到网上查了下,未果,由于时间紧,这又不影响使用,就没管它了,有这方面经验的同学给个提示吧。
6. 重启portmap和nfs
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-kernel-server restart

7. 测试
本机测试: sudo mount -t nfs 172.30.53.247:/mnt/ictdata/two /home/teit/mnt, 成功
远程测试: 到另一台服务器上测试,方法同上,不细说了。

至此,配置完成(本服务器只需要nfs服务,smb的暂时不需要,不过我也给装上了,说不定以后会有需求)。
总结:由于不是Linux的高手,所以在配置时都要到网上查资料,耽误了一些时间,看来还得加强一下学习。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics