nfs安装配置
nfs配置
1、服务端
安装nfs-utils,rpcbind(默认安装)
yum -y install nfs-utils
启动服务
systemctl start nfs-utils rpcbind
(systemctl start nfs-server)
firewall-cmd防火墙放行
firewall-cmd --add-service=nfs --permanent
firewall-cmd --add-service=rpcbind --permanent
firewall-cmd --reload
#iptables -F
#service iptables save
创建/编辑配置文件
vim /etc/exports
/share 192.l68.2.115(rw,sync,all_squash)
2、客户端
手动
mount -t nfs 192.168.2.115:/share /share
开机自动挂载
编辑/etc/fstab
192.168.2.115:/share /share nfs sync 0 0
自动挂载autofs
安装软件包autofs
rpm -ivh autofs-
启用服务
systemctl start autofs
systemctl enable autofs
创建/编辑配置文件(*.autofs)
vim /etc/auto.master.d/name.autofs
格式:挂载主目录 映射配置文件
例:/share /etc/auto.name
/-:表示主目录可以为任意
创建/编辑映射配置文件
格式:挂载目录名 -选项(权限等) 共享目录
直接映射:
share -rw,sync 192.168.2.115:/share
间接映射:
* -rw,sync 192.168.2.115:/share
注:间接映射时,需要进入主配置文件配置的挂载目录中创建目录
例:touch a