Linux下NFS的最简配置(配置nfs)

Linux下配置NFS服务
1、安装

#CentOS下
yum install nfs-utils portmap nfs4-acl-tools
#Debian下,kernel-server相当于server,common是client
sudo apt-get install nfs-kernel-server nfs-common portmap

2、配置

#创建共用目录
sudo mkdir /home/nfs
sudo chmod 777 /home/nfs

#配置目录、权限等
vim /etc/exports
/home/nfs *(rw,sync)

#启动,Debian
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-kernel-server restart
#启动,CentOS
service portmap restart
service nfs restart

#更新了/etc/exports后,使用如下命令刷新:
sudo exportfs -r

3、客户端

#显示NFS服务器上exports出来的目录
showmount -e 10.61.1.31
Export list for 10.61.1.31:
/home/nfs *

#挂载到本地/mnt/nfs
mkdir /mnt/nfs
chmod 777 /mnt/nfs
sudo mount -t nfs 10.61.1.31:/home/nfs /mnt/nfs

#卸载,必须mount的shell进程退出后才能执行
sudo umount -f /mnt/nfs

Leave a Reply

Your email address will not be published.