建立YUM仓库

yum仓库

yum是一个基于RPM包(是Red-Hat Package Manager红帽软件包管理器的缩写)构建的软件更新机制,能够自动解决软件包之间的依赖关系。解决了日常工作中的大量查找安装依赖包的时间

YUM 的前身是 YUP(Yellow dog Updater,Yellow dog Linux 的软件更新器),最初由 TSS 公司(Terra Soft Solutions,INC.)使用 Python 语言开发而成,后来由杜克大学(Duck University)的 Linux 开发队伍进行改进,命名为 YUM(Yellow dog Updater,Modified)。 要成功使用 YUM 机制来更新系统和软件,需要有一个包含各种 rpm 安装包文件及其依 赖软件的软件仓库(repository),提供软件仓库的服务器也称为"源"服务器。在客户机中只 要正确指定软件仓库的地址等信息,就可以通过对应的"源"服务器来安装或更新软件。

yum工作原理

yum依赖于环境,依赖于服务端和客户端,允许跨网络。

YUM基于C/S模式:

  • yum 服务器存放rpm包和相关包的元数据
  • yum客户端访问yum服务器进行安装或查询等

YUM实现过程:

先在yum服务器上创建 yum repository(仓库),在仓库中事先存储了众多rpm包,以及包的相关的元数据文件(放置于特定目录repodata下),当yum客户端利用yum/dnf工具进行安装时包时,会自动下载repodata中的元数据,查询远数据是否存在相关的包及依赖关系,自动从仓库中找到相关包下载并安装。

yum客户端配置

yum客户端配置文件

/etc/yum.conf //为所有仓库提供公共配置 /etc/yum.repos.d/*.repo //每个仓库的配置文件

yum主配置文件

/etc/yum.conf

yum仓库配置文件

仓库配置文件说明

/etc/yum.repos.d/*.repo

系统内默认的yum仓库,是centos官方的yum源(国外源),需要连通外网才可以使用。

baseurl 指向的路径

CentOS系统的yum源

阿里云

[mirrors.aliyun.com/centos/rel...](https://link.juejin.cn?target=https%3A%2F%2Fmirrors.aliyun.com%2Fcentos%2F%24releasever%2F "https://mirrors.aliyun.com/centos/releasever/") ​

腾讯云

[mirrors.cloud.tencent.com/centos/rel...](https://link.juejin.cn?target=https%3A%2F%2Fmirrors.cloud.tencent.com%2Fcentos%2F%24releasever%2F "https://mirrors.cloud.tencent.com/centos/releasever/")

华为云

[repo.huaweicloud.com/centos/rel...](https://link.juejin.cn?target=https%3A%2F%2Frepo.huaweicloud.com%2Fcentos%2F%24releasever%2F "https://repo.huaweicloud.com/centos/releasever/")

清华大学

[mirrors.tuna.tsinghua.edu.cn/centos/rel...](https://link.juejin.cn?target=https%3A%2F%2Fmirrors.tuna.tsinghua.edu.cn%2Fcentos%2F%24releasever%2F "https://mirrors.tuna.tsinghua.edu.cn/centos/releasever/")

EPEL的yum源

阿里云 [mirrors.aliyun.com/epel/relea...](https://link.juejin.cn?target=https%3A%2F%2Fmirrors.aliyun.com%2Fepel%2F%24releasever%2Fx86_64 "https://mirrors.aliyun.com/epel/releasever/x86_64") ​

腾讯云 [mirrors.cloud.tencent.com/epel/relea...](https://link.juejin.cn?target=https%3A%2F%2Fmirrors.cloud.tencent.com%2Fepel%2F%24releasever%2Fx86_64 "https://mirrors.cloud.tencent.com/epel/releasever/x86_64") ​

华为云 [mirrors.huaweicloud.com/epel/relea...](https://link.juejin.cn?target=https%3A%2F%2Fmirrors.huaweicloud.com%2Fepel%2F%24releasever%2Fx86_64 "https://mirrors.huaweicloud.com/epel/releasever/x86_64") ​

清华大学 [mirrors.tuna.tsinghua.edu.cn/epel/relea...](https://link.juejin.cn?target=https%3A%2F%2Fmirrors.tuna.tsinghua.edu.cn%2Fepel%2F%24releasever%2Fx86_64 "https://mirrors.tuna.tsinghua.edu.cn/epel/releasever/x86_64")

更新源

[mirrors.aliyun.com/centos/rel...](https://link.juejin.cn?target=http%3A%2F%2Fmirrors.aliyun.com%2Fcentos%2F%24releasever%2Fupdates%2F%24basearch%2F "http://mirrors.aliyun.com/centos/releasever/updates/$basearch/")

[mirrors.aliyuncs.com/centos/rel...](https://link.juejin.cn?target=http%3A%2F%2Fmirrors.aliyuncs.com%2Fcentos%2F%24releasever%2Fupdates%2F%24basearch%2F "http://mirrors.aliyuncs.com/centos/releasever/updates/$basearch/")

[mirrors.cloud.aliyuncs.com/centos/rel...](https://link.juejin.cn?target=http%3A%2F%2Fmirrors.cloud.aliyuncs.com%2Fcentos%2F%24releasever%2Fupdates%2F%24basearch%2F "http://mirrors.cloud.aliyuncs.com/centos/releasever/updates/$basearch/")

yum仓库搭建方式

软件仓库的提供方式:

http方式搭建云仓库

服务端安装hhtpd服务程序。

服务端切换到/var/www/html/ 目录,新建子目录centos7,并将光驱挂载到centos7目录下

关闭防火墙启动服务

客户端切换到/etc/yum.repos.d/目录,新建文件夹,将默认的yum仓库文件移动到该目录下。

创建http.repo文件

清理yum缓存,重新建立元数据

测试是否安装完成

可以安装ftp,yum创建完成

ftp方式搭建云仓库

安装vsftp

服务端切换到 /var/ftp/ 目录下新建一个子目录centos,并将光驱挂载到centos目录下

启动vsftp服务并关闭防火墙

进入客户端测试是否可以联通服务器(客户端需要安装ftp)

跟上面http一样的操作,移出不需的源以防干扰

编写ftp.repo文件

清理yum缓存,重新建立元数据

测试是否完成

可以安装,ftp构建完成

相关推荐
小码吃趴菜1 分钟前
线程同步-消息队列-互斥锁-补充两个面试问题
linux·分布式
TTBIGDATA3 分钟前
【Ambari开启Kerberos】Knox 接入 Trino web-ui 解决方案
大数据·运维·ambari·trino·knox·bigtop·ttbigdata
QT 小鲜肉5 分钟前
【Linux命令大全】003.文档编辑之head命令(实操篇)
linux·运维·服务器·前端·javascript·chrome
小米里的大麦6 分钟前
Ubuntu 22.04 中安装 thefuck 与 tldr 工具
linux·运维·ubuntu
Mintopia8 分钟前
🤖 Sentry × AI:让系统监控拥有“大脑”的新时代
运维·人工智能·监控
a413244714 分钟前
VMware ESXi8.0 环境下,加装nvidia RTX3090显卡,通过添加pci直通给ubuntu25虚拟机
linux·网络·esxi·3090
深蓝易网15 分钟前
打破数据滞后困局:让MES系统数据实时准确的实操方案
大数据·运维·人工智能·重构·制造
Lenyiin38 分钟前
第一个Linux程序
linux·运维·服务器
2501_9418714542 分钟前
面向微服务健康检查与自动恢复机制的互联网系统高可用设计与多语言工程实践分享
运维·服务器·前端
源远流长jerry1 小时前
四层与七层负载均衡实现原理及核心差异
运维·负载均衡