Linux 在docker的nginx容器中安装vim报错 - E: Unable to locate package vim
报错信息
在docker的nginx容器中,向安装vim,结果报错
root@7365d9c2c7ea:/etc/nginx# apt-get install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package vim
解决方案
这种方法确实比较慢,
但是如果有兴趣看下面的心酸经历,
就会明白为啥这么慢我还采取这种解决方案 . . .
apt-get update
apt-get install apt-file
apt-file update
# now finally this will work !!!
apt-get install vim
解决心酸经历之.错误套娃 . . .
尝试解决"E: Unable to locate package vim",引发新的错误"The following signatures couldn't be verified because the public key is not available: NO_PUBKEY YYYYYYYYYYYYYYYY NO_PUBKEY XXXXXXXXXXXXXXXX"
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list
echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list
echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
root@7365d9c2c7ea:/etc/apt# apt-get update
Get:1 http://mirrors.aliyun.com/ubuntu xenial InRelease [247 kB]
Get:2 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease [109 kB]
Err:1 http://mirrors.aliyun.com/ubuntu xenial InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY YYYYYYYYYYYYYYYY NO_PUBKEY XXXXXXXXXXXXXXXX
Err:2 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY YYYYYYYYYYYYYYYY NO_PUBKEY XXXXXXXXXXXXXXXX
Reading package lists... Done
W: GPG error: http://mirrors.aliyun.com/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY YYYYYYYYYYYYYYYY NO_PUBKEY XXXXXXXXXXXXXXXX
E: The repository 'http://mirrors.aliyun.com/ubuntu xenial InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://mirrors.aliyun.com/ubuntu xenial-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY YYYYYYYYYYYYYYYY NO_PUBKEY XXXXXXXXXXXXXXXX
E: The repository 'http://mirrors.aliyun.com/ubuntu xenial-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
尝试解决"The following signatures couldn't be verified because the public key is not available: NO_PUBKEY YYYYYYYYYYYYYYYY NO_PUBKEY XXXXXXXXXXXXXXXX",引发新的错误"E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation"
//(这个公钥根据提示来写的)
gpg --keyserver keyserver.ubuntu.com --recv YYYYYYYYYYYYYYYY
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 'YYYYYYYYYYYYYYYY'
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 'XXXXXXXXXXXXXXXX'
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
错误套娃...
死循环了?
更换源,需要"apt-get update",
"apt-get update"需要"apt-key adv --...",
但是"apt-key adv --..."需要更换源 . . . ???
算了,还是去找第一个错误"E: Unable to locate package vim"的解决方案吧 . . .
直接FQ,第一条就成功解决...(就是慢一点)
apt-get update
apt-get install apt-file
apt-file update
apt-get install vim # now finally this will work !!!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了