目录
前提
新建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文件挂载、连接即可
[root@localhost ~]# mkdir /install
[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
[root@localhost yum.repos.d]# mount /dev/cdrom /media/
[root@localhost ~]# cp -r /media/* /install/
修改配置文件如下:
vi /etc/yum/pluginconf.d/fastestmirror.conf
[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
[root@localhost ~]# vi /etc/yum.repos.d/Centos-Base.repo
添加如下内容:
[local]
name=Centos7
baseurl=file:///install
enabled=1
gpgcheck=0
[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
[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
[root@localhost ~]#yum groupinstall "Perl Support"