Debian 更换软件源

Ubuntu 20.4 LTS 更换软件源

  • 更换阿里云软件源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 备份配置文件
# cp /etc/apt/sources.list /etc/apt/sources.list.bak

# 清空配置文件内容
# echo "" > /etc/apt/sources.list

# 编辑配置文件,添加以下内容
# vi /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  • 使阿里云软件源生效
1
2
# 更新软件索引
# apt-get update

Debian 9(Stretch)更换软件源

  • 更换阿里云软件源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 备份配置文件
# cp /etc/apt/sources.list /etc/apt/backup.sources.list

# 清空配置文件内容
# echo "" > /etc/apt/sources.list

# 编辑配置文件,添加以下内容
# vi /etc/apt/sources.list

deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
  • 使阿里云软件源生效(必须)
1
2
# 更新软件索引
# apt-get update
  • 更新软件和系统(非必须,请谨慎操作)
1
2
3
4
5
# 升级系统里的所有软件
# apt-get upgrade

# 升级系统版本
# apt-get dist-upgrade

Debian 11(Bullseye)更换软件源

  • 更换 163 软件源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 备份配置文件
# cp /etc/apt/sources.list /etc/apt/backup.sources.list

# 清空配置文件内容
# echo "" > /etc/apt/sources.list

# 编辑配置文件,添加以下内容
# vi /etc/apt/sources.list

deb http://mirrors.163.com/debian/ bullseye main non-free contrib
deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib
deb http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib
  • 使 163 软件源生效(必须)
1
2
# 更新软件索引
# apt-get update
  • 更新软件和系统(非必须,请谨慎操作)
1
2
3
4
5
# 升级系统里的所有软件
# apt-get upgrade

# 升级系统版本
# apt-get dist-upgrade