linux debian 命令之 sudo apt-get update

次浏览

摘要:debian系统安装 gnome-core 时,无法直接通过 apt-get install 安装常用的包。提示root@U-NAS:/# apt-get install gnome-coreReading package lists... DoneBuilding depende...

debian系统安装 gnome-core 时,无法直接通过 apt-get install 安装常用的包。

 

提示

root@U-NAS:/# apt-get install gnome-core
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package gnome-core

输入 sudo apt-get update 命令之后,可以正常安装。

root@U-NAS:/# sudo apt-get update
Ign:1 http://mirrors.163.com/debian stretch InRelease
Get:2 http://mirrors.163.com/debian stretch Release [118 kB]
Get:3 http://mirrors.163.com/debian stretch Release.gpg [2,365 B]
Get:4 http://shanghai.unasmirror.com/debian callisto InRelease [5,510 B]
Get:5 http://mirrors.163.com/debian stretch/main amd64 Packages [7,086 kB]
Get:6 http://shanghai.unasmirror.com/debian callisto/main amd64 Packages [59.6 kB]
Get:7 http://shanghai.unasmirror.com/debian callisto/non-free amd64 Packages [10.8 kB]
Get:8 http://shanghai.unasmirror.com/debian callisto/contrib amd64 Packages [1,193 B]
Get:9 http://mirrors.163.com/debian stretch/main Translation-en [5,385 kB]                                  
Fetched 12.7 MB in 17s (733 kB/s)                                                                           
Reading package lists... Done

 

理解:

从运行过程可以看出,update读取所有源的软件列表,需要联网下载,作用是激活和更新源。

apt-get update 是同步 /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源的索引,这样才能获取到最新的软件包。

apt-get update 只是更新了 apt 的资源列表,没有真正的对系统执行更新。

如果需要,要使用 apt-get upgrade 来更新。

---------------------------------- THE END ----------------------------------

随机新闻