CentOS7更換國內yum源


1.備份原Base源

cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
# ====== 更換清華源請使用 ======
cp CentOS-Base.repo CentOS-Base.repo.bak

2.更換國內源

下面的操作任選一個即可

阿里鏡像源

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

清華鏡像源

sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
         -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' \
         -i.bak \
         /etc/yum.repos.d/CentOS-*.repo

3.更新軟件包緩存

yum makecache

參考:
阿里源CentOS 鏡像:https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b113id1k6
清華源CentOS 鏡像使用幫助:https://mirrors.tuna.tsinghua.edu.cn/help/centos/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM