CentOS更换Yum软件源方法(附一键脚本)

Kevin 教程 2,343 次浏览 39条评论

平时经常测试不同VPS,免不了安装各种软件工具。有时系统默认配置的软件源很慢,需要更改从其它软件仓库下载安装。今天也遇到这一问题,顺便记下操作流程,方便新手参考使用。这里介绍的是CentOS系统更换方法,如果其它Linux系统或觉得手动麻烦,可使用文章最后提供的一键设置脚本。

手动配置方法

1. 为防之后更换出错可以恢复,先重命名备份原始repo文件。

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2. 下载Yum新软件源配置文件到/etc/yum.repos.d目录。

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

这里示例使用的是阿里云源,国内外都有CDN加持,建议使用。不同CentOS版本修改链接里的数字即可。如果没有安装wget软件,可以直接用vi创建文件。

其它几个较热门的开源镜像站
名称 网址
网易 https://mirrors.163.com/
搜狐 https://mirrors.sohu.com/
中科大 https://mirrors.ustc.edu.cn/
清华大学 https://mirror.tuna.tsinghua.edu.cn/
北京交大 https://mirror.bjtu.edu.cn/

3. 清理并生成新的缓存,然后就可以使用Yum新源了。

yum clean all
yum makecache

一键配置脚本

懒人用法,直接运行下面命令一键更换阿里云Yum源(Debian默认Fastly源)。

wget -qO- https://raw.githubusercontent.com/oooldking/script/master/superupdate.sh | bash

若运行出错,检查是否安装wget和ca-certificates软件,安装命令如下。

# CentOS
yum install -y wget ca-certificates

# Ubuntu/Debian
apt-get install -y wget ca-certificates

评论列表

  1. #1

    hydroxychloroquine 600 mg https://hydroxychloroquine.webbfenix.com/

  2. #2

    naltrexone 3 mg prescribing information https://naltrexoneonline.confrancisyalgomas.com/

  3. #3

    pour on ivermectin for swine https://ivermectin.mlsmalta.com/

  4. #4

    hydroxychloroquine 200 mg cost https://hhydroxychloroquine.com/

  5. #5

    where to buy cialis without prescriptions https://wisig.org/

  6. #6

    vidalista pill https://vidalista40mg.mlsmalta.com/

  7. #7

    albuterol sulfate inhalation aerosol hfa https://amstyles.com/

  8. #8

    chloroquine for covid 19 https://hydroxychloroquinee.com/

  9. #9

    priligy for daily use reviews https://ddapoxetine.com/

  10. #10

    chloroquine coronavirus trials https://hydroxychloroquine.mymvrc.org/

  11. #11

    doxycycline acne how long http://doxycycline.zolftgenwell.org/

  12. #12

    5 day prednisone pack dosage https://prednisone.bvsinfotech.com/

  13. #13

    cenforce pills for women walmart http://cavalrymenforromney.com/

  14. #14

    how to lose weight while taking tamoxifen https://tamoxifen.mrdgeography.com/

  15. #15

    vidalista black 80 mg https://vidalista.mlsmalta.com/

  16. #16

    get prescriptions online https://medpills.bee-rich.com/

  17. #17

    erection pills http://ciialis.co/

  18. #18

    cialis medication https://cialis.webbfenix.com/

  19. #19

    cialis medication https://cialis.studiowestinc.com/

  20. #20

    Hello there, I discovered your website by means of Google whilst searching for a related topic,
    your site came up, it looks good. I have bookmarked it in my
    google bookmarks.
    Hi there, simply became alert to your blog thru Google,
    and found that it is really informative. I’m gonna be careful for
    brussels. I’ll appreciate should you continue this
    in future. A lot of people will be benefited out of your writing.
    Cheers! http://antiibioticsland.com/Stromectol.htm

  21. #21

    which is better sildenafil or cialis https://tadfil.online/

  22. #22

    What i do not understood is in fact how you are now not really much more smartly-favored than you may be now. You are very intelligent. You know therefore considerably relating to this matter, produced me personally believe it from numerous various angles. Its like men and women are not involved until it¦s one thing to accomplish with Girl gaga! Your individual stuffs nice. At all times handle it up!

    http://www.vreyrolinomit.com/

  23. #23

    buy tadalafil http://vidallista.com/

  24. #24

    Your means of explaining everything in this post is really good, every one be capable of effortlessly be aware of it, Thanks a lot. http://herreramedical.org/hydroxychloroquine

  25. #25

    generic cialis 20mg price http://edbuy.online/

  26. #26

    naturally like your website but you need to check the spelling on several of your posts. Several of them are rife with spelling issues and I find it very troublesome to tell the truth nevertheless I’ll definitely come back again.

    http://www.zortilonrel.com/

  27. #27

    buy hydroxychloroquine online https://hydroxychloroquinex.com/

  28. #28

    how do you take vardenafil 20 mg? https://vegavardenafil.com/ vardenafil 20 mg

  29. #29

    best place to buy generic viagra online viagra over the counter
    cost of viagra

  30. #30

    tadalafil max dose https://elitadalafill.com/ tadalafil generic

  31. #31

    generic tadalafil – tadalafila 5mg ache preГ§o tadalafil pill

  32. #32

    buy ed drugs order ed pills
    best drug for ed

  33. #33

    buy ed pills from canada cheap online pharmacy
    buy ed pills from canada

  34. #34

    viagra without doctor prescription buy ed pills
    ed pills online

  35. #35

    Lhjoka – order modafinil Tlzrhr iyanpu

  36. #36

    alprostadil penile injection https://alprostadildrugs.com/ alprostadil injection site

  37. #37

    fantástico este conteúdo. Gostei muito. Aproveitem e vejam este conteúdo. informações, novidades e muito mais. Não deixem de acessar para aprender mais. Obrigado a todos e até a próxima. 🙂

    https://corporality.global/

  38. #38

    I’m now not sure where you’re getting your info, but good topic. I must spend a while learning more or figuring out more. Thanks for fantastic information I used to be searching for this info for my mission.

    http://www.vreyrolinomit.com/

  39. #39

    magnificent put up, very informative. I ponder why the other specialists
    of this sector don’t understand this. You must proceed your writing.
    I am sure, you’ve a great readers’ base already! https://cialis.confrancisyalgomas.com/tadalafil

发表评论

电邮地址用于 Gravatar 头像显示,不会被公开可见。