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  

Redhat/CentOS7/8本地yum仓库配置_第1张图片

编辑本地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

Redhat/CentOS7/8本地yum仓库配置_第2张图片

编辑本地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/CentOS7/8本地yum仓库配置_第3张图片

配置文件说明(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"

你可能感兴趣的:(服务器技术,vmware,linux)