CentOS6.3下NFS安装遇到的问题与解决

1.安装遇到的问题

[root@localhost NFS]# rpm -ivh nfs-utils-lib-1.0.8-7.6.el5.x86_64.rpm
warning: nfs-utils-lib-1.0.8-7.6.el5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID e8562897: NOKEY
error: Failed dependencies:
libldap-2.3.so.0()(64bit) is needed by nfs-utils-lib-1.0.8-7.6.el5.x86_64

 

[root@localhost NFS]# rpm -ivh nfs-utils-lib-devel-1.0.8-7.6.el5.x86_64.rpm
warning: nfs-utils-lib-devel-1.0.8-7.6.el5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID e8562897: NOKEY
error: Failed dependencies:
libnfsidmap.so.0()(64bit) is needed by nfs-utils-lib-devel-1.0.8-7.6.el5.x86_64
librpcsecgss.so.2()(64bit) is needed by nfs-utils-lib-devel-1.0.8-7.6.el5.x86_64
nfs-utils-lib = 1.0.8-7.6.el5 is needed by nfs-utils-lib-devel-1.0.8-7.6.el5.x86_64

 

[root@localhost NFS]# rpm -ivh nfs-utils-1.0.9-42.el5.x86_64.rpm
warning: nfs-utils-1.0.9-42.el5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID e8562897: NOKEY
error: Failed dependencies:
libldap-2.3.so.0()(64bit) is needed by nfs-utils-1:1.0.9-42.el5.x86_64
libnfsidmap.so.0()(64bit) is needed by nfs-utils-1:1.0.9-42.el5.x86_64
librpcsecgss.so.2()(64bit) is needed by nfs-utils-1:1.0.9-42.el5.x86_64
nfs-utils-lib >= 1.0.8-2 is needed by nfs-utils-1:1.0.9-42.el5.x86_64

 

安装rpm包过程中提示缺少若干库文件,添加后仍有问题,发现由于系统升级,按5.4的方法安装不可行,决定采用yum安装,结果不再报错。

[root@localhost NFS]# yum install nfs-utils
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirror.steadfast.net
* extras: mirror.steadfast.net
* updates: mirror.steadfast.net
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package nfs-utils.x86_64 1:1.2.3-36.el6 will be installed
–> Processing Dependency: nfs-utils-lib >= 1.1.0-3 for package: 1:nfs-utils-1.2.3-36.el6.x86_64
–> Processing Dependency: libnfsidmap.so.0()(64bit) for package: 1:nfs-utils-1.2.3-36.el6.x86_64
–> Running transaction check
—> Package nfs-utils-lib.x86_64 0:1.1.5-6.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=================================================================================
Package Arch Version Repository Size
=================================================================================
Installing:
nfs-utils x86_64 1:1.2.3-36.el6 base 319 k
Installing for dependencies:
nfs-utils-lib x86_64 1.1.5-6.el6 base 67 k

Transaction Summary
=================================================================================
Install 2 Package(s)

Total download size: 387 k
Installed size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): nfs-utils-1.2.3-36.el6.x86_64.rpm | 319 kB 00:02
(2/2): nfs-utils-lib-1.1.5-6.el6.x86_64.rpm | 67 kB 00:00
———————————————————————————
Total 97 kB/s | 387 kB 00:03
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : 1:nfs-utils-1.2.3-36.el6.x86_64 1/2
Installing : nfs-utils-lib-1.1.5-6.el6.x86_64 2/2
Verifying : nfs-utils-lib-1.1.5-6.el6.x86_64 1/2
Verifying : 1:nfs-utils-1.2.3-36.el6.x86_64 2/2

Installed:
nfs-utils.x86_64 1:1.2.3-36.el6

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

Complete!

 

2.配置NFS时问题

输入showmount –e 222.31.76.82检查RPC是否开启

报错如下:

[root@localhost ~]# clnt_create: RPC: Port mapper failure – Unable to receive: errno 113 (No route to host)

解决:

原因为NFS默认使用111端口,因此在iptables配置文件中打开111端口。

[root@localhost etc]# cat ./sysconfig/iptables

# Firewall configuration written by system-config-firewall

# Manual customization of this file is not recommended.

*filter

:INPUT ACCEPT [0:0]

:FORWARD ACCEPT [0:0]

:OUTPUT ACCEPT [0:0]

-A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT

-A INPUT -p icmp -j ACCEPT

-A INPUT -i lo -j ACCEPT

-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT

-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

-A INPUT -m state –state NEW -m tcp -p tcp –dport 443 -j ACCEPT

-A INPUT -j REJECT –reject-with icmp-host-prohibited

-A FORWARD -j REJECT –reject-with icmp-host-prohibited

-A INPUT -p TCP –dport 111 -j ACCEPT

-A INPUT -p UDP –dport 111 -j ACCEPT

COMMIT

       再次检查RPC是否开启

[root@localhost etc]# RPC: Program not registered

        多次重启RPC和NFS仍然无效,关闭防火墙也不行,发现RPC还是没有启动,最后重新yum安装了rpcbind,结果RPC成功开启,并且挂载成功。问题可能是第一次安装不完整,上网查了好多也没解决,花了很长时间,结果问题很容易解决,但积累了经验,解决问题要从最基本的地方入手。

[root@localhost ~]# showmount -e 222.31.76.82
Export list for 222.31.76.82:
/opt/nfs *

[root@localhost ~]# mount -t nfs -o soft 222.31.76.82:/opt/nfs /opt/nfs

[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用%% 挂载点

/dev/sda2 4.0G 2.9G 936M 76% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/sda1 1008M 69M 889M 8% /boot
222.31.76.82:/opt/nfs
4.0G 3.7G 130M 97% /opt/nfs

    总体来说,安装NFS过程相对简单,问题都不复杂,掌握了如何在客户端挂载NFS文件系统,从中收获了很多解决问题的方法,感觉经验在一点点积累!

Previous Next

Leave a Reply

    (*^__^*)不要算错啦~