理论+实操 :部署YUM仓库以及NFS资源共享服务————理论讲解

发布时间:2020-07-19 21:14:13 作者:wx5d8b05ec4cbc3
来源:网络 阅读:174

前言:

存储的主轴线

本地存储

磁盘管理 分区 格式化 自动挂载

LVM逻辑卷(跨区卷)

Raid 磁盘阵列 (条带、镜像、raid5,raid6 ,raid1+0)

——————————————

NFS 网络文件系统

MFS 分布式存储的文件系统

GFS 海量分布式存储的文件系统

一 : YUM概述

1.1 YUM,Yellow dog Updater Modified

理论+实操 :部署YUM仓库以及NFS资源共享服务————理论讲解

二 : 准备安装源

2.1 软件仓库的提供方式

2.2 RPM软件包的来源

2.3 构建Centos 7 软件仓库

[root@localhost ~]# mount /dev/sr0 /opt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# rpm -ivh /opt/Packages/sftpd-3.0.2-22.el7.x86_64.rpm 
[root@localhost ~]# cd /var/ftp
[root@localhost ftp]# mkdir centos7
[root@localhost ftp]# cp -r /opt/* /var/ftp/centos7/ '后面加&可以在后台运行'
[root@localhost ftp]# systemctl start vsftpd
[root@localhost ftp]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.

2.4 在软件仓库中加入非官方RPM包组

[root@localhost ftp]# mkdir /var/ftp/other
[root@localhost ftp]# cd /var/ftp/other/
[root@localhost repodata]# createrepo -g /opt/repodata/repomd.xml ./
Directory /opt/repodata/./ must be writable.

2.5 为客户机指定YUM仓库位置

[root@localhost other]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.139.132  netmask 255.255.255.0  broadcast 192.168.139.255
[root@localhost yum.repos.d]# ls /opt/centos7
CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7
EULA             isolinux  repodata  TRANS.TBL

[root@localhost yum.repos.d]# vim centos7.repo

[base]
name=centos7
baseurl=ftp://192.168.139.132/centos7
enabled=1
gpgcheck=1
gpgkey=ftp:///opt/RPM-GPG-KEY-CentOS-7
[other]
name=Other RPM Packages
baseurl=ftp://192.168.139.132/other
enabled=1
gpgcheck=0
~             

2.6 直接以centos7 光盘坐本地软件仓库

[root@localhost yum.repos.d]# vim centos7.repo 

[local]
name=centos7
baseurl=file:///opt
enabked=1
gpgcheck=0

2.7 关于YUM的工具概述

2.7.1 关于YUM命令

查询软件包组

2.7.2 YUM的配置文件

2.7.3 YUM缓存目录

[root@localhost yum.repos.d]# yum clean all     '清楚缓存数据'
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
正在清理软件源: base extras local other updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost ~]# yum grouplist
[root@localhost yum.repos.d]# yum grouplist gnome-desktop
[root@localhost yum.repos.d]# yum groupinfo gnome-desktop

2.7.4 安装软件

2.7.5 升级软件

2.7.6 卸载软件

二 : NFS共享存储服务

2.1 Network File System, 网络文件系统

RPC,远程过程调用,即rpcbind 软件包

三 : 使用NFS发布共享资源

3.1 安装nfs-utls、rpcbind软件包

[root@localhost ~]# yum install nfs-utils rpcbind -y 
[root@localhost ~]# systemctl enable nfs
[root@localhost ~]# systemctl enable rpcbind

3.2 设置共享目录

[root@localhost ~]# mkdir /opt/wwwroot
[root@localhost ~]# vi /etc/exports
/opt/wwwroot    192.168.7.0/24(rw,sync,no_root_squash)
/var/ftp/pub    192.168.4.11(ro) 192.168.4.110(rw)

共享目录 用户 (rw读写,sync同步,no_root_squash 不对root进行降级处理)

ro 只能读

3.3 启动NFS服务程序

[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs
[root@localhost ~]# systemctl stop firewalld.service 
[root@localhost ~]# setenforce 0
[root@localhost ~]# netstat -anpt |grep rpcbind
[root@localhost ~]# netstat -anpu |grep rpcbind
udp        0      0 0.0.0.0:681             0.0.0.0:*                           5594/rpcbind        
udp        0      0 0.0.0.0:111             0.0.0.0:*                           5594/rpcbind        
udp6       0      0 :::681                  :::*                                5594/rpcbind        
udp6       0      0 :::111                  :::*                                5594/rpcbind        

3.4 showmount -e 验证

[root@localhost ~]# showmount -e 192.168.139.132
Export list for 192.168.139.132:
/opt/wwwroot 192.168.7.0/24
/var/ftp/pub 192.168.4.110,192.168.4.11

3.5 挂载NFS共享目录(在客户机操作)

理论+实操 :部署YUM仓库以及NFS资源共享服务————理论讲解

理论+实操 :部署YUM仓库以及NFS资源共享服务————理论讲解

_netdev 网络型设备

当目标服务端宕机时,无法进行所有操作,就需要强制挂载

总结

实操:

服务端操作,服务端ip地址为192.168.139.141

root@localhost ~]# rpm -q rpcbind 
rpcbind-0.2.0-42.el7.x86_64
[root@localhost ~]# rpm -q nfs-utils 
nfs-utils-1.3.0-0.48.el7.x86_64
[root@localhost ~]# vim /etc/exports

/opt 192.168.139.0/24(rw,sync,no_root_squash)
[root@localhost ~]# systemctl stop firewalld.service 
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl start nfs
[root@localhost ~]# systemctl start rpcbind
[root@localhost network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.139.141  netmask 255.255.255.0  broadcast 192.168.139.255
        inet6 fe80::e2c1:c26d:afa1:a4ad  prefixlen 64  scopeid 0x20<link>

客户机操作

[root@localhost ~]# showmount -e 192.168.139.141
Export list for 192.168.139.141:
/opt 192.168.139.0/24
[root@localhost ~]# 
[root@localhost ~]# mount 192.168.139.141:/opt /mnt
[root@localhost ~]# cd /mnt
[root@localhost mnt]# ls
rh
[root@localhost mnt]# mkdir 192.168.139.132
[root@localhost mnt]# ls
192.168.139.132  rh
[root@localhost mnt]# 
[root@localhost mnt]# df -hT
文件系统                类型      容量  已用  可用 已用% 挂载点
192.168.139.141:/opt    nfs4       20G  4.6G   16G   23% /mnt

服务端查看是否创建

[root@localhost network-scripts]# ls /opt
192.168.139.132  rh
[root@localhost network-scripts]# 

站点

总结

软件仓库的提供方式

file://

ftp://

http://

配置文件 /etc/yum.repos.d/*.repo

[base]

name=centos 7.3

baseurl=ftp://192.168.88.88/centos7     ‘软件仓库的路径’

enabled=1   '启用'

gpgcheck=0  '不启用验证'

其他配置文件

基本设置 /etc/yum/conf

日志文件 /var/log/yum.log

yum update 连内核一起升级,

yum upgrade 只更新软件包,不更新内核

NFS网络存储

依赖于RPC远程过程调用

需要安装nfs-utils、rpcbind 软件包

共享配置文件 /etc/exports

向里写入共享的目录和可用账户
/var/ftp/pub   192.168.10.0/24(rw,sync,no_root_squash)

用户可以是网段,也可以是ip地址

ro 只可读 rw读写 sync 同步 no_root_squash 不对root用户进行降级处理

也可以直接配置文件的权限

启动NFS服务需要启动两个

分别是rpcbind和nfs

nfs 网络存储

rpcbind 远程调用

查看配置

showmount -e 共享服务端ip地址

共享路径 可用用户

挂载

查看手动挂载 /etc/mtab

自动挂载

vim /etc/fstab

服务端ip地址:共享目录路径  客户端路径   nfs defaults,_netdev    0   0   
推荐阅读:
  1. MySQL——全量、增量备份与恢复(理论+实操)
  2. 理论+实操 :源码编译安装LAMP

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

linux yum仓库与nfs网络存储服务搭建 资源共享

上一篇:google云游戏stadia

下一篇:Netflix Archaius 分布式配置管理依赖构件

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》