首页 > 其他分享 >Kylin-文件夹共享(NFS)

Kylin-文件夹共享(NFS)

时间:2022-12-08 15:23:32浏览次数:44  
标签:Kylin server nfsdata 文件夹 NFS plengong nfs kylin01 root

服务端部署NFS

部署NFS服务端(server.kylin.com)

环境部署

[root@server ~]# mkdir /nfsdata
[root@server ~]# mkdir -p /nfsdata/kylin01
[root@server ~]# mkdir -p /nfsdata/kylin02

安装NFS服务端

[root@server ~]# dnf install nfs-utils
Last metadata expiration check: 12:52:34 ago on Wed 07 Dec 2022 08:19:18 PM CST.
Dependencies resolved.
=======================================================================================
 Package      Architecture      Version            Repository          Size
=======================================================================================
Installing:
 nfs-utils     x86_64        1:2.5.1-3.ky10        kylin_dvd            319 k
=======================================================================================
Complete!

配置防火墙放行NFS服务

[root@server ~]# firewall-cmd --permanent --add-service=nfs
success
[root@server ~]# firewall-cmd --permanent --add-service=rpc-bind
success
[root@server ~]# firewall-cmd --permanent --add-service=mountd
success
[root@server ~]# firewall-cmd --reload
success

配置部署NFS服务

  • 部署文件夹
[root@server ~]# cd /nfsdata/kylin01
[root@server kylin01]# echo 'welcome to kylin01!' > test.txt
[root@server kylin01]# cd /nfsdata/kylin02
[root@server kylin02]# echo 'welcome to kylin02!' > test.txt
  • 创建nfsuser,配置exports
[root@server ~]# useradd nfsuser -M -s /sbin/nologin
[root@server ~]# id nfsuser
uid=1000(nfsuser) gid=1000(nfsuser) groups=1000(nfsuser)
[root@server ~]# vim /etc/exports
/nfsdata/kylin01 *(ro,sync,root_squash)
/nfsdata/kylin02 *(rw,sync,root_squash,anongid=1000,anonuid=1000) 
[root@server /]# chmod -R 777 /nfsdata/
[root@server /]# systemctl restart rpcbind
[root@server /]# systemctl enable rpcbind
[root@server /]# systemctl restart nfs-server
[root@server /]# systemctl enable nfs-server
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /usr/lib/systemd/sy                                           stem/nfs-server.service.

部署NFS客户端

环境准备

plengong@plengong-vmwarevirtualplatform:/$ mkdir -p /data/client01
plengong@plengong-vmwarevirtualplatform:/$ mkdir -p /data/client02
plengong@plengong-vmwarevirtualplatform:~/Desktop$ sudo apt install nfs-common -y

image

配置自动挂载

plengong@plengong-vmwarevirtualplatform:~/Desktop$ sudo echo "192.168.85.100:/nfsdata/kylin01 /data/client01 nfs defaults,_netdev 0 0" >> /etc/fstab
plengong@plengong-vmwarevirtualplatform:~/Desktop$ sudo echo "192.168.85.100:/nfsdata/kylin02 /data/client02 nfs defaults,_netdev 0 0" >> /etc/fstab
plengong@plengong-vmwarevirtualplatform:~/Desktop$ sudo mount -a

标签:Kylin,server,nfsdata,文件夹,NFS,plengong,nfs,kylin01,root
From: https://www.cnblogs.com/wm-plengong/p/16966184.html

相关文章