linux自定义yum软件仓库

Yum 仓库是为进一步简化 RPM 管理软件难度而设计的,Yum 能够根据用户的要求分析出所需软件包及其相关依赖关系,自动从服务器下载软件包并安装到系统
在这里插入图片描述
软件仓库的使用拓扑图

用户能够根据需求来指定 Yum 仓库与是否校验软件包,而这些只需几条关键词即可完成,现在来学习下配置的方法.所有 Yum 仓库的配置文件均需以.repo 结尾并存放在/etc/yum.repos.d/目录中的。
[rhel-media]: yum 源的名称,可自定义
baseurl=file:///media/cdrom :提供方式包括 FTP(ftp://…) ,HTTP(http://…),本地(file:///…)
enabled=1 : 设置此源是否可用,1 为可用,0 为禁用。
gpgcheck=1 : 设置此源是否校验文件,1 为校 验,0 为不校验。
gpgkey=file:///media/cdrom/RPM-GPG-KEY-redhat-release :若为校验请指定公钥文件地址。
Yum 仓库中的 RPM 软件包可以是由红帽官方发布的,也可以是第三方组织发布的,当然用户也可以编写的~

命令 作用
yum repolist all 列出所有仓库。
yum list all 列出仓 库中所有软件包
yum info 软件包名称 查看软件包信息
yum install 软件包名称 安装软件包
yum reinstall 软件包名称 重新安装软件包
yum update 软件包名称 升级软件包
yum remove 软件包 移除软件包
yum clean alla 清除所有仓库缓存
yum check-update 检查可更新的软件包
yum grouplist 查看系统中已经安装的软件包组
yum groupinstall 软件包组 安装指定的软件包组
yum groupremove 软件包组 移除指定的软件包组
yum groupinfo 软件包组查询指定的软件包组信息

下面来自定义一个yum软件仓库:
配置yum 仓库需要的条件:1众多的软件包 2 软件仓库清单 3搭建web或者FTP服务或者本地(file:///…)。
1.查看目录/root/下的tools.tar.gz压缩包,里面存放着rpm软件。

[root@208 ~]# ls
anaconda-ks.cfg       tools.tar.gz  模板  图片  下载  桌面

2.将此压缩包解压缩到根目录下

[root@208 ~]# tar -xf tools.tar.gz  -C /

3.查看根目录下解压缩的文件

[root@208 ~]# ls /tools/other/
boxes-1.1.1-4.el7.x86_64.rpm        oneko-1.2-19.fc24.x86_64.rpm
cmatrix-1.2a-1.i386.rpm             sl-5.02-1.el7.x86_64.rpm
ntfs-3g-2014.2.15-6.el6.x86_64.rpm

4.生成软件仓库清单repodata

[root@208 ~]# createrepo /tools/other/	
[root@208 ~]# ls /tools/other/
boxes-1.1.1-4.el7.x86_64.rpm        oneko-1.2-19.fc24.x86_64.rpm
cmatrix-1.2a-1.i386.rpm             repodata
ntfs-3g-2014.2.15-6.el6.x86_64.rpm  sl-5.02-1.el7.x86_64.rpm

5.书写yum仓库配置文件

[root@208 ~]# vim /etc/yum.repos.d/kk.repo 
	[myrpm]
	name=yumrepo
	baseurl=file:///tools/other/
	enabled=1
	gpgcheck=0

6.查看软件仓库列表

[root@208 ~]# yum repolist```

猜你喜欢

转载自blog.csdn.net/weixin_42104231/article/details/81879683