下载NFS离线安装包

在可以联网的机器上下载NFS安装包,以后在服务端和客户端安装使用。

  1. yum -y install nfs-utils --downloadonly --downloaddir /home/nfs

1.NFS服务端安装

1.1.服务端安装和配置NFS

  1. rpm -Uvh *.rpm --nodeps --force

1.2.创建网络共享目录

  1. mkdir -p /mnt/kubesphere && chmod -R a+w /mnt/kubesphere

1.3.配置网络共享目录

  1. # 指定/mnt/kubesphere目录允许192.168.28.140访问,其中ip需要换成客户端ip
  2. echo '/mnt/kubesphere 192.168.28.140(rw,sync,all_squash,anonuid=0,anongid=0)' > /etc/exports
  3. # 配置生效
  4. exportfs -rv

1.4.启动服务

  1. systemctl enable rpcbind.service && systemctl enable nfs-server.service && systemctl start rpcbind.service && systemctl start nfs-server.service

2.NFS客户端安装

  1. rpm -Uvh *.rpm --nodeps --force

2.1.挂载网络共享目录

  1. # 新建目录
  2. mkdir -p /home/kubesphere
  3. # 挂载共享目录,ip和目录要写服务端的ip和目录
  4. mount 192.168.28.140:/mnt/kubesphere /home/kubesphere
  5. #开机自动挂载
  6. echo "192.168.28.140:/mnt/kubesphere/ /home/kubesphere nfs defaults 0 0" >> /etc/fstab

2.2.卸载

  1. umount /home/kubesphere