centos 8 换源

centos 8 换源

  • 进入 root,切换至 yum.repos.d 目录

    cd /etc/yum.repos.d/
    
  • 创建新文件夹并将源文件备份为 repo.bak

    mkdir backup && mv *repo backup/
    
  • 下载国内 yum 源文件

    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
    
  • 更新下载yum源地址

    sed -i -e"s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-*;sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-*
    
  • 生成缓存

    yum clean all && yum makecache
    

脚本模式

#!bin/bash
cd /etc/yum.repos.d/
mkdir backup && mv *repo backup/
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
sed -i -e"s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-*
sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-*
yum clean all && yum makecache

相关推荐

  1. centos 8

    2024-06-16 12:16:01       6 阅读
  2. Centos8】配置网络镜像

    2024-06-16 12:16:01       36 阅读
  3. CentOs 8 设置 新的流程。

    2024-06-16 12:16:01       14 阅读
  4. Ubuntu pip

    2024-06-16 12:16:01       39 阅读
  5. npm<span style='color:red;'>换</span><span style='color:red;'>源</span>

    npm

    2024-06-16 12:16:01      33 阅读
  6. npm

    2024-06-16 12:16:01       30 阅读
  7. Jetson 国内

    2024-06-16 12:16:01       15 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-16 12:16:01       17 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-16 12:16:01       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-16 12:16:01       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-16 12:16:01       18 阅读

热门阅读

  1. leetcode-169-多数元素

    2024-06-16 12:16:01       7 阅读
  2. Flutter 应用加速之本地缓存管理

    2024-06-16 12:16:01       8 阅读
  3. 【车载开发系列】汽车嵌入式开发常用工具介绍

    2024-06-16 12:16:01       10 阅读
  4. KeyedProcessFunction 在 Flink项目中的应用实战

    2024-06-16 12:16:01       10 阅读
  5. 【LeetCode最详尽解答】15-三数之和 3sum

    2024-06-16 12:16:01       10 阅读
  6. LNMP网站架构

    2024-06-16 12:16:01       8 阅读
  7. C语言——文件

    2024-06-16 12:16:01       7 阅读
  8. 【网络安全产品】---下一代防火墙

    2024-06-16 12:16:01       10 阅读