WSL不同版本的Ubuntu更换清华镜像,加速Ubuntu软件下载速度

news2024/9/28 21:22:05

文章目录

    • 不同版本的Ubuntu使用清华镜像,加速Ubuntu软件下载速度
        • 1. 备份源软件配置文件
        • 2. 复制镜像源
        • 3. 修改软件源配置文件
        • 4. 更新软件包列表,升级软件包等内容
        • 5. 从仓库中下载其它软件
        • 可能存在的问题

不同版本的Ubuntu使用清华镜像,加速Ubuntu软件下载速度

本博客目的: WSL的Ubuntu软件仓库更换清华镜像源。
提示: 这个是更新Ubuntu的软件仓库,而不是pip、conda更换清华镜像,记得自己的目的,别看错了。

使用WSL跑深度学习挺不错的,但是用wsl安装linux软件可能会存在部分问题,由于WSL里面的Ubuntu软件仓库是默认的源,有时候可能会造成网络连接问题,或者下载速度很慢,更换为清华镜像或者阿里云镜像会带来Ubuntu软件的快速下载,优化软件使用体验。

清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/

清华大学Ubuntu软件仓库:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/

阿里云Ubuntu软件仓库:https://developer.aliyun.com/mirror/ubuntu

该镜像仅包含32/64位x86架构处理器的软件包,在在 ARM(arm64, armhf)、PowerPC(ppc64el)、RISC-V(riscv64) 和 S390x 等架构的设备上(对应官方源为 ports.ubuntu.com)请使用 ubuntu-ports 镜像。

现在的win都是64位的,对应的WSL几乎都是64位的,因此对大多人都是适应的。

1. 备份源软件配置文件

Ubuntu的系统自带的配置文件在/etc/apt/source.list中,因此我们需要首先备份该配置文件,否则删了的话,如果镜像镜像也不可用,就很难受了。

首先进入配置文件目录,如下命令:

cd /etc/apt

在这里插入图片描述

备份的命令如下,sudo表示启用管理员权限,cp表示复制,就是把后面的sources.list文件复制一份,复制的文件以source.list.bak命名。

sudo cp sources.list sources.list.bak

在这里插入图片描述

2. 复制镜像源

因为不同的Ubuntu版本对应的镜像是不同的,所以需要复制的命令也不一致,大家可以根据自己的Ubuntu版本来复制命令。他们的命令是很相似的,区别就是括号里面不一样。点击下面挑战链接,复制对应的镜像源配置。镜像速度的话,这个看地区差异,不太好说。

Ubuntu22.04 清华镜像源链接

Ubuntu23.04 清华镜像源链接

Ubuntu22.10 清华镜像源链接

Ubuntu20.04 清华镜像源链接

Ubuntu18.04 清华镜像源链接

Ubuntu16.04 清华镜像源链接

Ubuntu22.04 阿里云镜像

Ubuntu20.04 阿里云镜像

Ubuntu软件仓库:

Ubuntu 22.04 LTS (jammy)镜像源:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src 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-src 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-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

Ubuntu 23.04 (lunar) 镜像源:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ lunar-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ lunar-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-proposed main restricted universe multiverse

Ubuntu 22.10 (kinetic):

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ kinetic-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ kinetic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic-proposed main restricted universe multiverse

Ubuntu 20.04 (focal):

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

Ubuntu 18.04 (bionic):

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

Ubuntu 16.04 (xenial) :

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

阿里云Ubuntu 22.04 软件仓库:

deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

阿里云Ubuntu 20.04 软件仓库:

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

3. 修改软件源配置文件

使用如下命令打开配置文件:

sudo vim source.list

打开该文件之后,使用命令ggdG将该文件内容删除,然后按a键编辑,把复制过来的清华镜像直接右键就可粘贴。

如下所示。

保存的话,需要切换到英文输入,先Esc,然后冒号:,再按wq保存退出即可。

在这里插入图片描述

4. 更新软件包列表,升级软件包等内容

更新软件包列表代码如下,可以看到Get的地址是阿里云的镜像。

sudo apt-get update

在这里插入图片描述

升级软件包如下命令:

sudo apt-get upgrade

在这里插入图片描述

5. 从仓库中下载其它软件

直接使用命令sudo apt-get install xxx就可以安装对应的xxx软件,

如下所示:

sudo apt-get install gedit
可能存在的问题

现在的清华镜像Ubuntu软件仓库,我使用学校教育网无法连接,不知道是因为我的ip问题,还是清华镜像仓库暂时不可用的问题。

个人觉得是因为我的ip段被清华的Ubuntu软件仓库拉黑了。。。

连接问题如下:

2 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/focal/InRelease  Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable) Could not connect to mirrors.tuna.tsinghua.edu.cn:443 (101.6.15.130), connection timed out
W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/focal-updates/InRelease  Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable)
W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/focal-backports/InRelease  Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable)
W: Some index files failed to download. They have been ignored, or old ones used instead.

因为使用清华镜像连接有错误,所以我现在使用阿里云镜像了。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1379345.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

深入理解UML中的继承关系

深入理解UML中的继承关系 在面向对象的设计中,继承关系是构建清晰、可维护系统的关键。统一建模语言(UML)提供了一种标准化的方法来可视化这些关系。本文将深入探讨UML中的继承关系,并探讨它如何在代码中体现。 什么是继承关系&a…

【AI大模型应用开发】1.1 Prompt Engineering(提示词工程)- 用OpenAI API实战,优化方法论总结

书接上文 【AI大模型应用开发】1.0 Prompt Engineering(提示词工程)- 典型构成、原则与技巧,代码中加入Prompt,我们开始实战。 文章目录 0. 从最简单的开始0.1 通用代码封装0.2 使用 - 从最简单的Prompt开始0.2.1 temperature参数…

Git新手?这篇文章带你飞!基础操作一网打尽!

推荐阅读 智能化校园:深入探讨云端管理系统设计与实现(一) 智能化校园:深入探讨云端管理系统设计与实现(二) 文章目录 推荐阅读Git初识Git啥是版本控制系统??集中式VS分布式 git使用…

Ubuntu 在线Swap扩容

1. 查看本机swap空间 free -h 2. 找一个较大的高速盘,创建swap的空间 mkdir /swap cd /swap sudo dd if/dev/zero ofswapfile bs50M count1k3.建swapfile,大小为bs*count 50M * 1k 50G 4.标记为Swap文件,让系统能识别交换文件。 sudo mk…

表单生成器基于(form-create-designer+ant design vue)

效果展示 1.源码地址: 前端:https://gitee.com/houshixin/form-design-ui 后端:https://gitee.com/houshixin/form-design-web 2.单独使用前端的时候就把请前后台的接口注释就可以 3.都启动的话: 1).先导入数据库 2.表…

统信UOS_麒麟KYLINOS与Windows通过Open SSH实现文件传输

原文链接:统信UOS/麒麟KYLINOS与Windows通过Open SSH实现文件传输 hello,大家好啊!今天我要给大家介绍的是在统信UOS或麒麟KYLINOS操作系统与Windows系统之间通过Open SSH实现文件传输的方法。在日常工作中,我们经常需要在不同操作…

【JUC】JAVA线程小结

Java线程 前言——阅读10-20分钟🎆1.创建和运行线程ThreadRunableFutureTask多个线程运行方式 📣2.不同操作系统查看进程线程的方法windowslinuxJava命令行 🚀3.java线程运行原理栈与栈帧线程上下文切换(Thread Context Switch&am…

word写标书的疑难杂症总结

最近在解决方案工作,与office工具经常打交道,各种问题,在此最下记录: 1.word中文档距离文档顶端有距离调整不了 1.疑难杂症问题1,多个空格都是不能解决 #解决办法:word中--布局-下拉框---“版式”--“垂直…

机器人持续学习基准LIBERO系列5——获取显示深度图

0.前置 机器人持续学习基准LIBERO系列1——基本介绍与安装测试机器人持续学习基准LIBERO系列2——路径与基准基本信息机器人持续学习基准LIBERO系列3——相机画面可视化及单步移动更新机器人持续学习基准LIBERO系列4——robosuite最基本demo 1.更改环境设置 LIBERO-master/l…

MagnificAI的爆火之下 - AI时代,伟大的公司只需要2个人

这两天,Magnific AI又被推上风口浪尖。 起因是他们发布了全新的功能:将任何图像放大并增强至10,000 x 10,000 像素。 传说中的4K超清,也就4096像素,但是Magnific AI可以将一张600像素糊成智障的图片,几分钟的时间&…

Springboot基层健康医院云HIS信息系统源码

基层卫生健康云HIS系统采用云端SaaS服务的方式提供,使用用户通过浏览器即能访问,无需关注系统的部署、维护、升级等问题,系统充分考虑了模板化、配置化、智能化、扩展化等设计方法,覆盖了基层医疗机构的主要工作流程,能…

近视的孩子用什么灯?学生考研护眼台灯推荐

随着时代快速发展,2022年我国近视人数达到了7亿,呈现低龄化趋势,儿童及青少年人数占了53.8%。现在学业负担都很重,每个家长都不希望自己的孩子近视或加深近视了,都会想尽一切办法保护视力。而护眼台灯就成了家长购买台…

不同activity项目创建时的区别

在 Android Studio 中创建项目时,可以选择创建不同类型的 Activity 作为应用程序的入口点。其中,包括 Empty Activity、Basic Activity、Empty Compose Activity 和 Basic Compose Activity 四种类型。 Empty Activity:这是最简单的 Activity…

agilent n9344c频谱分析仪20ghz

181/2461/8938产品概述: Agilent安捷伦N9344C手持频谱分析仪20GHz Agilent安捷伦N9344C手持频谱分析仪是当今最先进的频谱分析仪器之一,可以在20GHz的范围内对信号进行快速、准确的分析。它不仅具有出色的性能,还具有紧凑的外观和轻便的重量…

分享一个使用python FastApi创建服务的简易模版,与使用http/python请求

这个博客分享一个fastapi的模版,并提供使用http/python访问的示例程序 文章目录 示例程序FastApi应用程序HTTP请求Python请求 示例程序 FastApi应用程序 下面是一个示例: 默认开启一个可以使用Get请求访问的URL:/example_connect这个请求有…

2024年1月12日:清爽无糖rio留下唇齿之间的香甜

友利奈绪的时间管理 2024年1月12日08:02:28进行java程序设计的上课准备 2024年1月12日08:02:44知道java的题目有18道 2024年1月12日08:43:07随机数去重比较 2024年1月12日08:54:03C语言题目最小公倍数 2024年1月12日08:58:37C语言题目二维数组变一维数组 2024年1月12日10…

2024.1.11每日一题

LeetCode 2645.构造有效字符串的最少插入数 2645. 构造有效字符串的最少插入数 - 力扣(LeetCode) 题目描述 给你一个字符串 word ,你可以向其中任何位置插入 “a”、“b” 或 “c” 任意次,返回使 word 有效 需要插入的最少字…

SQL性能分析-整理

昨日对MySQL的索引整理了一份小文档,对结构/分类/语法等做了一个小总结,具体文章可点击:MySQL-索引回顾,索引知识固然很重要,但引入运用到实际工作中更重要。 参考之前的文章:SQL优化总结以及参考百度/CSDN…

【java八股文】之JVM基础篇

1、Java中都有哪些引用? 强引用 :发生GC时候不会被回收 软引用:发生内存满(内存溢出的时候)会被回收(通常用于缓存) 弱引用:发生下一次GC时候会被回收 虚引用:无法通过虚…

简单明了,汽车级LM317系列LM317D2TR4G线性电压稳压器电源设计-参数应用方案分享

低压差线性稳压器(LDO),是指一种具有恒定电流输出电压的装置,主要由输入变压器、整流器、输出变压器三部分构成,工业原理为将输入的交流电压经过整流、滤波后得到直流输出电压,再经过控制元件和开关器件将稳…