阿里云yum源#
# file: /etc/yum.repos.d/CentOS-AppStream.repo
[AppStream]
name=CentOS-$releasever - AppStream
baseurl=http://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
# file: /etc/yum.repos.d/CentOS-Base.repo
[BaseOS]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
# file: /etc/yum.repos.d/CentOS-Epel.repo
[epel]
name=CentOS-$releasever - Epel
baseurl=http://mirrors.aliyun.com/epel/8/Everything/$basearch
enabled=1
gpgcheck=0
以iso光盘镜像作为yum源#
需要先挂载光盘,虚拟机安装为例
$ df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 18M 3.8G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/cl-root 50G 6.4G 44G 13% /
/dev/mapper/cl-home 42G 427M 41G 2% /home
/dev/sda1 976M 186M 724M 21% /boot
tmpfs 780M 28K 780M 1% /run/user/42
tmpfs 780M 5.7M 774M 1% /run/user/1000
/dev/sr0 6.7G 6.7G 0 100% /run/media/wesson/CentOS-8-BaseOS-x86_64
# sudo mount -o loop /dev/sr0 /media/CentOS
修改配置
# file: /etc/yum.repos.d/CentOS-Media.repo
[c8-media-BaseOS]
name=CentOS-BaseOS-$releasever - Media
baseurl=file:///media/CentOS/BaseOS/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[c8-media-AppStream]
name=CentOS-AppStream-$releasever - Media
baseurl=file:///media/CentOS/AppStream/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
重载#
dnf clean all # 清除所有的缓存文件
dnf makecache # 制作元数据缓存
作者: xiaowei丶go
出处:https://www.cnblogs.com/magicpose/p/11905330.html