您的位置:首页 > 其它

NFS的简单配置流程回顾

2013-09-13 10:31 405 查看
==================================================================
2013年9月13日 03:01:24
/article/4449848.html
==================================================================
NFS配置流程:

前提,关闭防火墙。
服务端配置
1,首先检查软件包有没有安装
在centos5.8环境:rpm -qa nfs-utils* portmap
在centos6.4环境:rpm -qa nfs-utils* rpcbind
2,如果没有安装那么yum安装
在centos5.8环境:yum install nfs-utils* portmap -y
在centos6.4环境:yum install nfs-utils* rpcbind -y
3,安装好以后,设置开机启动。
在centos5.8环境:chkconfig nfs on; chkconfig portmap on
在centos6.4环境:chkconfig nfs on; chkconfig rpcbind on
4,写入开机启动脚本
在centos5.8环境:
echo "#shared dir by lisp 20130912">>/etc/rc.local
echo -e "/etc/init.d/nfs start\n/etc/init.d/portmap start">>/etc/rc.local
在centos6.4环境:
echo "#shared dir by lisp 20130912">>/rc.local
echo -e "/etc/init.d/nfs start\n/etc/init.d/rpcbind start">>/etc/rc.local
5,检查服务启动情况,如果没启动,则启动服务。注意:在服务端的nfs和portmap是都要开启的。
而且启动的时候,先启动portmap。
在centos5.8环境:
/etc/init.d/nfs status
/etc/init.d/portmap status
/etc/init.d/nfs start
/etc/init.d/portmap start
在centos6.4环境:
/etc/init.d/nfs status
/etc/init.d/rpcbind status
/etc/init.d/nfs start
/etc/init.d/rpcbind start
6,查看端口和进程
在centos5.8环境:
netstat -lnt |egrep 'nfs|portmap'
ps -ef |egrep 'nfs|portmap'
rpcinfo -p localhost
在centos6.4环境:
netstat -lnt |egrep 'nfs|rpcbind'
ps -ef |egrep 'nfs|rpcbind'
rpcinfo -p localhost
7,创建共享目录并且修改配置文件/etc/exports
mkdir /data/bbs -p
echo -e "#lisp shared dir on 20130908\n/data/bbs 192.168.1.0/24(rw,sync)">>/etc/exports
8,重新加载nfs服务
/etc/init.d/nfs reload 或者用exportfs -rv
至此,服务器端已经配置好。
客户端配置
1,同样检查软件包的安装情况
在centos5.8环境:rpm -qa portmap
在centos6.4环境:rpm -qa rpcbind
2――8步和服务器的配置一样
9,使用"showmount -e 服务器ip地址"命令查看有哪些挂载点可以挂载。
10,使用"mount -t nfs 服务器ip地址:共享目录 本地挂载点"命令进行挂载。
11,进入挂载目录查看服务器共享目录

至此,NFS客户端配置完成。

NFS服务基本上已经搭建好,可以实现服务器共享资源文件目录。

使用showmount -a 显示已经与客户端连接上的目录信息。
使用showmount -e 默认查看自己共享的服务,前提是要DNS能解析自己,不然容易报错
给共享目录设置权限chmod 777 -R /share/dir
=======================================================================================
NFS服务的优化,期待下一篇博文……
/article/4449848.html

本文出自 “Lisp的运维之路” 博客,请务必保留此出处/article/4449848.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: