-
Nfs安装
说明:安装NFS服务,需要安装两个软件,分别是:
RPC主程序:rpcbind
NFS 其实可以被视为一个 RPC 服务,因为启动任何一个 RPC 服务之前,我们都需要做好 port 的对应 (mapping) 的工作才行,这个工作其实就是『 rpcbind 』这个服务所负责的!也就是说, 在启动任何一个 RPC 服务之前,我们都需要启动 rpcbind 才行! (在 CentOS 5.x 以前这个软件称为 portmap,在 CentOS 6.x 之后才称为 rpcbind 的!)。
NFS主程序:nfs-utils
就是提供 rpc.nfsd 及 rpc.mountd 这两个 NFS daemons 与其他相关 documents 与说明文件、执行文件等的软件!这个就是 NFS 服务所需要的主要软件。
-
-
配置yum 离线源
-
-
挂载系统安装盘
-
备份原yum源
-
配置本地yum源
vi media.repo
- 清除yum缓冲
yum clean all
-
缓冲本地yum源
yum makecache
-
列出yum
Yum list
-
-
NFS服务端安装
-
-
安装NFS和rpc
[root@localhost ~]# yum install -y nfs-utils #安装nfs服务
[root@localhost ~]# yum install -y rpcbind #安装rpc服务
-
启动NFS服务
systemctl start rpcbind #先开启rpcbind服务
systemctl enable rpcbind #设置rpcbind服务开机自启动
systemctl start rpcbind nfs-server #开启nfs服务
systemctl enable nfs-server rpcbind #设置nfs服务开机自启动
rpcinfo -p 192.168.30.55 #查看部署了nfs服务的服务器接口(前提两台主机可以ping通)
- 创建共享路径
mkdir /public #创建共享路径
mkdir /protected #创建共享路径
-
配置NFS配置文件
vi /etc/exports
说明:主要配置文件:/etc/exports
这是 NFS 的主要配置文件了。该文件是空白的,有的系统可能不存在这个文件,主要手动建立。NFS的配置一般只在这个文件中配置即可。
[root@localhost /]# vi /etc/exports
/public 192.168.245.0/24(ro)
/protected 192.168.245.0/24(rw)
-
重新加载NFS服务
systemctl reload nfs #重新加载NFS服务,使配置文件生效
-
-
客户端NFS配置
-
-
客户端shoumount查看
showmount -e 192.168.245.128
-
客户端创建挂载路径
mkdir /nfs
-
执行挂载
mount –t nfs 192.168.30.55:/protected /nfs
-
配置自动挂载
echo “192.168.30.55:/protected /nfs nfs defaults 0 0”>>/etc/fstab