Linux NFS 的配置

OS : rhel 7.6
server端 : 192.168.2.74  /public
client端 :  192.168.2.75  /nfs

-- 服务器端部署
1 安装包 rpcbind、nfs-utils  -- 先安装nfs-utils的时候,会把rpcbind给安装上
2 查看nfs配置文件

rpm -qc nfs-utils 
[root@wls10306-01 media]# rpm -qc nfs-utils
/etc/gssproxy/24-nfs-server.conf
/etc/modprobe.d/lockd.conf
/etc/nfs.conf
/etc/nfsmount.conf
/etc/request-key.d/id_resolver.conf
/etc/sysconfig/nfs
/var/lib/nfs/etab
/var/lib/nfs/rmtab
/var/lib/nfs/state
/var/lib/nfs/xtab
[root@wls10306-01 media]#

3 编辑nfs主配置文件/etc/exports

[root@wls10306-01 /]# cat /etc/exports
/public  192.168.2.75/24(rw,sync,no_root_squash)

4 重启nfs服务   service nfs restart
利用rpcinfo -p localhost查看nfs是否注册成功

[root@wls10306-01 /]# rpcinfo -p localhost
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp  11134  status
    100024    1   tcp  29460  status
    100005    1   udp  20048  mountd
    100005    1   tcp  20048  mountd
    100005    2   udp  20048  mountd
    100005    2   tcp  20048  mountd
    100005    3   udp  20048  mountd
    100005    3   tcp  20048  mountd
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    3   tcp   2049  nfs_acl
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    3   udp   2049  nfs_acl
    100021    1   udp  57432  nlockmgr
    100021    3   udp  57432  nlockmgr
    100021    4   udp  57432  nlockmgr
    100021    1   tcp  19353  nlockmgr
    100021    3   tcp  19353  nlockmgr
    100021    4   tcp  19353  nlockmgr
[root@wls10306-01 /]#

5 查看共享目录是否成功  showmount -e  或者 exportfs

[root@wls10306-01 /]# showmount -e
Export list for wls10306-01:
/public 192.168.2.75
[root@wls10306-01 /]# exportfs
/public         192.168.2.75
[root@wls10306-01 /]#

-- nfs 客户端部署
1 安装nfs-utils 、rpcbind
2 挂载 ,挂在到nfs目录下

mount -t nfs 192.168.2.74:/public  /nfs
[root@wls10306-02 ~]# mount -t nfs 192.168.2.74:/public  /nfs
[root@wls10306-02 ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   48G  8.5G   40G  18% /
devtmpfs               979M     0  979M   0% /dev
tmpfs                  991M     0  991M   0% /dev/shm
tmpfs                  991M  9.6M  981M   1% /run
tmpfs                  991M     0  991M   0% /sys/fs/cgroup
/dev/sda1             1014M  133M  882M  14% /boot
/dev/mapper/rhel-home  8.4G  4.7G  3.8G  56% /home
tmpfs                  199M     0  199M   0% /run/user/0
/dev/sr0               3.8G  3.8G     0 100% /media
192.168.2.74:/public    48G  2.4G   46G   5% /nfs
[root@wls10306-02 ~]#

3 设置开机自启动

systemctl status rpcbind.service
systemctl status nfs.service
systemctl enable rpcbind.service
systemctl enable nfs.service

systemctl list-unit-files | grep enabled 
systemctl list-unit-files | grep enabled  | grep rpcbind
systemctl list-unit-files | grep enabled  | grep nfs 

4 修改/etc/fstab

192.168.2.74:/public /nfs nfs defaults 0 0 

5 重启测试,重启后,客户端可以自动mount到nfs (同时重启服务端和客户端的时候,发现客户端要等待服务端重启起来后,客户端才重启,可能是nfs在找客户端,找到后才会重启客户端)

END

先写到这里,后续又时间了,再配置下Oracle 的DNFS 。

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值