apt源
修改 APT 源
手动修改 sources.list
-
备份原文件:
1
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
-
编辑源文件:
1
sudo nano /etc/apt/sources.list
-
替换为官方源(以 Ubuntu 22.04 为例):
1
2
3
4deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse如需国内镜像,可替换为:
- 清华源:
1
2
3
4deb 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 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse - 阿里云源:
1
2
3
4deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
- 清华源:
替换完成后可以将
/etc/apt/sources.list.d
内的文件注释,可能会有其他源
- 更新软件列表:
1
2sudo apt clean
sudo apt update
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 HAHA!