NFS的搭建及配置
[root@centos199 conf]# rpm -q nfs-utils rpcbind #查看这两个包是否安装,如未安装则用yum安装
nfs-utils-1.2.3-39.el6.x86_64
rpcbind-0.2.0-13.el6_9.1.x86_64
[root@centos199 conf]# yum -y install nfs-utils rpcbind
[root@centos199 conf]# chkconfig nfs on
[root@centos199 conf]# chkconfig rpcbind on
[root@centos199 conf]# cat /etc/exports
/home/bash 192.168.1.105(insecure,rw,sync,no_root_squash) 192.168.1.*(ro) #/home/bash 共享目录,rw 读写,ro 只读,sync 同步写入到内存与磁盘,async 暂存内存中, no_root_squash
[root@centos199 conf]# exportfs -r #是/etc/exports 配置文件生效
[root@centos199 conf]# /etc/init.d/rpcbind start # 注意先启动rpcbind再启动nfs 否则会报错,会出现clnt_create: RPC: Program not registered
#这个错误,表示rpc程序为注册成功
[root@centos199 conf]# /etc/init.d/nfs start
[root@centos199 conf]# showmount -e 192.168.1.99 #查看提供nfs的共享目录信息
Export list for 192.168.1.99:
/home/bash 192.168.1.*,192.168.1.105
######客户端
[root@centos105 ~]# yum -y install nfs-utils
[root@centos105 ~]# mount 192.168.1.99:/home/bash/ /www
[root@centos105 ~]# df -hT
192.168.1.99:/home/bash/ nfs 402G 374G 7.4G 99% /www
[root@centos105 ~]# cat /etc/fstab
192.168.1.99:/home/bash /www nfs defaults,_netdev 0 0 #加入开机自动挂载