apt-get instal Reading package lists... Done Building dependency tree 問題


今天遇見在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

解決!!!!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM