centos 镜像源_孩子镜像问题怎么解决

centos 镜像源_孩子镜像问题怎么解决CentOS8阿里新镜像源【旧的已经弃用】欢迎使用Markdown编辑器你好!这是你第一次使用Markdown编辑器所展示的欢迎页。如果你想学习如何使用Markdown编辑器,可以仔细阅读这篇文章,了解一下Markdown的基本语法知识。新的改变我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,我们增加了如下几点新功能,帮助你用它写博客:全新的界面设计,将会带来全新的写作体验;在创作中心设置你喜爱的代码高亮样式,Markdown将代码片

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

CentOS8阿里新镜像源【解决阿里云路径弃用问题】

方案1(脚本中会清空yum.repo.d内的文件)

==防盗标识:本文源文地址,未授权禁止转载https://blog.csdn.net/weixin_44331765/article/details/123068623

  1. 创建一个脚本文件cetos.sh
  2. 写入以下内容
  3. 执行bash centos.sh即可
    
    #!/bin/bash
    cp -r /etc/yum.repo.d /etc/yum.repo.d.bak
    rm -rf /etc/yum.repo.d/*
    cat >> /etc/yum.repo.d/CentOS-Base.repo << EOF # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-8.5.2111 - Base - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/BaseOS/\$basearch/os/ http://mirrors.aliyuncs.com/centos-vault/8.5.2111/BaseOS/\$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/BaseOS/\$basearch/os/ gpgcheck=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official #additional packages that may be useful [extras] name=CentOS-8.5.2111 - Extras - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/extras/\$basearch/os/ http://mirrors.aliyuncs.com/centos-vault/8.5.2111/extras/\$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/extras/\$basearch/os/ gpgcheck=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official #additional packages that extend functionality of existing packages [centosplus] name=CentOS-8.5.2111 - Plus - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/centosplus/\$basearch/os/ http://mirrors.aliyuncs.com/centos-vault/8.5.2111/centosplus/\$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/centosplus/\$basearch/os/ gpgcheck=0 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official [PowerTools] name=CentOS-8.5.2111 - PowerTools - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/PowerTools/\$basearch/os/ http://mirrors.aliyuncs.com/centos-vault/8.5.2111/PowerTools/\$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/PowerTools/\$basearch/os/ gpgcheck=0 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official [AppStream] name=CentOS-8.5.2111 - AppStream - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/AppStream/\$basearch/os/ http://mirrors.aliyuncs.com/centos-vault/8.5.2111/AppStream/\$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/AppStream/\$basearch/os/ gpgcheck=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official EOF
    
    yum clean all && yum makecache
    
    
    

方案2替换原有的路径

  1. 手动替换:
替换CentOS-Linux-AppStream.repo中的内容
1. 注释#mirrorlist=xxxxx
2. 启用baseurl=xxx,并把baseurl中的http路径修改为:baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/extras/$basearch/os/
3. 同理替换CentOS-Linux-BaseOS.repo中的mirrorlist=xxx和baseurl并把地址换了即可
  1. 脚本执行:执行方法同1
    centos.sh文件内容替换为
#!/bin/bash
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
cat >> /etc/yum.repo.d/CentOS-Base.repo << EOF # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-8.5.2111 - Base - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/BaseOS/\$basearch/os/ http://mirrors.aliyuncs.com/centos-vault/8.5.2111/BaseOS/\$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/BaseOS/\$basearch/os/ gpgcheck=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official #additional packages that may be useful [extras] name=CentOS-8.5.2111 - Extras - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/extras/\$basearch/os/ http://mirrors.aliyuncs.com/centos-vault/8.5.2111/extras/\$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/extras/\$basearch/os/ gpgcheck=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official #additional packages that extend functionality of existing packages [centosplus] name=CentOS-8.5.2111 - Plus - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/centosplus/\$basearch/os/ http://mirrors.aliyuncs.com/centos-vault/8.5.2111/centosplus/\$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/centosplus/\$basearch/os/ gpgcheck=0 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official [PowerTools] name=CentOS-8.5.2111 - PowerTools - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/PowerTools/\$basearch/os/ http://mirrors.aliyuncs.com/centos-vault/8.5.2111/PowerTools/\$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/PowerTools/\$basearch/os/ gpgcheck=0 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official [AppStream] name=CentOS-8.5.2111 - AppStream - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/AppStream/\$basearch/os/ http://mirrors.aliyuncs.com/centos-vault/8.5.2111/AppStream/\$basearch/os/ http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/AppStream/\$basearch/os/ gpgcheck=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official EOF
minorver=8.5.2111
sudo sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/&dollar;contentdir/&dollar;releasever/AppStream/&dollar;basearch/os/|baseurl=http://mirrors.aliyun.com/centos-vault/$minorver/extras/$basearch/os/|g" \
-i.bak \
/etc/yum.repos.d/CentOS-Linux-AppStream.repo

sudo sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/&dollar;contentdir/&dollar;releasever/BaseOS/&dollar;basearch/os/|baseurl=http://mirrors.aliyun.com/centos-vault/$minorver/extras/$basearch/os/|g" \
-i.bak \
/etc/yum.repos.d/CentOS-Linux-BaseOS.repo
dnf clean all
dnf makecache

参考连接1
参考连接2

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/179217.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 生成initramfs_windows引导文件

    生成initramfs_windows引导文件在制作Initramfs文件系统之前,我先简单介绍下linux各文件系统。linux支持多种文件系统类型,包括ext2,ext3,vfat,jffs,ramfs,nfs等,为了对各类文件系统进行统一管理,linux引入了虚拟文件系统vfs(virtualfilesystem),为各类文件系统提供一个统一的应用编程接口。文件系统类型主要有如下:根据存储设备的硬件特性,…

    2022年8月11日
    8
  • Qt是什么?Qt简介(非常全面)

    Qt是什么?Qt简介(非常全面)Qt是什么?Qt简介(非常全面)Qt(官方发音[kju:t],音同cute)是一个跨平台的C++开发库,主要用来开发图形用户界面(GraphicalUserInterface,GUI)程序,当然也可以开发不带界面的命令行(CommandUserInterface,CUI)程序。Qt是纯C++开发的,所以学好C++非常有必要,对于不了解C++的读者,我建议先阅读《C语言教程》,再阅读《C++教程》。C++是在C语言的基础上发展起来的,学完C语言就学了C++的一半了。Q

    2022年5月13日
    64
  • java中如何获取当前系统时间[通俗易懂]

    java中如何获取当前系统时间[通俗易懂]java.util包中提供的和日期时间相关的类有Date类、Calendar类和SimpleDateFormat类等。方法一:Date类对象用来表示日期和时间,该类提供了一系列操作日期和时间各组成部分的方法,Date类中使用最多的是获取系统当前的日期和时间,如Datedate=newDate();这句代码是使用当前时间创建日期对象示例代码如下:publicstaticvoidm…

    2022年10月19日
    5
  • native/ascii在线转换工具_中文转ascii

    native/ascii在线转换工具_中文转ascii1,原理Property文件中,使用的编码根据机器的设置可能是GBK或者UTF-8。而在Java中读取Property文件时使用的是Unicode编码,编码方式不同会导致中文乱码,因此需要将Property文件中的中文字符转化成Unicode编码才能正常显示中文。2,解决办法Java提供了native2ascii这种专门的工具对Property文件进行编码转换,在JDK安装环境的bin目录下可以找…

    2025年10月26日
    2
  • winexec for linux[通俗易懂]

    winexec for linux[通俗易懂]ViewFullVersion:[allvariants]psexecforLinuxpromodusAugust25th,2008,04:42AMAftersometrial&errorI’vegottenwinexectoworkonLinux.Thisisidenticaltothepse

    2022年7月27日
    4
  • 仿QQ联系人的TableView的折叠与拉伸

    仿QQ联系人的TableView的折叠与拉伸

    2022年3月12日
    68

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号