(共556篇)
全部分类

apt换源速记
[ Linux相关 ] 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# 先备份原有文件
cp /etc/apt/sources.list /etc/apt/sources.list.back

# 更新文件内容, 以下是清华源的案例
echo 'deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
' > /etc/apt/sources.list

# 更新apt软件包信息
apt update

到这一步会有报错信息

所有软件包都由软件包维护者使用一对由私钥和公钥组成的密钥签名。

用户的私钥是保密的,公钥可以提供给用户想要通信的任何人。

每当将新存储库添加到系统时,还必须添加存储库密钥,以便APT软件包管理器信任新添加的存储库。

添加存储库密钥后,可以确保从正确的来源获得软件包。

1
2
3
4
5
# 下面命令最后的key是从报错信息中获取
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3B4FE6ACC0B21F32

# 重新更新
apt update