CentOS 6.3下NFS安装配置
一、环境介绍
NFS服务器:CentOS6.3 192.168.8.20
NFS客户端:CentOS6.5 192.168.8.39
二、服务器端安装配置
1、先用rpm -qa命令查看所需安装包(nfs-utils、rpcbind)是否已经安装:
# rpm -qa | grep "rpcbind"
rpcbind-0.2.0-9.el6.x86_64
# rpm -qa | grep "nfs"
nfs-utils-lib-1.1.5-4.el6.x86_64
nfs-utils-1.2.3-26.el6.x86_64
2、如查询结果如上,说明服务器自身已经安装了NFS,如果没有安装,则用yum命令来安装:
# yum -y install nfs-utils rpcbind
3、创建共享目录:
# mkdir /sharestore
4、NFS共享文件路径配置:
编辑/etc/exports添加下面一行,添加后保存退出。
# vi /etc/exports
/sharestore *(rw,sync,no_root_squash)
5、启动NFS服务(先启动rpcbind,再启动nfs;如果服务器自身已经安装过NFS,那就用restart重启两个服务):
6、设置NFS服务开机自启动:
# chkconfig nfs on
# chkconfig --list nfs
nfs 0:关闭
1:关闭 2:启用
3:启用 4:启用
5:启用 6:关闭
# chkconfig rpcbind on
# chkconfig --list rpcbind
rpcbind 0:关闭
三、客户端挂载配置
1、创建一个挂载点:
# mkdir /mnt/store
2、查看NFS服务器上的共享:
# showmount -e 192.168.8.20
-bash: showmount: command not found
安装nfs-utils包即可
# yum install -y nfs-utils
Export list for 192.168.8.20:
/sharestore *
3、挂载:
# mount -t nfs 192.168.8.20:/sharestore /mnt/store
4、查看已挂载共享:
5、验证挂载是否生效