Linux换源

前言

安装完Linux系统,尽量更换源以提高安装软件的速度。

步骤

  1. 备份原始源列表sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
  2. 修改sources.list
    sudo vim /etc/apt/sources.list
  3. 将内容替换成对应的源

**PS:清华源地址:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/ **

(根据系统赋值对应的源)

4.更新并升级
sudo apt-get update && sudo apt-get upgrade

Q&A

问题1

遇到sudp apt-get update错误
liuxinyu20@ubuntu:~$ sudo apt-get update Hit:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease Hit:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease Hit:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease Hit:1 https://packages.microsoft.com/repos/code stable InRelease Hit:5 http://security.ubuntu.com/ubuntu focal-security InRelease Err:6 https://download.docker.com/linux/ubuntu focal InRelease Cannot initiate the connection to download.docker.com:443 (2a03:2880:f12c:183:face:b00c:0:25de). - connect (101: Network is unreachable) Could not connect to download.docker.com:443 (162.220.12.226). - connect (111: Connection refused) Reading package lists... Done W: Failed to fetch https://download.docker.com/linux/ubuntu/dists/focal/InRelease Cannot initiate the connection to download.docker.com:443 (2a03:2880:f12c:183:face:b00c:0:25de). - connect (101: Network is unreachable) Could not connect to download.docker.com:443 (162.220.12.226). - connect (111: Connection refused) W: Some index files failed to download. They have been ignored, or old ones used instead.

解决方法:

1.进入/etc/apt/sources.list.d/ 目录 ,删除 docker.list 和 docker.list.save文件

复制代码
cd /etc/apt/sources.list.d/
sudo rm -f docker.list
sudo rm -f docker.list.save

2.依次找到 Software & Updates -> Other SoftWare 找到会发现报错的网址就在此处并取消勾选

相关推荐
iteye_99391 小时前
让 3 个线程串行的几种方式
java·linux
渡我白衣1 小时前
Linux操作系统:再谈虚拟地址空间
linux
阿巴~阿巴~2 小时前
Linux 第一个系统程序 - 进度条
linux·服务器·bash
小白爱电脑2 小时前
什么是2.5G交换机?
运维·网络·5g·千兆宽带
?ccc?2 小时前
容器技术技术入门与 Docker 环境部署
运维·docker·容器
时时刻刻看着自己的心2 小时前
docker启动报错
运维·docker·容器
DIY机器人工房2 小时前
代码详细注释:通过stat()和lstat()系统调用获取文件的详细属性信息
linux·嵌入式
我科绝伦(Huanhuan Zhou)2 小时前
华为泰山服务器重启后出现 XFS 文件系统磁盘“不识别”(无法挂载或访问),但挂载点目录仍在且无数据
运维·服务器·华为
匆匆那年9673 小时前
Docker容器中安装MongoDB,导入数据
运维·docker·容器
望获linux3 小时前
【Linux基础知识系列】第四十三篇 - 基础正则表达式与 grep/sed
linux·运维·服务器·开发语言·前端·操作系统·嵌入式软件