阿里云官方
说明:https://developer.aliyun.com/mirror/ubuntu
操作参考:https://www.cnblogs.com/liujiaxin2018/p/16373668.html
查看linux系统版本 (本文是22.04)
lsb_release -a
查看结果
No LSB modules are available.
Distributor ID: Ubuntu
Description:Ubuntu 22.04
.2 LTS
Release: 22.04
Codename: jammy
替换国内源
备份原来
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
编辑
sudo vi /etc/apt/sources.list
复制对应配置覆盖 (见官网)
https://developer.aliyun.com/mirror/ubuntu
复制后,按键盘‘a’,进入编辑模型,然后复制下面文本,
Esc
切换为命令模式, dd
可以删除一行,d+数字+d 删除n行
Esc
切换为命令模式后。: wq
(冒号:一定要输入才能输入wq保存退出)
ubuntu 22.04 LTS (jammy) 配置如下
deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
ubuntu 20.04 LTS (focal) 配置如下
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
更新保存
sudo apt update