Centos5与Centos6 下安装和部署NFS

本文详细介绍了如何在CentOS 5和CentOS 6上安装并配置NFS服务,包括安装NFS套件、配置服务端及客户端的具体步骤。通过本教程,读者可以学会如何从零开始搭建NFS文件系统。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、安装NFS

1、首先安装NFS套件,命令如下:

yum install nfs-utils*(64位系统)

yum install nfs-utils*(32位系统)

2、安装后检测

rpm -qa | grep nfs-utils

[CentOS5]

nfs-utils-版本.el5
nfs-utils-lib-版本.el5

[CentOS6]

nfs-utils-版本.el6
nfs-utils-lib-版本.el6

3、然后安装portmap服务,portmap在centos6中改名为rpcbind

yum install rpcbind(centos6)

yum install portmap(centos5)

二、NFS服务端配置

1、/etc/service 增加端口

nfs             2049/tcp        nfsd
nfs             2049/udp        nfsd
#[CentOS5]

sunrpc          111/tcp         portmapper      # RPC 4.0 portmapper TCP
sunrpc          111/udp         portmapper      # RPC 4.0 portmapper UDP

#[CentOS6]

sunrpc          111/tcp         rpcbind      
sunrpc          111/udp         rpcbind    

2、/etc/exports配置挂接点和权限

/opt/centos6 192.168.0.0/24(ro,no_root_squash) 

#/opt/centos6是挂接点

#192.168.0.0/24 这个网段的服务器可以接受挂接nfs文件系统

#ro只读

#no_root_squash 当访问者为root用户时方位该目录具有root权限

三 启动NFS服务

1、读取/etc/exports 文件

exportfs -a

2、启动进程

[CentOS5]

/etc/init.d/portmap start

/etc/init.d/nfs start

chkconfig portmap on

chkconfig nfs on

[CentOS6]

/etc/init.d/rpcbind start

/etc/init.d/nfs start

chkconfig rpcbind on

chkconfig nfs on

3、查看进程和服务

netstat -nulpt |grep -E "111|2049"

看端口和服务是否启动

rpcinfo -p

看nfs  mountd portmapper 
 

四客户端访问NFS文件系统

1、查找NFS服务是否可用

showmount -e NFS-IP

如果看到了可以NFS服务器端相关消息,就可以使用nfs服务了

2、挂载

mount -t nfs NFS-IP:/opt/centos6 /mnt

[注意:如何解决报错信息]

If you got error such as this:

mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified

To fix this, you need to do:

rpc.statd

rpc.mountd

rpcinfo -p

本文转自大角牛博客51CTO博客,原文链接http://blog.51cto.com/jingshengsun888/1169111如需转载请自行联系原作者


运维的戏子

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值