CentOS 6.6下NFS安裝配置


一、環境介紹
  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格式。



















發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章