关于sources.list和apt-get [转载]

来源:互联网 发布:手机淘宝怎么删除晒图 编辑:程序博客网 时间:2024/04/29 23:57

个人认为,Debian最大的方便在于用apt-get安装软件,apt-get的工作原理大概是这样的:/etc/apt/sources.list文件里保存着一些服务器的设置,在这些服务器上有大量的可以用于Debian的软件,比如我的sources.list是这个样子(为了简洁,这里先不介绍如何用vi编辑这个文件,在文章末尾会提到):
deb ftp://ftp.tsinghua.edu.cn/mirror/debian/debian unstable contrib main non-free
deb http://mirror.dlut.edu.cn/debian unstable main contrib non-free
deb http://mirror.dlut.edu.cn/debian-non-US unstable/non-US main contrib non-free
deb http://mirror.dlut.edu.cn/debian-security stable/updates main
deb http://debian.ustc.edu.cn/debian sid main non-free contrib
deb-src http://debian.ustc.edu.cn/debian sid main non-free contrib
deb http://debian.ustc.edu.cn/debian-non-US sid/non-US main non-free contrib
deb http://debian.ustc.edu.cn/debian-uo sid marillat java misc ustc
如果你是教育网用户,就可以把这些放在自己的sources.list里面;如果你是公众网用户,那么您可能需要向别的网友询问适合自己的服务器。

保存好自己的sources.list之后,我们需要以root身份运行一下apt-get update,这个命令的作用是让apt去sources.list中列出的服务器上下载一些信息到本地缓冲,这些信息使apt知道哪个服务器上有哪些软件,版本分别是什么,以后每次更改sources.list之后最好都运行一次apt-get update,使得更改生效。

安装软件用的命令是apt-get install,比如安装lumaqq(luma用java写的QQ),命令就是apt-get install lumaqq,没错,就是这么简单,完全不必沉浸于./configure,make,make install的苦海当中。

apt另一个常用方法就是apt-cache search xxx,这个命令会在本地缓冲里查找和xxx有关的软件。