Chinaunix首页 | 论坛 | 博客
  • 博客访问: 104664
  • 博文数量: 23
  • 博客积分: 514
  • 博客等级: 中士
  • 技术积分: 195
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-01 14:21
文章分类

全部博文(23)

文章存档

2012年(23)

我的朋友

分类: LINUX

2012-01-26 10:20:53

apt-get命令在/etc/apt/sources.list 中的网址逐一查找要安装的软件。
sources.list文件列出了可以下载更新和软件的网址。
 
# sources.list
# deb cdrom:[Ubuntu 8.04.1 _Hardy Heron_ - Release amd64 (20080701)]/ hardy main restricted

#deb cdrom:[Ubuntu 8.04.1 _Hardy Heron_ - Release amd64 (20080701)]/ hardy main restricted
# See for how to upgrade to
# newer versions of the distribution.

deb hardy main restricted
deb-src hardy main restricted

deb hardy-updates main restricted
deb-src hardy-updates main restricted
#(hashes)开头的行为注释,其他为repository行。
  • deb: These repositories contain binaries or precompiled packages. These repositories are required for most users. (二进制或未编译的包)
  • deb-src: These repositories contain the source code of the packages. Useful for developers. (源代码包)
  • 可以手动添加repository(), 在更改/etc/apt/sources.list or /etc/apt/preferences 后需要用sudo apt-get update来更新sources.list

    apt-get 命令解释

    安装软件:

    apt-get install 软件包的名字

    apt-get build-dep 软件包的名字;安装软件包的依赖包

    apt-get -s install 软件包名;可以看到安装的细节

    aptitude 与apt-get 用法差不多,可以用man aptitude 来查看用法。

    auto-apt run ; 如果有程序需要还没安装的包,auto-apt将调用apt-get来安装这个包。

    apt-get upgrade ;更新已安装的软件包

    apt-get dist-upgrade; 升级系统到更高版本

    apt-get check;获取更新目录和检查有无依赖包错误。

    apt-get remove ;移除安装的文件

    apt-get purge ;完全移除,包括configure文件

    apt-get purge remove +;完全移除package1,安装package2

    apt-cache search ;查找包含的安装包

    dpkg -l **与apt-cache search 差不多,会列出是否已经安装(ii)或未安装(un)

    apt-cache show ;列出的相关信息

    dpkg -L ;列出包含的的文件

    dlocate ;列出包含的安装包

    apt-file search ;查找所有的包, 所在的目录

    apt-cache search filename | grep -w filename;will show only the files that contain filename as a whole word

    Ubuntuhelp上的例子;

    Typical usage example

    I want to feel the wind in my hair, I want the adrenaline of speed. So lets install a racing game. But what racing games are available?

    apt-cache search racing game

    It gives me a lot of answers. I see a game named "torcs". Lets get some more information on this game.

    apt-cache show torcs

    Hmmm... it seems interesting. But is this game not already installed on my computer? And what is the available version? Is it from Universe or main?

    apt-cache policy torcs

    Ok, so now, let's install it!

    apt-get install torcs

    What is the command I must type in the console to launch this game? In this example, it's straightforward ("torcs"), but that's not always the case. One way of finding the name of the binary is to look at what files the package has installed in "/usr/bin". For games, the binary will be in "/usr/games". For administrative programs, it's in "/usr/sbin".

    dpkg -L torcs | grep /usr/games/

    The first part of the command display all files installed by the package "torcs" (try it). With the second part, we ask to only display lines containing "/usr/games/". Hmmm, that game is cool. Maybe there are some extra tracks?

    apt-cache search torcs

    But I'm running out of space. I will delete the apt cache!

    apt-get clean

    Oh no, my mother asked me to remove all games from this computer. But I want to keep the configuration files so I can simply re-install it later.

    apt-get remove torcs

    If I want to also remove config files :

    apt-get purge torcs
    阅读(2097) | 评论(0) | 转发(0) |
    0

    上一篇:ubuntu 安装内核头文件

    下一篇:草稿

    给主人留下些什么吧!~~