为Linux配置本地YUM仓库[Dark凌云]

Linux自定义本地YUM源

Yum软件仓库的作用是为了进一步简化RPM管理软件的难度以及自动分析所需软件包及其依赖关系的技术。里面保存有几乎所有常用的工具,而且只需要说出所需的软件包名称,系统就会自动为您搞定一切。

相关说明

  1. YUM配置文件目录为:/etc/yum.repos.d/
  2. YUM配置文件后缀名称必须为:******.repo

配置文件参数

  1. [Yum-media]:Yum软件仓库唯一标识符,避免与其他仓库冲突。
  2. name=Yum-media:Yum软件仓库的名称描述,易于识别仓库用处。
  3. baseurl=file:///media/cdrom:提供的方式包括FTP(ftp://…)、HTTP(http://…)、本地(file:///…)。
  4. enabled=1:设置此源是否可用;1为可用,0为禁用。
  5. gpgcheck=1:设置此源是否校验文件;1为校验,0为不校验
  6. gpgkey=file:///media/cdrom/RPM-GPG-KEY-redhat-release:若上面参数开启校验,那么请指定公钥文件地址。

配置过程

  1. mount /dev/cdrom /media
  2. mkdir /Yum-media
  3. cp -av /media/BaseOS /Yum-media
  4. cp -av /media/Appstream /Yum-media
  5. cd /etc/yum.repos.d/
  6. rm -rf *
  7. vim meida.repo
[BaseOS]
name=BaseOS
baseurl=file:///Yum-media/BaseOS
enable=1
gpgcheck=0


[AppStream]
name=Appstream
baseurl=file:///Yum-media/AppStream
enable=1
gpgcheck=0

这里之所以配置文件有两个配置是基于RHEL8的,RHEL7只需要配置其中一项即可,但本地文件软件包目录为baseurl=file:///Yum-media/Packges

  1. 配置完成后,使用yum list查看于仓库,如需验证,可以安装软件包验证。
  2. 软件包验证:
[root@LingYun ~]# yum install httpd
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
上次元数据过期检查:0:30:57 前,执行于 2019年10月30日 星期三 18时18分22秒。
依赖关系解决。
================================================================================
 软件包               架构     版本                                   仓库
                                                                           大小
================================================================================
Installing:
 httpd                x86_64   2.4.37-10.module+el8+2764+7127e69e     B   1.4 M
安装依赖关系:
 redhat-logos-httpd   noarch   80.7-1.el8                             A    25 k
 apr                  x86_64   1.6.3-9.el8                            B   125 k
 apr-util             x86_64   1.6.1-6.el8                            B   105 k
 httpd-filesystem     noarch   2.4.37-10.module+el8+2764+7127e69e     B    34 k
 httpd-tools          x86_64   2.4.37-10.module+el8+2764+7127e69e     B   101 k
 mod_http2            x86_64   1.11.3-1.module+el8+2443+605475b7      B   156 k
安装弱的依赖:
 apr-util-bdb         x86_64   1.6.1-6.el8                            B    25 k
 apr-util-openssl     x86_64   1.6.1-6.el8                            B    27 k
Enabling module streams:
 httpd                         2.4                                             

事务概要
================================================================================
安装  9 软件包

总计:2.0 M
安装大小:5.4 M
确定吗?[y/N]: y
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中      :                                                          	1/1 
  Installing  : apr-1.6.3-9.el8.x86_64                                     	1/9 
  运行脚本    : apr-1.6.3-9.el8.x86_64                                      	1/9 
  Installing  : apr-util-bdb-1.6.1-6.el8.x86_64                            	2/9 
  Installing  : apr-util-openssl-1.6.1-6.el8.x86_64                         3/9 
  Installing  : apr-util-1.6.1-6.el8.x86_64                                 4/9 
  运行脚本    : apr-util-1.6.1-6.el8.x86_64                                 	4/9 
  Installing  : httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_64       5/9 
  运行脚本    : httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarc   	6/9 
  Installing  : httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch	6/9 
  Installing  : redhat-logos-httpd-80.7-1.el8.noarch						7/9 
  Installing  : mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64			8/9 
  Installing  : httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64				9/9 
  运行脚本    : httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64				9/9 
  验证        : redhat-logos-httpd-80.7-1.el8.noarch							1/9 
  验证        : apr-1.6.3-9.el8.x86_64										2/9 
  验证        : apr-util-1.6.1-6.el8.x86_64									3/9 
  验证        : apr-util-bdb-1.6.1-6.el8.x86_64								4/9 
  验证        : apr-util-openssl-1.6.1-6.el8.x86_64							5/9 
  验证        : httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64				6/9 
  验证        : httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch	7/9 
  验证        : httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_6			8/9 
  验证        : mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64			9/9 
Installed products updated.

已安装:
  httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64                        
  apr-util-bdb-1.6.1-6.el8.x86_64                                   
  apr-util-openssl-1.6.1-6.el8.x86_64                                     
  redhat-logos-httpd-80.7-1.el8.noarch                              
  apr-1.6.3-9.el8.x86_64                                                  
  apr-util-1.6.1-6.el8.x86_64                                       
  httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch              
  httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_64             
  mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64                     

完毕!

发布了4 篇原创文章 · 获赞 2 · 访问量 1088

猜你喜欢

转载自blog.csdn.net/qq_42514956/article/details/102776620