服務(wù)端配置
1. 安裝nfs-utils和rpcbind
yum install nfs-utils rpcbind
2.設(shè)置開機(jī)啟動(dòng)服務(wù)
chkconfig nfs on
chkconfig rpcbind on
3.啟動(dòng)相關(guān)服務(wù)
service rpcbind start
service nfs start
4.創(chuàng)建共享目錄
mkdir -p /export/primary
mkdir -p /export/secondary
5.編輯/etc/exports文件添加如下內(nèi)容
vi /etc/exports
/export*(rw,async,no_root_squash,no_subtree_check)
6.刷新配置立即生效
exportfs -a
客戶端配置
1. 安裝nfs-utils和rpcbind
yum install nfs-utils rpcbind
2.設(shè)置開機(jī)啟動(dòng)服務(wù)
chkconfig nfs on
chkconfig rpcbind on
3.啟動(dòng)服務(wù)
servicerpcbind start
servicenfs start
4.創(chuàng)建掛載點(diǎn)
mkdir -p /mnt/primary
mkdir -p /mnt/secondary
5.掛載目錄
mount -t nfs server_ip:/export/primary /mnt/primary
mount -t nfs server_ip:/export/secondary /mnt/secondary
6.查看掛載的目錄
df -h
7.卸載掛載的目錄
umount /mnt/primary
umount /mnt/secondary
8.編輯/etc/fstab,開機(jī)自動(dòng)掛載
vi /etc/fstab
server_ip:/export/primary/mnt/primary nfs rw,tcp,intr 0 1
server_ip:/export/secondary/mnt/secondary nfs rw,tcp,intr 0 1