ubuntu系统(2):ubuntu20.04更换为国内清华源

目录

一、sudo apt install XX时提示找不到软件包或time out

二、更新为国内清华源

1、根据自己的虚拟机版本选择源码源

2、修改配置文件

3、更新其中的源网址

4、更新软件列表和升级


一、sudo apt install XX时提示找不到软件包或time out

ubuntu系统(2):ubuntu20.04更换为国内清华源_第1张图片

二、更新为国内清华源

1、根据自己的虚拟机版本选择源码源

ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

lsb_release -a  //查看ubuntu版本

我的是20.04版本。复制下面的这段代码。

ubuntu系统(2):ubuntu20.04更换为国内清华源_第2张图片

2、修改配置文件

vi /etc/apt/sources.list

3、更新其中的源网址

不建议现在的大多数教程中的直接将原来的源码备份后在原文件中删掉,这样可以以后要用的时候就找不到了。

所以我选择将原本的注释掉,然后在开头复制。

vim中Del后,命令行输入“:wq”保存并退出。

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

4、更新软件列表和升级

sudo apt-get update
sudo apt-get upgrade

换了清华源,更新时直接从国内镜像站获取软件包,更新速度会快很多。

你可能感兴趣的:(linux系统,ubuntu系统,ubuntu,linux,运维)