Redhat8.0系统
rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
Centos8.0系统
rpm -ivh https://mirrors.aliyun.com/centos/8.0.1905/extras/x86_64/os/Packages/centos-release-stream-8.0-0.1905.0.9.el8.x86_64.rpm
本地yum源搭建脚本
#/bin/bash
mount /dev/sr0 /mnt
cp -ra /mnt/media.repo /etc/yum.repos.d/local.repo

/etc/yum.repos.d/local.repo
echo '[BaseOS]' >> /etc/yum.repos.d/local.repo
echo 'name=BaseOS' >> /etc/yum.repos.d/local.repo
echo 'baseurl=file:///mnt/BaseOS' >> /etc/yum.repos.d/local.repo
echo 'gpgcheck=0' >> /etc/yum.repos.d/local.repo
echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release' >> /etc/yum.repos.d/local.repo
echo 'enabled=1' >> /etc/yum.repos.d/local.repo
echo -n
echo '[AppStream]' >> /etc/yum.repos.d/local.repo
echo 'name=AppStream' >> /etc/yum.repos.d/local.repo
echo 'baseurl=file:///mnt/AppStream' >> /etc/yum.repos.d/local.repo
echo 'enabled=1' >> /etc/yum.repos.d/local.repo
echo 'gpgcheck=0' >> /etc/yum.repos.d/local.repo
echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta' >> /etc/yum.repos.d/local.repo
yum repolist