【Linux】Linux换源

前言

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

步骤

1.lsb_release -a 查询系统版本号
2. 备份原始源列表sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
3. 修改sources.list
sudo vim /etc/apt/sources.list
4. 将内容替换成对应的源
在这里插入图片描述

**PS:清华源阿里源 **

  • 根据系统赋值对应的源
  • sources.list是一个普通可编辑的文本文件,保存了ubuntu软件更新的源服务器的地址
  • sources.list.d/.list是在单独文件中写入源的地址提供了一种方式,通常用来安装第三方的软件.*
    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 找到会发现报错的网址就在此处并取消勾选
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值