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 找到会发现报错的网址就在此处并取消勾选

相关推荐
Tony6666888882 小时前
【Jenkins入门以及安装】
运维·jenkins
z涛.2 小时前
Docker容器
运维·docker·容器
不做菜鸟的网工2 小时前
FreeRadius认证 WIFI-WP2-Enterprise
运维
zmjjdank1ng2 小时前
Linux 流编辑器 sed 详解
linux·运维·前端·网络·入门
AI风老师2 小时前
7、docker |其余命令
linux·ubuntu·docker
Zenexus2 小时前
VSCODE+GDB+QEMU调试内核
linux·vscode·qemu·gdb
搬码临时工2 小时前
使用frp内网穿透实现远程办公
服务器·网络
鹧鸪云光伏3 小时前
[鹧鸪云]光伏AI设计平台解锁电站开发新范式
运维·服务器·人工智能·光伏·光伏设计
Zfox_3 小时前
Redis应⽤-缓存与分布式锁
服务器·数据库·redis·分布式·缓存
云和数据.ChenGuang3 小时前
Raft协议 一种专为分布式系统设计的共识算法
运维·服务器·算法·区块链·共识算法