当前位置: 首页 > news >正文

Linux 修改国内镜像源

一、Ubantu

1、备份系统源文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、编辑源文件

sudo vi /etc/apt/sources.list

3、直接输入49dd,清除所有内容
4、粘贴国内源

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

5、更新源

sudo apt-get -y update && sudo apt-get -y upgrade

二、CentOS 7

1、备份系统源文件

sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载清华大学镜像源文件

sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tuna.tsinghua.edu.cn/help/centos/

3、清理缓存并更新软件包

sudo yum clean all
sudo yum makecache

三、CentOS 8

sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载清华大学镜像源文件

sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tuna.tsinghua.edu.cn/help/centos/

3、清理缓存并更新软件包

sudo dnf clean all
sudo dnf makecache

相关文章:

  • 基于Debian搭建FTP服务器
  • 腾讯云创建DeepSeek AI应用及使用教程
  • 人工智能和量子时代的网络安全
  • 类与对象(二)——类的 6 个默认成员函数
  • 模型空间、图纸空间、布局(Layout)之间联系——CAD c#二次开发
  • Java面试第十二山!《Redis缓存》
  • resnet与densenet的比较
  • 甘特图dhtmlx-gantt 一行多任务
  • MySQL-索引的使用
  • Docker Swarm集群搭建
  • 自然语言处理|深入解析 PEGASUS:从原理到实践
  • 电脑节电模式怎么退出 分享5种解决方法
  • ssh命令
  • 负载均衡的在线OJ项目
  • Redis核心机制(一)
  • 【智能体】| 知识库、RAG概念区分以及智能体是什么
  • 大数据学习(77)-Hive详解
  • 深度洞察:DeepSeek 驱动金融行业智能化转型变革
  • Nginx参数调优脚本
  • 基于springboot的免税商品优选购物商城(020)
  • 巴基斯坦称对印精准打击造成设施损坏和人员伤亡
  • 玉渊谭天丨中方为何此时同意与美方接触?出于这三个考虑
  • 欧盟决意与俄罗斯能源彻底决裂之际,美国谋划新生意:进口俄气对欧转售
  • 教育部答澎湃:2025世界数字教育大会将发布系列重磅成果
  • 中国天主教组织发贺电对新教皇当选表示祝贺
  • 夜读丨古代有没有近视眼?