Linux修改源
使用’cat /etc/os-release’查看linux发行版本。
Ubuntu
- 修改apt源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15cd /etc/apt/
cp sources.list sources.list.backup
echo "">sources.list
echo "deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse" >> sources.list
echo "deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse" >> sources.list
echo "deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse" >> sources.list
echo "deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse" >> sources.list
echo "deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse" >> sources.list
echo "deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse" >> sources.list
echo "deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse" >> sources.list
echo "deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse" >> sources.list
echo "deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse" >> sources.list
echo "deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse" >> sources.list
更新
apt-get update
更新报错:GPG error:The following signatures couldn‘t be verified because the public
添加公钥
1 | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7EA0A9C3F273FCD8 |
Debian 11 换源
由于Docker容器大多数是Debain 11构建的,所以这里记录其换源方式
1 | cd /etc/apt/ |
Debian 10 换源
1 | cd /etc/apt/ |
参考资料
[1] https://www.jianshu.com/p/9d6b138e366f
[2] https://blog.csdn.net/qq_35383263/article/details/108549746
- Title: Linux修改源
- Author: Spring
- Created at : 2023-09-20 12:27:53
- Updated at : 2024-12-19 04:00:13
- Link: https://www.tecacc.com/2023/09/20/Linux修改源/
- License: This work is licensed under CC BY-NC-SA 4.0.