LINUX共享服务
一、NFS
1、概述
NFS 是一种基于 TCP/IP 传输的网络文件系统协议,NFS 也是 NAS 存储 设备必然支持的一种协议。
在 CentOS 7 系统中,需要安装 nfs-utils、rpcbind 软件包来提供 NFS 共享服务。
应该先启动 rpcbind,再启动 nfs。
端口号:
nfs端口号2049
RPC端口号111
二、实验步骤
1、环境
1、2台虚拟机,一台服务器,一台客户机。
2、安装NFS和RPCBIND
2、配置
服务器
yum install -y nfs-utils rpcbind //如果没有安装的话,安装一下
vim /etc/exports //编辑nfs配置文件,指定挂载的目录,挂载的网段和配置信息,文件内容默认为空(无任何共享)
/opt/web 192.168.152.0/24(rw,sync,no_root_squash)
mkdir /opt/web
cd /opt/web
touch 456
ls
cd ~
systemctl start rpcbind
systemctl start nfs
cd /opt/web
exportfs -r
exportfs -v
touch def
ll
-rw-r--r--. 1 root root 0 5月 26 21:12 456
-rw-r--r--. 1 root root 0 5月 26 21:26 def
客户端
yum -y install rpcbind nfs-utils
yum -y install httpd
showmount -e 192.168.152.130 //验证共享
Export list for 192.168.152.130:
/opt/web 192.168.152.0/24
mount -t nfs 192.168.152.130:/opt/web /var/www/html
cd /var/www/html
ls
ll
-rw-r--r--. 1 root root 0 5月 26 21:12 456
-rw-r--r--. 1 root root 0 5月 26 21:26 def