解决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 <
> # 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进行命令的安装了。

你可能感兴趣的:(Linux)