ubuntu 更新 apt 源

参考:https://mirrors.cnnic.cn/help/ubuntu/

sudo sed -i "s@http://.*archive.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
sudo sed -i "s@http://.*security.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list

apt update 报错:
在这里插入图片描述

解决方案

先改成 http 协议

sed -i "s@https://@http://@g" /etc/apt/sources.list
apt-get update

更新 ca证书

apt-get install --reinstall ca-certificates

重新改回 https

sed -i "s@http://@https://@g" /etc/apt/sources.list
apt-get update
root@6eaae8478f80:/# sed -i "s@https://@http://@g" /etc/apt/sources.list
root@6eaae8478f80:/# apt-get update
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease [265 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease [114 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease [108 kB]
Get:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security InRelease [114 kB]
Get:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:7 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:8 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 Packages [1275 kB]
Get:9 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/restricted amd64 Packages [1569 kB]
Get:10 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 Packages [2539 kB]
Get:11 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/multiverse amd64 Packages [30.2 kB]
Get:12 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 Packages [1176 kB]
Get:13 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/main amd64 Packages [55.2 kB]
Get:14 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/universe amd64 Packages [27.5 kB]
Get:15 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/restricted amd64 Packages [1461 kB]
Get:16 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/multiverse amd64 Packages [27.5 kB]
Get:17 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe amd64 Packages [888 kB]
Get:18 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main amd64 Packages [2087 kB]
Fetched 23.3 MB in 9s (2576 kB/s)
Reading package lists... Done
root@6eaae8478f80:/# apt-get install --reinstall ca-certificates
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libssl1.1 openssl
The following NEW packages will be installed:
  ca-certificates libssl1.1 openssl
0 upgraded, 3 newly installed, 0 to remove and 34 not upgraded.
Need to get 2085 kB of archives.
After this operation, 5796 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libssl1.1 amd64 1.1.1f-1ubuntu2.16 [1321 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 openssl amd64 1.1.1f-1ubuntu2.16 [621 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 ca-certificates all 20211016~20.04.1 [144 kB]
Fetched 2085 kB in 2s (1158 kB/s)        
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libssl1.1:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1f-1ubuntu2.16) ...
Selecting previously unselected package openssl.
Preparing to unpack .../openssl_1.1.1f-1ubuntu2.16_amd64.deb ...
Unpacking openssl (1.1.1f-1ubuntu2.16) ...
Selecting previously unselected package ca-certificates.
Preparing to unpack .../ca-certificates_20211016~20.04.1_all.deb ...
Unpacking ca-certificates (20211016~20.04.1) ...
Setting up libssl1.1:amd64 (1.1.1f-1ubuntu2.16) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up openssl (1.1.1f-1ubuntu2.16) ...
Setting up ca-certificates (20211016~20.04.1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Updating certificates in /etc/ssl/certs...
127 added, 0 removed; done.
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for ca-certificates (20211016~20.04.1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
root@6eaae8478f80:/# sed -i "s@http://@https://@g" /etc/apt/sources.list
root@6eaae8478f80:/# apt-get update
Hit:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
Hit:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease
Hit:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease
Hit:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security InRelease
Reading package lists... Done
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Ubuntu国内apt有以下几种常用的选择: 1. 清华大学开软件镜像站(mirrors.tuna.tsinghua.edu.cn):这是国内较为知名且稳定的Ubuntu镜像站点之一。提供了全系列的Ubuntu发行版和官方软件包的下载。 2. 国科大开软件镜像站(mirrors.ustc.edu.cn):国科大的Ubuntu镜像站点也很常用,提供了多个版本的Ubuntu以及其他开软件包的下载。 3. 阿里云开镜像站(mirrors.aliyun.com):阿里云也提供了Ubuntu的开软件包,可以选择该进行安装和更新软件。 4. 网易163开镜像站(mirrors.163.com):这是一个较为老牌的镜像站点,在国内用户中也比较常用。提供了Ubuntu等多个开软件的下载。 除了以上几个常用的镜像站点外,还有一些其他的个人搭建的镜像站点可以选择。但需要注意的是,无论是使用哪个镜像站点,都应该选择稳定可靠的,并且及时更新列表以保证软件的安全性和稳定性。 ### 回答2: Ubuntu 是一个流行的 Linux 发行版,它的软件包管理系统使用 APT(Advanced Package Tool)。在国内,由于访问国外服务器可能存在网络延迟或限制,许多用户选择使用国内的 apt 来加快软件包下载速度。以下是几个常见的国内 apt : 1. 清华大学 TUNA :清华大学开软件镜像站(https://mirrors.tuna.tsinghua.edu.cn/)提供了全系列的 Ubuntu 版本的 apt ,包括最新版和历史版本。用户可以根据需要选择不同版本和架构的。 2. 中国科学技术大学 USTC :中国科学技术大学开软件镜像站(https://mirrors.ustc.edu.cn/)也提供了全系列的 Ubuntu 版本的 apt 。该在国内用户中也很受欢迎,提供了快速可靠的下载服务。 3. 阿里云:阿里云(https://opsx.alibaba.com/mirror)也提供了 Ubuntu 官方的镜像服务。用户可以在该中选择最新版本的 Ubuntu,同时也包括了一些其他 Linux 发行版的镜像。 4. 163 :网易(https://mirrors.163.com/)也提供了 Ubuntuapt 镜像服务。用户可以根据需要选择最新版本或历史版本的。 通过使用这些国内 apt ,用户可以更快速地下载 Ubuntu 的软件包,减少网络延迟,提高软件更新和安装的效率。值得注意的是,为了保证软件安全性,建议从可信的进行下载,并经常更新软件包以获取最新的安全和功能修复。 ### 回答3: Ubuntu国内的APT有以下几个: 1.清华大学开软件镜像站:Ubuntu官方镜像的一个非官方的镜像站点,提供Ubuntu的各个版本的软件包下载。该镜像站点速度快,并且定期同步官方。 2.阿里云:阿里云提供了一个专门针对中国市场的Ubuntu APT,提供了快速、稳定的软件包下载服务。用户可以通过修改Ubuntu地址为阿里云来加速软件更新和安装。 3.中科大:中国科学技术大学也提供了一个Ubuntu APT,可以从中科大中下载和安装Ubuntu相关的软件包。该站点也是一个非常稳定和快速的镜像。 除了以上的几个APT,还有一些其他的非官方,如华为、网易等。这些站点的速度和稳定性可能有所差异,用户可以根据自己的需求选择合适的。 总的来说,国内有多个可选的APT,用户可以根据自己的需求选择合适的来进行软件包的下载和更新

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值