Ip配置
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
Ip192.168.1.10
重启网卡
[root@localhost ~]# systemctl restart network
Yum配置
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# vim yum.repo
镜像挂载
[root@localhost yum.repos.d]# mount /dev/cdrom /media/
mount: /dev/sr0 is write-protected, mounting read-only
NFS服务端部署流程
查询nfs软件是否安装
[root@localhost ~]rpm -qa | egrep 'nfs-utils | rpcbind
未安装则安装后操作
[root@localhost ~]yum -y install nfs-utils rpcbind
编写nfs配置文件
[root@localhost ~]# vim /etc/exports
[root@localhost data]# cat /etc/exports
/data 192.168.1.11/24(rw,sync,all_squash)
创建共享目录
[root@localhost ~]# mkdir /data
查看用户
[root@localhost ~]# id nfsnobody
uid=65534(nfsnobody) gid=65534(nfsnobody) groups=65534(nfsnobody)
设置目录的属主/属组
[root@localhost ~]# chown -R nfsnobody:nfsnobody /data/
启动nfs相关服务
[root@localhost ~]# systemctl restart rpcbind
[root@localhost ~]# systemctl restart nfs
[root@localhost ~]# systemctl restart nfs平滑重启
[root@localhost ~]# systemctl reload nfs 重启
查看rcp是否开启
[root@localhost ~]# netstat -anput | grep rpcbind
udp 0 0 0.0.0.0:602 0.0.0.0:* 16115/rpcbind
udp 0 0 0.0.0.0:111 0.0.0.0:* 16115/rpcbind
udp6 0 0 :::602 ::😗 16115/rpcbind
udp6 0 0 :::111 ::😗 16115/rpcbind
检看rcp注册信息
[root@localhost ~]# rpcinfo -p 192.168.1.10
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
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
检查是都有共享目录
[root@localhost ~]# showmount -e 192.168.1.10
Export list for 192.168.1.10:
/data 192.168.1.11/24
为接下来验证创建个目录ccx
[root@localhost ~]# cd /data/
[root@localhost data]# ls
ccc ccx
nfs客户端部署流程
安装nfs和rpc软件
[root@localhost ~]yum -y install nfs-utils rpcbind
检查局域网中是否存在共享存储服务
[root@localhost ~]# rpcinfo -p 192.168.1.11
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
实现共享目录应用(网络挂载应用)
[root@localhost ~]# mount -t nfs 192.168.1.10:/data/ /mnt/
查看
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl-root 50G 3.6G 47G 8% /
devtmpfs 897M 0 897M 0% /dev
tmpfs 912M 144K 912M 1% /dev/shm
tmpfs 912M 9.0M 903M 1% /run
tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sda1 1014M 173M 842M 18% /boot
/dev/mapper/cl-home 47G 33M 47G 1% /home
tmpfs 183M 12K 183M 1% /run/user/0
/dev/sr0 4.1G 4.1G 0 100% /run/media/root/CentOS 7 x86_64
192.168.1.10:/data 10G 4.4G 5.7G 44% /mnt
[root@localhost /]# cd mnt/
[root@localhost mnt]# ls
ccx ccc