解决Debian环境无法update更新源问题

更多IT技术文章,欢迎关注微信公众号:运维之美,一个涨姿势的公众号

创建了一个docker,但是vim等基础命令都没有安装,使用apt-get update命令更新源出现如下报错
报错一

root@26eac251281c:/var/lib/apt#  apt-get update
Get:1 http://mirrors.sohu.com precise-updates InRelease [8 B]
Ign http://mirrors.sohu.com precise InRelease                                                                                                                                     
Get:2 http://mirrors.sohu.com precise-backports InRelease [8 B]                                                                                                                   
81% [1 InRelease gpgv 8 B] [Waiting for headers] [Waiting for headers]                                                                                                    1 B/s 0sSIgn http://mirrors.sohu.com precise-updates InRelease                                                                                                                             
E: GPG error: http://mirrors.sohu.com precise-updates InRelease: Clearsigned file isn't valid, got 'NODATA' (does the network require authentication?)

报错二

E: Some index files failed to download. They have been ignored, or old ones used instead.

最后修改成如下源解决

root@26eac251281c:/# cat /etc/apt/sources.list
# deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster main
deb http://deb.debian.org/debian buster main
# deb http://snapshot.debian.org/archive/debian-security/20200607T000000Z buster/updates main
deb http://security.debian.org/debian-security buster/updates main
# deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster-updates main
deb http://deb.debian.org/debian buster-updates main

由于docker中暂时没有安装vim,我们可以先通过cat命令追加的方式添加源

root@26eac251281c:/# cat >/etc/apt/sources.list <<EOF
> # deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster main
> deb http://deb.debian.org/debian buster main
> # deb http://snapshot.debian.org/archive/debian-security/20200607T000000Z buster/updates main
> deb http://security.debian.org/debian-security buster/updates main
> # deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster-updates main
> deb http://deb.debian.org/debian buster-updates main
> EOF

也可以尝试修改为如下源

# deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster main
deb http://deb.debian.org/debian buster main
# deb http://snapshot.debian.org/archive/debian-security/20200607T000000Z buster/updates main
deb http://security.debian.org/debian-security buster/updates main
# deb http://snapshot.debian.org/archive/debian/20200607T000000Z buster-updates main
deb http://deb.debian.org/debian buster-updates main

最后在执行apt-get update成功,此时你可以通过apt-get install vim进行命令的安装了。

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
引用中提供了一种修改的方式,其中包括了设置了两个deb,一个是主要的deb,另一个是安全更新的deb。而引用中的方式与引用中的方式基本相同,只是将注释掉的删掉了。而引用中提供了一种通过cat命令追加的方式添加的方法。 根据提供的链接地址http://security.debian.org/debian-security buster/updates/main,它是一个安全更新的deb。在Debian系统中,安全更新是由Debian安全团队维护的,用于修复已知漏洞和安全问题的软件包。 要将此添加到系统中,可以按照以下步骤操作: 1. 打开终端或命令行界面。 2. 使用root权限登录或使用sudo命令以管理员身份运行命令。 3. 打开/etc/apt/sources.list文件进行编辑。 4. 将提供的链接地址添加到文件的末尾,保存并关闭文件。 5. 更新apt软件包列表,以使新的生效。 请注意,修改可能会对系统的稳定性和安全性产生影响。在进行任何更改之前,请确保了解所做更改的影响,并备份重要的系统文件。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [解决Debian环境无法update更新问题](https://blog.csdn.net/m0_37680131/article/details/106884204)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

运维之美@

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值