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

Kevin 教程 1,943 次浏览 21条评论

平时经常测试不同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/

发表评论

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