Special thanks to:
Earth Space-Technical Fish https://blog.csdn.net/hkbbkk
1: Mirror station
Two: The mirror station provides a replacement method, directly copy and replace.
Note: There will be format problems with the copy command here. It is recommended to go directly to the mirror station to copy and modify. It can be used.
When replacing, you need to modify the last line according to the actual file of your system. The file in my /etc/yum.repos.d/ directory is the rocky.repo file, so the last line needs to be modified to rocky*.repo (using the original Rocky-*.repo will result in an error)
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.sjtug.
sjtu.edu.cn/rocky|g' \
-i.bak \
/etc/yum.repos.d/rocky*.repo
Three: Clear cache
yum clean all
Four: Generate a new cache
yum makecache
Five: Upgrade software (optional)
yum -y update