Debian系统更新apt源

天涯浪子 提交于 2020-01-23 02:00:09

docker search了一个tomcat的镜像,发现是Debian系统,里面啥啥命令都没有,使用的这个难受啊,于是,强迫症犯了,要安装相应软件,在容器里做实验用。

执行安装命令:

apt-get install vim

报错:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package vim

检查安装源文件:

cat /etc/apt/sources.list

源文件内容如下:

# deb http://snapshot.debian.org/archive/debian/20191224T000000Z stretch main
deb http://deb.debian.org/debian stretch main
# deb http://snapshot.debian.org/archive/debian-security/20191224T000000Z stretch/updates main
deb http://security.debian.org/debian-security stretch/updates main
# deb http://snapshot.debian.org/archive/debian/20191224T000000Z stretch-updates main
deb http://deb.debian.org/debian stretch-updates main

进行编辑:

vim /etc/apt/sources.list

显示:

bash: vim: command not found

在执行:

vi /etc/apt/sources.list

显示:

bash: vi: command not found

奶腿啊,啥命令都没有,啊啊啊啊啊啊啊!!!!

在这里插入图片描述
看来只好使用echo命令了,还好有这个命令!!
找了个163的源文件,搞进去。

echo 'deb http://mirrors.163.com/debian/ jessie main non-free contrib' > /etc/apt/sources.list

看看搞进去没

cat /etc/apt/sources.list

在这里插入图片描述
好,更新下缓存内容

apt-get update

在这里插入图片描述
完活,安装要使用的命令工具包:

apt-get install net-tools

在这里插入图片描述
终于可以安装要使用的命令了,搞完收工!!!
在这里插入图片描述

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!