Skip to content

Instantly share code, notes, and snippets.

@akkuman
Last active March 27, 2024 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akkuman/ecbaa3afde5e4e7cf440c09b3ca6067b to your computer and use it in GitHub Desktop.
Save akkuman/ecbaa3afde5e4e7cf440c09b3ca6067b to your computer and use it in GitHub Desktop.
rockylinux 9 (epel) 切换国内源
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 && \
dnf makecache && \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --enable devel && \
yum install -y epel-release && \
# https://github.com/tuna/issues/issues/1856
# https://help.mirrors.cernet.edu.cn/epel/?mirror=SJTUG-Siyuan
sed -e 's|^metalink=|#metalink=|g' \
-e 's|^#baseurl=|baseurl=|g' \
-e 's|https\?://download\.fedoraproject\.org/pub/epel|https://mirrors.sjtug.sjtu.edu.cn/fedora/epel|g' \
-e 's|https\?://download\.example/pub/epel|https://mirrors.sjtug.sjtu.edu.cn/fedora/epel|g' \
-i /etc/yum.repos.d/epel{,-testing}.repo && \
dnf makecache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment