Rocky Linux 9.0 replaces the yum source with the domestic yum source (Shanghai Jiaotong University) (updated in March 2023)

Special thanks to:       

Earth Space-Technical Fish https://blog.csdn.net/hkbbkk

1: Mirror station   

Shanghai Jiao Tong University Linux User Group Software Source Mirror Service Shanghai Jiao Tong University Linux User Group Software Source Mirror Service https://mirror.sjtu.edu.cn/

Two: The mirror station provides a replacement method, directly copy and replace.      

Shanghai Jiao Tong University Linux User Group Software Source Mirror Service Shanghai Jiao Tong University Linux User Group Software Source Mirror Service https://mirror.sjtu.edu.cn/docs/rocky

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

Guess you like

Origin blog.csdn.net/m0_73649227/article/details/129548068