配置本地镜像源
##创建一个ISO目录,并且挂载光盘镜像安装包目录到该目录,最好设置永久挂载,此处不描述。 [root@adozoo ~]# mkdir /iso [root@adozoo ~]# mount /dev/sr0 /iso mount: /iso: WARNING: device write-protected, mounted read-only. ## 进入到已经挂载好的安装目录下,可以找个包试着下载一下。 [root@adozoo ~]# cd /iso/BaseOS/Packages/ [root@adozoo Packages]# rpm -ivh xz-5.2.4-3.el8.x86_64.rpm warning: xz-5.2.4-3.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Verifying... ################################# [100%] Preparing... ################################# [100%] package xz-5.2.4-3.el8.x86_64 is already installed ## 进入红帽镜像配置文件目录,删除原有.repo文件 [root@adozoo ~]# cd /etc/yum.repos.d/ [root@adozoo yum.repos.d]# ls redhat.repo [root@adozoo yum.repos.d]# rm -rf * ## 为了先搭建一个本地仓库源,照着下面进行编辑,并且创建两个.repo文件, [root@adozoo yum.repos.d]# vim iso.repo [tmp] name = tmp enable = yes gpgcheck = 0 baseurl = file:///iso/BaseOS [root@adozoo yum.repos.d]# vim appstream.repo [media] name = media enable = yes gpgcheck = 0 baseurl = file:///iso/AppStream ## 到此为止,执行yum更新源三连操作yum clean all --> yum makecache --> yum repolist [root@adozoo yum.repos.d]# yum clean all [root@adozoo yum.repos.d]# yum makecache [root@adozoo yum.repos.d]# yum repolist
配置外部源(清华源)
## 安装yum-utils [root@adozoo yum.repos.d]# yum -y install yum-utils ## 配置centos8清华源 [root@adozoo yum.repos.d]# yum-config-manager --add-repo=https://mirrors.tuna.tsinghua.edu.cn/centos/8/cloud/x86_64/openstack-train/ ##配置epel8清华源 [root@adozoo yum.repos.d]# yum-config-manager --add-repo=https://mirrors.tuna.tsinghua.edu.cn/epel/8/Everything/x86_64/ ## 到此为止,执行yum更新源三连操作yum clean all --> yum makecache --> yum repolist [root@adozoo yum.repos.d]# yum clean all [root@adozoo yum.repos.d]# yum makecache [root@adozoo yum.repos.d]# yum repolist
标签:repo,dnf,##,repos,adozoo,外网,yum,root From: https://www.cnblogs.com/spdb/p/16728038.html