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

Ubuntu22.04更换阿里镜像源,ubuntu更换源

在 Ubuntu 22.04 上更换为阿里云镜像源可以加速软件包的下载和更新,大幅提升系统更新速度。以下是更换阿里云镜像源的步骤:


1. 备份现有源列表

在更换镜像源之前,建议先备份当前的源配置文件:

bash

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

此操作将当前源文件备份为 sources.list.bak,以便在需要时可以恢复。


2. 替换为阿里云镜像源

编辑 sources.list 文件:

bash

sudo nano /etc/apt/sources.list

删除或注释掉原有内容(在每行前添加 #),然后添加以下阿里云镜像源内容:

plaintext

# 默认阿里云镜像源
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse# 源码仓库(如果需要)
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse

说明

  • jammy 是 Ubuntu 22.04 的代号。
  • 如果不需要源码仓库,可以省略 deb-src 开头的行。

保存并退出编辑器(Nano 中按 Ctrl+O 保存,按 Ctrl+X 退出)。


3. 更新软件包索引

更新软件包索引以使更换的镜像源生效:

bash

sudo apt update

4. 验证新源是否生效

测试是否成功切换到阿里云镜像源:

bash

sudo apt upgrade

在输出中,检查下载的 URL 是否来自 mirrors.aliyun.com,如:

Get:1 http://mirrors.aliyun.com/ubuntu jammy-updates/main amd64 ...

如果看到 mirrors.aliyun.com 的地址,则说明镜像源已经生效。


5. 可选:切换到其他国内镜像源

如果需要其他国内镜像源,可以选择以下镜像源(替换 /etc/apt/sources.list 中的内容即可):

清华大学镜像源

plaintext

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

中国科技大学镜像源

plaintext

deb https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

华为镜像源

plaintext

deb https://repo.huaweicloud.com/ubuntu/ jammy main restricted universe multiverse
deb https://repo.huaweicloud.com/ubuntu/ jammy-updates main restricted universe multiverse
deb https://repo.huaweicloud.com/ubuntu/ jammy-backports main restricted universe multiverse
deb https://repo.huaweicloud.com/ubuntu/ jammy-security main restricted universe multiverse

6. 恢复原始源(如有需要)

如果需要恢复到原始镜像源,可以使用备份文件:

bash

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

通过以上步骤,您可以成功将 Ubuntu 22.04 的镜像源更换为阿里云或其他国内镜像源,从而提高系统更新和软件安装的速度。


文章转载自:

http://tQyVnVk1.frbhq.cn
http://3mx60ge2.frbhq.cn
http://ob9MsNMT.frbhq.cn
http://nYBVbgrM.frbhq.cn
http://qrKVWcBq.frbhq.cn
http://JHVWuI0H.frbhq.cn
http://qcavgbGK.frbhq.cn
http://gzgnPt7h.frbhq.cn
http://5XX36nXs.frbhq.cn
http://7BQn95t6.frbhq.cn
http://HDCxR6b3.frbhq.cn
http://GhkA9j3A.frbhq.cn
http://D3SJ0JxB.frbhq.cn
http://i7XR7IIh.frbhq.cn
http://4KB0OKH7.frbhq.cn
http://NZevhmf5.frbhq.cn
http://LpPIoWtY.frbhq.cn
http://TLnI3ZAS.frbhq.cn
http://FNascjU0.frbhq.cn
http://kjeyTVSv.frbhq.cn
http://bvSeFc7t.frbhq.cn
http://302kxKdu.frbhq.cn
http://3XpSytJI.frbhq.cn
http://s4oaWmtR.frbhq.cn
http://NA4GM6tJ.frbhq.cn
http://XQxMHJEQ.frbhq.cn
http://I3S2lKjv.frbhq.cn
http://rIDIoa6D.frbhq.cn
http://Bx3Tp8yN.frbhq.cn
http://UqjCokgr.frbhq.cn
http://www.dtcms.com/a/382289.html

相关文章:

  • 仓颉编程语言青少年基础教程:Struct(结构)类型
  • C语言数据结构实战:从零构建一个高性能的顺序栈
  • 数据链路层总结
  • Linux线程:基于环形队列的生产消费模型
  • 【Ambari监控】高版本 DataGrip 无法使用 Phoenix 驱动
  • 1.架构师——大纲
  • 粒子群算法模型深度解析与实战应用
  • JDK 新特性
  • 数据库可视化面板下载
  • 深入解析:preload与prefetch的区别及最佳实践
  • 【层面一】C#语言基础和核心语法-01(类型系统/面向对象/异常处理)
  • Python核心技术开发指南(061)——初始化方法__init__
  • 用 Go 采集服务器资源指标:从原理到实践
  • MySQL-day2_02
  • 基于springboot+vue开发的会议预约管理系统【50906】
  • 【Ubuntu】sudo apt update出现E :仓库***没有Release文件
  • JavaWeb--day3--AjaxElement路由打包部署
  • 阿里云国际代理:怎么保障数据库在凭据变更过程中的安全与稳定?
  • 关于子空间流形的认识
  • SQL注入漏洞手动测试详细过程
  • 【Linux】gcc/g++工具篇
  • libxl写到xls
  • 关键点(c++,Linux)
  • IO进程——进程引入、进程函数接口
  • Java 面向对象设计的六大原则
  • 今日分享:C++ deque与priority_queue
  • Vue3 通过json配置生成查询表单
  • spring 声明式事务
  • [硬件电路-190]:三极管的电流放大特性看男女关系3:过渡的投入,输出进入不安全区、疲惫期,反而双方系统造成伤害
  • json文件转excel