Redhat/CentOS7/8本地yum仓库配置

目录

前提

新建install目录用于存放yum仓库文件

创建repo目录,存放原始repo配置文件

挂载ISO光驱

拷贝ISO内文件至本地install

编辑本地yum仓库配置(redhat7)

编辑本地yum仓库配置(Centos7)

 编辑本地yum仓库配置(Centos8)

配置文件说明(Redhat举例)

清除及重新生成缓存

如需安装vmware-tools执行如下安装perl组件


前提

本次使用VMware ESXi模拟配置,已挂载ISO文件置光驱;

物理机可通过imm、HDM等方式进行挂载,CAS/XEN等虚拟化超融合将ISO文件挂载、连接即可

新建install目录用于存放yum仓库文件

[root@localhost ~]# mkdir /install

This image has an empty alt attribute

创建repo目录,存放原始repo配置文件

[root@localhost ~]# mkdir /etc/yum.repos.d/repo
[root@localhost ~]# mv /etc/yum.repos.d/* /etc/yum.repos.d/repo
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
repo

This image has an empty alt attribute

挂载ISO光驱

[root@localhost yum.repos.d]# mount /dev/cdrom /media/

This image has an empty alt attribute

拷贝ISO内文件至本地install

[root@localhost ~]# cp -r /media/* /install/

This image has an empty alt attribute

修改配置文件如下:

vi /etc/yum/pluginconf.d/fastestmirror.conf  

This image has an empty alt attribute

编辑本地yum仓库配置(redhat7)

[root@localhost ~]# vi /etc/yum.repos.d/redhat-base.repo

添加如下内容:

[local]
name=Red Hat Enterprise Linux 7
baseurl=file:///install
enabled=1
gpgcheck=1
gpgkey=file:///install/RPM-GPG-KEY-redhat-release

This image has an empty alt attribute

编辑本地yum仓库配置(Centos7)

[root@localhost ~]# vi /etc/yum.repos.d/Centos-Base.repo

添加如下内容:

[local]
name=Centos7
baseurl=file:///install
enabled=1
gpgcheck=0

​​​​​​​

编辑本地yum仓库配置(Centos8)

[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Media.repo

添加如下内容:

[local]
name=Centos8
baseurl=file:///install
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

 关闭其他网络yum:

vi /etc/yum.repos.d/CentOS-Base.repo

vi /etc/yum.repos.d/CentOS-AppStream

vi /etc/yum.repos.d/CentOS-Extra

修改为
enable=0

在这里插入图片描述

配置文件说明(Redhat举例)

[rehl7] ----yum名称
name=rehl7 ----说明(内容随意填写,但不能缺少)
baseurl=file:///install ----文件路径(在第一节已说明)
enabled=1 ----是否启用yum(1表示启用,0表示不启用)
gpgcheck=0 ----gpgcheck参数是否使用公钥验证rpm包的正确性,(1验证,0不验证)

清除及重新生成缓存

[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache

如需安装vmware-tools执行如下安装perl组件

[root@localhost ~]#yum groupinstall "Perl Support"

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

知名“矿工”

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值