三三世界-百宝箱

文章 分类 标签
132 9 250

公告

暂无站点公告

CentOS8配置yum源方法

三三 2022-02-17 4039 0条评论 环境搭建Linux使用 CentOS7centos8yum源

首页 / 正文

CentOS,是基于 Red Hat Linux 提供的可自由使用源代码的企业级 Linux 发行版本;是一个稳定,可预测,可管理和可复制的免费企业级计算平台。

下载地址:
http://isoredirect.centos.org/centos/7/isos/x86_64/
http://isoredirect.centos.org/centos/8/isos/x86_64/
附上阿里云下载地址
https://mirrors.aliyun.com/centos/
https://mirrors.aliyun.com/centos-vault/

安装了mini版本后,很多地方需要用到yum,那么配置yum源就变得非常重要。

配置方法(阿里云为例)

1. 备份

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

2. 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
centos8(centos8官方源已下线,建议切换centos-vault源)

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

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

CentOS 6

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

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

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

或者

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

3. 运行 yum makecache 生成缓存

yum clean all #清理缓存
yum makecache #更新源

4. 其他
非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。用户也可自行修改相关配置: eg:

sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

5、如果遇到问题:

Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

试着输入命令:

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

或者直接修改CentOS-AppStream.repo
[AppStream]

name=CentOS-$releasever - AppStream - mirrors.aliyun.com
#failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/AppStream/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

如果还是不行,重新执行下列命令:

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
wget -O /etc/yum.repos.d/CentOS-AppStream.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
sed -i 's/$releasever/8/g' /etc/yum.repos.d/CentOS-Base.repo
yum clean all
yum makecache

如果还是不行祭出最终方案,在执行上面的方法以后,执行:

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

如果还是不行,就没辙了。

附上相关源地址:

centos7 香港下载源

http://isoredirect.centos.org/centos/7/isos/x86_64/

http://mirror.hostlink.com.hk/centos/7.9.2009/isos/x86_64/
http://mirror-hk.koddos.net/centos/7.9.2009/isos/x86_64/
http://mirror.xtom.com.hk/centos/7.9.2009/isos/x86_64/
http://mirror.worria.com/centos/7.9.2009/isos/x86_64/
http://centos.nethub.com.hk/7.9.2009/isos/x86_64/
http://hk.mirrors.thegigabit.com/centos/7.9.2009/isos/x86_64/
http://repo.virtualhosting.hk/centos/7.9.2009/isos/x86_64/

Other mirrors further away:
http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/
http://mirrors.cqu.edu.cn/CentOS/7.9.2009/isos/x86_64/
http://mirrors.cn99.com/centos/7.9.2009/isos/x86_64/
http://mirrors.163.com/centos/7.9.2009/isos/x86_64/
http://mirrors.ustc.edu.cn/centos/7.9.2009/isos/x86_64/
http://ftp.sjtu.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.bfsu.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.nju.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.neusoft.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.bupt.edu.cn/centos/7.9.2009/isos/x86_64/
http://ftp.ksu.edu.tw/pub/CentOS/7.9.2009/isos/x86_64/
http://ftp.twaren.net/Linux/CentOS/7.9.2009/isos/x86_64/
http://ftp.stu.edu.tw/Linux/CentOS/7.9.2009/isos/x86_64/
http://mirror.rise.ph/centos/7.9.2009/isos/x86_64/
http://mirror.bizflycloud.vn/centos/7.9.2009/isos/x86_64/
http://mirrors.bkns.vn/centos/7.9.2009/isos/x86_64/
http://centos-hcm.viettelidc.com.vn/7.9.2009/isos/x86_64/
http://mirrors.vhost.vn/centos/7.9.2009/isos/x86_64/
http://mirrors.nhanhoa.com/centos/7.9.2009/isos/x86_64/
http://mirror.kku.ac.th/centos/7.9.2009/isos/x86_64/
http://mirror1.ku.ac.th/centos/7.9.2009/isos/x86_64/
http://mirrors.nipa.cloud/centos/7.9.2009/isos/x86_64/

centos8 香港下载源

http://isoredirect.centos.org/centos/8/isos/x86_64/

http://mirror.hostlink.com.hk/centos/8.5.2111/isos/x86_64/
http://repo.virtualhosting.hk/centos/8.5.2111/isos/x86_64/
http://mirror.worria.com/centos/8.5.2111/isos/x86_64/
http://hk.mirrors.thegigabit.com/centos/8.5.2111/isos/x86_64/
http://mirror.xtom.com.hk/centos/8.5.2111/isos/x86_64/
http://mirror-hk.koddos.net/centos/8.5.2111/isos/x86_64/

Other mirrors further away:
http://mirrors.tuna.tsinghua.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.bupt.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.nju.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.163.com/centos/8.5.2111/isos/x86_64/
http://ftp.sjtu.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.bfsu.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.njupt.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.neusoft.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.ustc.edu.cn/centos/8.5.2111/isos/x86_64/
http://ftp.twaren.net/Linux/CentOS/8.5.2111/isos/x86_64/
http://ftp.stu.edu.tw/Linux/CentOS/8.5.2111/isos/x86_64/
http://ftp.ksu.edu.tw/pub/CentOS/8.5.2111/isos/x86_64/
http://mirror.rise.ph/centos/8.5.2111/isos/x86_64/
http://mirrors.vhost.vn/centos/8.5.2111/isos/x86_64/
http://centos-hcm.viettelidc.com.vn/8.5.2111/isos/x86_64/
http://mirrors.bkns.vn/centos/8.5.2111/isos/x86_64/
http://mirror.bizflycloud.vn/centos/8.5.2111/isos/x86_64/
http://mirrors.nhanhoa.com/centos/8.5.2111/isos/x86_64/
http://mirror.aomyim.com/centos/8.5.2111/isos/x86_64/
http://mirrors.nipa.cloud/centos/8.5.2111/isos/x86_64/
http://mirror2.totbb.net/centos/8.5.2111/isos/x86_64/
http://mirror.kku.ac.th/centos/8.5.2111/isos/x86_64/
http://mirrors.hosting.in.th/centos/8.5.2111/isos/x86_64/
http://mirror1.ku.ac.th/centos/8.5.2111/isos/x86_64/

在不同地区服务器访问centos网站得到的地址就是最快的地址,可以访问后使用响应的源。

中国大陆源:

http://mirrors.neusoft.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/
http://mirrors.cqu.edu.cn/CentOS/7.9.2009/isos/x86_64/
http://mirrors.bupt.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.nju.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.ustc.edu.cn/centos/7.9.2009/isos/x86_64/
http://ftp.sjtu.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.cn99.com/centos/7.9.2009/isos/x86_64/
http://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.bfsu.edu.cn/centos/7.9.2009/isos/x86_64/
http://mirrors.163.com/centos/7.9.2009/isos/x86_64/

中国大陆centos8

http://mirrors.tuna.tsinghua.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.bupt.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.nju.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.163.com/centos/8.5.2111/isos/x86_64/
http://ftp.sjtu.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.bfsu.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.njupt.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.neusoft.edu.cn/centos/8.5.2111/isos/x86_64/
http://mirrors.ustc.edu.cn/centos/8.5.2111/isos/x86_64/

美国centos7

http://linux.cc.lehigh.edu/centos/7.9.2009/isos/x86_64/
http://mirrors.raystedman.org/centos/7.9.2009/isos/x86_64/
http://centos.mirror.lstn.net/7.9.2009/isos/x86_64/
http://mirror.san.fastserv.com/pub/linux/centos/7.9.2009/isos/x86_64/
http://centos.mirror.constant.com/7.9.2009/isos/x86_64/
http://mirror.keystealth.org/centos/7.9.2009/isos/x86_64/
http://mirror.centos.iad1.serverforge.org/7.9.2009/isos/x86_64/
http://mirrors.radwebhosting.com/centos/7.9.2009/isos/x86_64/
http://mirror.web-ster.com/centos/7.9.2009/isos/x86_64/
http://mirrors.maine.edu/CentOS/7.9.2009/isos/x86_64/
http://mirror.hackingand.coffee/centos/7.9.2009/isos/x86_64/
http://mirror.den01.meanservers.net/centos/7.9.2009/isos/x86_64/
http://mirror.vacares.com/centos/7.9.2009/isos/x86_64/
http://atl.mirrors.clouvider.net/CentOS/7.9.2009/isos/x86_64/
http://www.gtlib.gatech.edu/pub/centos/7.9.2009/isos/x86_64/
http://mirror.es.its.nyu.edu/centos/7.9.2009/isos/x86_64/
http://ftp.usf.edu/pub/centos/7.9.2009/isos/x86_64/
http://mirror.pit.teraswitch.com/centos/7.9.2009/isos/x86_64/
http://mirrors.xtom.com/centos/7.9.2009/isos/x86_64/
http://centos-distro.cavecreek.net/centos/7.9.2009/isos/x86_64/
http://mirror.chpc.utah.edu/pub/centos/7.9.2009/isos/x86_64/
http://mirrors.rcs.alaska.edu/centos/7.9.2009/isos/x86_64/
http://mirrors.unifiedlayer.com/centos/7.9.2009/isos/x86_64/
http://mirror.us-midwest-1.nexcess.net/CentOS/7.9.2009/isos/x86_64/
http://mirror.dal10.us.leaseweb.net/centos/7.9.2009/isos/x86_64/
http://mirror.genesishosting.com/centos/7.9.2009/isos/x86_64/
http://mirror.ilumno.com/centos/7.9.2009/isos/x86_64/
http://repos.hou.layerhost.com/centos/7.9.2009/isos/x86_64/
http://mirror.umd.edu/centos/7.9.2009/isos/x86_64/
http://mirror.nodesdirect.com/centos/7.9.2009/isos/x86_64/

美国centos8

http://mirror.ash.fastserv.com/centos/8.5.2111/isos/x86_64/
http://repos.lax.layerhost.com/centos/8.5.2111/isos/x86_64/
http://ftpmirror.your.org/pub/centos/8.5.2111/isos/x86_64/
http://centos-distro.1gservers.com/8.5.2111/isos/x86_64/
http://mirrors.gigenet.com/centos/8.5.2111/isos/x86_64/
http://mirror.keystealth.org/centos/8.5.2111/isos/x86_64/
http://mirror.es.its.nyu.edu/centos/8.5.2111/isos/x86_64/
http://mirror.cs.vt.edu/pub/CentOS/8.5.2111/isos/x86_64/
http://mirror.hackingand.coffee/centos/8.5.2111/isos/x86_64/
http://mirror.san.fastserv.com/pub/linux/centos/8.5.2111/isos/x86_64/
http://atl.mirrors.clouvider.net/CentOS/8.5.2111/isos/x86_64/
http://mirror.math.princeton.edu/pub/centos/8.5.2111/isos/x86_64/
http://mirror.cs.pitt.edu/centos/8.5.2111/isos/x86_64/
http://nc-centos-mirror.iwebfusion.net/centos/8.5.2111/isos/x86_64/
http://or-mirror.iwebfusion.net/centos/8.5.2111/isos/x86_64/
http://mirror.vacares.com/centos/8.5.2111/isos/x86_64/
http://mirrors.mit.edu/centos/8.5.2111/isos/x86_64/
http://ftp.usf.edu/pub/centos/8.5.2111/isos/x86_64/
http://mirrors.unifiedlayer.com/centos/8.5.2111/isos/x86_64/
http://mirror.atl.genesisadaptive.com/centos/8.5.2111/isos/x86_64/
http://yum.tamu.edu/centos/8.5.2111/isos/x86_64/
http://mirrors.ocf.berkeley.edu/centos/8.5.2111/isos/x86_64/
http://mirror.centos.iad1.serverforge.org/8.5.2111/isos/x86_64/
http://mirror.atlanticmetro.net/centos/8.5.2111/isos/x86_64/
http://mirrors.xtom.com/centos/8.5.2111/isos/x86_64/
http://mirror.cogentco.com/pub/linux/centos/8.5.2111/isos/x86_64/
http://mirror.genesisadaptive.com/centos/8.5.2111/isos/x86_64/
http://mirrors.usinternet.com/centos/8.5.2111/isos/x86_64/
http://linux-mirrors.fnal.gov/linux/centos/8.5.2111/isos/x86_64/
http://mirrors.radwebhosting.com/centos/8.5.2111/isos/x86_64/

评论(0)

当前没有评论,还不快来留下第一个脚印吧



最新评论

  • 三三

    @Doug Shume it's ok for me , you can post here.

  • refugiaguenther

    Saved as a favorite, I like your website!

  • josefa

    If some one wishes to be updated with hottest technologies after that he must be visit this site and be up to date daily.

  • Penzu

    Heello would you mind sharing which blog platform you're using? I'm planning to start my own blog in the near future but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then moost blogs and I'm looking for something completely unique. P.S Apologies forr being off-topic butt I had to ask!

  • Yupoo Fendi

    Thanks to my father who shared with me regarding this webpage, this website is genuinely amazing.

  • Doug Shume

    Hi, I have an overflow of customers that I'd like to send to you but I want to make sure you can handle more leads, let me know if you'd like me to send you more info.

  • SuperWind

    zh.us.to 有效
    kms.03k.org 有效
    kms.chinancce.com
    kms.shuax.com 有效
    kms.dwhd.org 有效
    kms.luody.info 有效
    kms.digiboy.ir 有效
    kms.lotro.cc 有效
    www.zgbs.cc 有效
    cy2617.jios.org 有效

  • 三三

    @         权限问题,试试sudo 再加命令。

  •         

    你好提示Permission denied 怎么办啊

日历

2024年12月

1234567
891011121314
15161718192021
22232425262728
293031    

文章目录

上一张 下一张