標籤:nfs、nfs-utils、rpcbind
一、環境介紹
NFS伺服器:CentOS6.6 192.168.1.116
NFS用戶端:CentOS5.5 192.168.1.114
二、伺服器端安裝配置
1、先用rpm -qa命令查看所需安裝包(nfs-utils、rpcbind)是否已經安裝:
# rpm -qa | grep "rpcbind"
rpcbind-0.2.0-11.el6.i686
# rpm -qa | grep "nfs"
nfsometer-1.6-1.el6.noarch
nfs-ganesha-proxy-2.2.0-2.el6.i686
nfs-ganesha-2.2.0-2.el6.i686
nfs-utils-lib-devel-1.1.5-11.el6.i686
nfs-ganesha-ceph-2.2.0-2.el6.i686
nfs-ganesha-nullfs-2.2.0-2.el6.i686
nfs-utils-lib-1.1.5-11.el6.i686
nfs-ganesha-utils-2.2.0-2.el6.i686
nfswatch-4.99.9-1.el6.rf.i686
nfs-utils-1.2.3-64.el6.i686
nfs4-acl-tools-0.3.3-7.el6.i686
nfs-ganesha-mount-9P-2.2.0-2.el6.i686
nfs-ganesha-vfs-2.2.0-2.el6.i686
2、如查詢結果如上,說明伺服器自身已經安裝了NFS,如果沒有安裝,則用yum命令來安裝:
# yum -y install nfs-utils rpcbind
3、NFS共用檔案路徑配置:
/home/ 192.168.1.0/24(rw,sync,no_root_squash)
/home/www 192.168.1.0/24(rw,sync,no_root_squash)
4、啟動NFS服務(先啟動rpcbind,再啟動nfs;如果伺服器自身已經安裝過NFS,那就用restart重啟兩個服務):
# service rpcbind start
正在啟動 rpcbind: [確定]
# service nfs start
啟動 NFS 服務: [確定]
關掉 NFS 配額: [確定]
啟動 NFS mountd: [確定]
啟動 NFS 守護進程: [確定]
正在啟動 RPC idmapd: [確定]
5、設定NFS服務開機自啟動:
# chkconfig rpcbind on
# chkconfig nfs on
三、用戶端掛載配置
1、安裝nfs
# yum -y install nfs-utils rpcbind
2、啟動服務
# service rpcbind start
2、設定服務自啟
# chkconfig rpcbind on
3、建立掛載點
# make /AAA
# make /BBB
4、查看NFS伺服器上的共用:
# showmount -e 192.168.1.116
Export list for 192.168.1.116:
/home/www 192.168.1.0/24
/home 192.168.1.0/24
5、掛載:
#mount -t nfs 192.168.1.116:/home/ /AAA
#mount -t nfs 192.168.1.116:/home/www/ /BBB
6、查看已掛載共用:
# mount
/dev/sda3 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.1.116:/home on /AAA type nfs (rw,addr=192.168.1.116)
192.168.1.116:/home/www on /BBB type nfs (rw,addr=192.168.1.116)
/dev/sdb on /home type ext3 (rw)
/dev/sdc on /home type ext3 (rw)
7、設定開機自動掛載
# vi /etc/fstab
添加下面兩句
192.168.1.116:/home /AAA nfs defaults 0 0
192.168.1.116:/home/www /BBB nfs defaults 0 0
8、重啟用戶端驗證是否生效
# reboot
待系統重啟後查看是否自動掛載以及掛載的檔案系統
# df -hT
檔案系統 類型 容量 已用 可用 已用% 掛載點
/dev/sda3 ext3 2.9G 1.8G 936M 66% /
/dev/sda1 ext3 99M 16M 79M 17% /boot
tmpfs tmpfs 499M 0 499M 0% /dev/shm
192.168.1.116:/home
nfs 8.3G 3.4G 4.5G 43% /AAA
192.168.1.116:/home/www
nfs 8.3G 3.4G 4.5G 43% /BBB
說明已經自動掛載成功,所掛載的檔案系統格式為nfs格式。
本文出自 “技術成就夢想” 部落格,請務必保留此出處http://20145520.blog.51cto.com/9112173/1704470
CentOS 6.6下NFS安裝配置