ubuntu换源

article/2025/8/24 8:22:09

ubuntu源

  • ubuntu换源方法
      • 1. 图形界面配置(新手推荐)
      • 2. 手动更改配置文件
        • 2.1 命令行替换
        • 2.2 手动替换
  • ubuntu的镜像源
      • 阿里源
      • 清华源
      • 中科大源

ubuntu换源方法

1. 图形界面配置(新手推荐)

依次打开:系统设置,软件和更新。在下载自中选择其他站点,然后在中国的条目下选择 mirrors.ustc.edu.cn

下面是 Ubuntu 16.04 的操作示意图(以中科大源为例):
在这里插入图片描述

2. 手动更改配置文件

一般情况下,将/etc/apt/sources.list文件中 Ubuntu 默认的源地址http://archive.ubuntu.com/替换为http://mirrors.ustc.edu.cn/即可。(注意:替换后的网址为中科大源网址,如需更换为其他源,请替换为相应源的网址。)

2.1 命令行替换

可以使用如下命令:

sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list

Ubuntu 图形安装器会根据用户设定的时区推断 locale,这导致默认的源地址通常不是http://archive.ubuntu.com/,而是http://<country-code>.archive.ubuntu.com/ubuntu/,如http://cn.archive.ubuntu.com/ubuntu/,此时只需将上面的命令进行相应的替换即可,即sudo sed -i 's/cn.archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list

当然也可以直接编辑 /etc/apt/sources.list 文件(需要使用 sudo)。以下是 Ubuntu 20.04 参考配置内容:

2.2 手动替换

直接编辑/etc/apt/sources.list文件(需要使用 sudo):
将原文件做备份:

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

打开文件:

sudo gedit /etc/apt/sources.list

将文件中的内容删除,将镜像源复制到里面。镜像源参考下一章节ubuntu镜像源。

点击保存(或Ctrl+s)。

更新:

sudo apt-get update

ubuntu的镜像源

每个版本的代号:

  • 22.04:jammy;
  • 20.04:focal;
  • 18.04:bionic;
  • 16.04:xenial;
  • 14.04:trusty。

阿里源

ubuntu16.04配置如下:

deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial maindeb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates maindeb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universedeb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

ubuntu18.04(bionic)配置如下:

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

ubuntu 20.04(focal) 配置如下:

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiversedeb 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 multiversedeb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

清华源

ubuntu16.04配置如下:

# 默认注释了源码镜像以提高 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 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/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

ubuntu18.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 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/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 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 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/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 20.04 参考配置内容:

# 默认注释了源码仓库,如有需要可自行取消注释
deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiversedeb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiversedeb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiversedeb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse# 预发布软件源,不建议启用
# deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multivers

http://chatgpt.dhexx.cn/article/k6p51c3b.shtml

相关文章

Ubuntu换源的两种方法

Ubuntu系统自带的是国外的源,咱们国内用户使用的时候下载文件特别的慢,所以我们需要更换国内镜像源,这里我列举两个换源的方法,如果有新的方法可以在评论区补充。 首先第一步 我们需要更改root密码 sudo passwd root命令行: 首先备份源 也可以不备份 sudo cp /etc/apt/sou…

ubuntu更换源(清华源)并更新系统

首先更新自己需要的源 &#xff08;1&#xff09;打开清华园官网https://mirrors.tuna.tsinghua.edu.cn/&#xff1a; &#xff08;2&#xff09;搜索Ubuntu&#xff1a; &#xff08;3&#xff09;点击旁边的问号&#xff1a; &#xff08;4&#xff09;选择自己ubuntu的版…

Ubuntu更换国内源(apt更换源)

网上的教程大部分都是文本命令行的方式更换国内源的&#xff0c;其实Ubuntu18.04也提供了图形界面的方式&#xff0c;这里主要讲图形界面的方式&#xff0c;毕竟点点鼠标就能完成的事儿谁愿意去输命令啊&#xff0c;而且还容易出错&#xff0c;当然这里也附上命令行的方式。 可…

ubuntu换镜像源(ubuntu换源)

换源 Ubuntu中 大部分 的软件 安装/更新 都是利用 apt命令&#xff0c;从ubuntu的服务器 直接安装的 Ubuntu官方的服务器在国外&#xff0c;为了提高软件 安装/更新速度&#xff0c;ubuntu提供了 选择最佳服务器 的功能&#xff0c;可以帮助我们方便的找到一个速度最快的 镜像…

使用多线程往LIST添加数据 线程安全list

我们在日常写代码的过程中&#xff0c;经常会使用多线程提高效率&#xff0c;我们在使用多线程过程中难免会出现往List集合修改数据。 下面我们来尝试一下往ArrayList 添加数据&#xff1a; public static void main(String[] args) {List<Integer> list new ArrayList…

集合线程安全

集合线程安全 常用的集合类型如ArrayList&#xff0c;HashMap&#xff0c;HashSet等&#xff0c;在并发环境下修改操作都是线程不安全的&#xff0c;会抛出java.util.ConcurrentModificationException异常&#xff0c;这节主要记录如何在并发环境下安全地修改集合数据。 List…

线程安全的遍历list

遍历List的多种方式 在讲如何线程安全地遍历List之前&#xff0c;先看看通常我们遍历一个List会采用哪些方式。 方式一&#xff1a; for(int i 0; i < list.size(); i) {System.out.println(list.get(i)); } 方式二&#xff1a; Iterator iterator list.iterator(); while…

List的线程安全

List的线程安全 背景实验1. ArrayList2. synchronizedList3. 运行抛出异常ArrayIndexOutOfBoundsException异常原因 背景 Q&#xff1a;今天遇到一个场景&#xff0c;我们业务需要使用批量的数据进行操作&#xff0c;但是别人的接口只支持一个一个的查&#xff0c;所以需要用多…

线程安全 List 效率测试

List 常见类以及各自优缺点可自行参考 https://blog.csdn.net/weixin_39883065/article/details/111197724 本机环境 java 版本&#xff1a;1.8.0_161 window 信息&#xff1a; 测试代码 下面通过代码测试 List 线程安全类 Vector、Collections.synchronizedList(List lis…

三种线程安全的List

在单线程开发环境中&#xff0c;我们经常使用ArrayList作容器来存储我们的数据&#xff0c;但它不是线程安全的&#xff0c;在多线程环境中使用它可能会出现意想不到的结果。 多线程中的ArrayList&#xff1a; 我们可以从一段代码了解并发环境下使用ArrayList的情况&#xff…

线程安全的List

线程安全的List Vector类的架构基本属性构造方法基本方法 SynchronizedList和SynchronizedRandomAccessListCollections.synchronizedList构造方法具体方法具体使用 CopyOnWriteArrayList(**)简介结构成员变量常见方法add (***)removeget CopyOnWriteArrayList总结 总结 在我们…

Git - 拉取远程分支并创建本地分支

一、查看远程分支 使用如下git命令查看所有远程分支 git branch -r 查看远程和本地所有分支 git branch -a 查看本地分支 git branch 在输出结果中&#xff0c;前面带* 的是当前分支 二、拉取远程分支并创建本地分支 方法一 使用如下命令 git checkout -b 本地分支名…

Git获取远程分支文件并创建自己的远程分支

Git获取远程分支文件并创建自己的远程分支 1、前期准备软件&#xff1a;git-bash 2、获取远程分支文件过程 创建一个空的文件夹&#xff0c;选择文件夹&#xff0c;并右击&#xff0c;选择该选项打开命令行。 复制需要拉取的远程仓库地址。 &#xff08;2&#xff09;把maste…

git基于远程分支创建本地分支

git基于远程分支创建本地分支 1.首先 git branch -a 查看所有的分支 2.使用 git checkout -b 本地分支名 远程分支名 https://blog.csdn.net/north1989/article/details/116299912?utm_mediumdistribute.pc_relevant.none-task-blog-baidujs_baidulandingword-0&spm1001.…

git 创建本地分支及远程分支并且关联分支

git命令在创建本地分支及远程分支并且关联远程分支 为了便于版本的维护及管理将会不断的在master分支上创建出新的分支 大致分为: 首先切换到在要开的分支上――――>创建本地分支――――>创建远程分支――――>切换到本地分支――――>将本地分支与远程分支关联…

git 创建远程分支,并提交代码到该分支的操作

1. 首先&#xff0c;在本地创建这个分支 使用命令 git checkout -b 分支名 &#xff08;表示创建这个分支&#xff0c;并且切换到该分支&#xff09; 2. 创建远程分支 使用命令 git push --set-upstream origin 分支名 &#xff08;表示将分支推送到远程仓库&#xff09; 3. …

git创建远程分支并关联本地分支

场景一&#xff1a; 本地、远程都没有分支 "v1.0.0" 1. 先查看确认一下&#xff0c;命令&#xff1a; git branch -a 2. 创建本地分支&#xff0c;命令&#xff1a; git checkout -b v1.0.0 3. 创建远程分支&#xff0c;并且本地分支关联远程分支&#xff0c;命令…

Git 创建远程分支并提交代码到远程分支

1、可以通过git branch -r 命令查看远端库的分支情况 2、从已有的分支创建新的分支(如从master分支),创建一个dev分支 但此时并没有在远程仓库上创建分支 如图所示 还是只有一个master分支 3、建立本地到远端仓库的链接 --这样代码才能提交上去 使用命令行 git push --set-…

Git创建远程分支并提交代码到远程分支

1、可以通过git branch -r 命令查看远端库的分支情况 动图演示&#xff08;选择项目右键选择 Git Bash Here&#xff0c;然后输入命令git branch -r&#xff09;&#xff1a; 2、从已有的分支创建新的分支(如从master分支),创建一个dev分支 但此时并没有在远程仓库上创建分支 如…

机器学习知识经验分享之三:基于卷积神经网络的经典目标检测算法

文章目录 前言一、一阶段目标检测算法1.YOLO系列算法2.SSD检测算法3. RetinaNet检测算法 二、两阶段目标检测算法1.Faster R-CNN检测算法2.Mask R-CNN检测算法3.Cascade R-CNN检测算法 总结 前言 本系列文章将对机器学习知识进行分享总结。便于大家从理论层面了解人工智能基础…