apt-get instal Reading package lists... Done Building dependency tree 问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yoloyy/article/details/79950496

今天遇见在docker,新建一个容器遇见了这样一个问题。下载nginx 的时候,
root@114e9c6168c0:/# apt-get install -y nginx
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package nginx

问题:为什么会 Unable to locate package nginx

回答:apt-get 源里面没有nginx 包

解决办法 1、apt-get update 更新本地源

解决办法 2、更新源

1、原文件重命名备份
sudo mv /etc/apt/sources.list /etc/apt/source.list.bak 
2、编辑源列表文件
sudo vim /etc/apt/sources.list
3、复制

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

4、更新
sudo apt-get update
sudo apt-get upgrade

解决!!!!

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页