建立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构建完成

相关推荐
半桔25 分钟前
【Linux手册】探秘系统世界:从用户交互到硬件底层的全链路工作之旅
linux·运维·服务器·面试·centos
wanhengidc33 分钟前
服务器中CC攻击的特点有哪些?
运维·服务器
小杜的生信筆記38 分钟前
生信服务器 | 做生信为什么推荐使用Linux服务器?
linux·运维·服务器
luopeng20766343641 分钟前
虚拟局域网中配置某台服务器作为网关的方案
运维·服务器·php
ARM2NCWU42 分钟前
高密度ARM服务器的散热设计
运维·服务器
wanhengidc42 分钟前
站群服务器的应用场景都有哪些?
运维·服务器
WangY_ZQ1 小时前
Python 如何在Python 3.6上安装PIP
linux·python·pip
小狗祈祷诗1 小时前
day36-多路IO复用
linux·ubuntu
冰羽IOX2 小时前
Xen Server服务器释放磁盘空间
linux·运维·服务器
JenKinJia2 小时前
镜像里切换为普通用户
linux·运维·服务器