yum替换为阿里云:
执行以下命令备份并替换默认源
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^# baseurl=https://repo.almalinux.org|baseurl=https://mirrors.aliyun.com|g' \
-i.bak \
/etc/yum.repos.d/almalinux*.repo
执行以下命令生成缓存
dnf clean all
dnf makecache
执行完 了依然报错
AlmaLinux 8 - BaseOS 0.0 B/s | 0 B 00:00
Errors during downloading metadata for repository 'baseos':
- Curl error (6): Couldn't resolve host name for https://mirrors.almalinux.org/mirrorlist/8/baseos [Could not resolve host: mirrors.almalinux.org]
Error: Failed to download metadata for repo 'baseos': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://mirrors.almalinux.org/mirrorlist/8/baseos [Could not resolve host: mirrors.almalinux.org]
查了一下yum源可以打开,但是 dnf不认
又在网上查了一下,编写/etc/resolv.conf
vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 114.114.114.114
再重新
dnf clean all
dnf makecache
这样就可以了