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

相关推荐
晚风_END几秒前
postgresql数据库|数据库维护系列|postgresql数据库参数配置详解和数据库维护时机的选择(三)
运维·开发语言·数据库·postgresql·oracle
RisunJan28 分钟前
Linux命令-grep命令(文本搜索工具)
linux·运维·服务器
ydswin33 分钟前
Keepalived详解:原理、编译安装与高可用集群配置
linux
The Electronic Cat33 分钟前
树莓派安装nginx
运维·chrome·nginx
不想画图37 分钟前
ELK+Filebeat实战
运维·elk
码界奇点1 小时前
基于Python与Django的白泽自动化运维系统设计与实现
运维·python·django·毕业设计·源代码管理
水天需0101 小时前
Vim 分屏操作详解
linux
安当加密1 小时前
防勒索方案在信创服务器上的部署实践
运维·服务器
电子小子洋酱1 小时前
Linux显示设备驱动开发 Drm驱动&&Makefile
linux·驱动开发·笔记
huangyuchi.1 小时前
【Linux 网络】理解并应用应用层协议:HTTP(附简单HTTP服务器C++代码)
linux·服务器·网络·网络协议·http·c/c++