报错信息
在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 !!!