常用的包管理工具有:apt、apt-get、apt-cache、apt-file、aptitude、dpkg等。功能有重复的,挑顺手的即可。

1、apt

# apt --help

list - list packages based on package names
search - search in package descriptions
show - show package details
update - update list of available packages
install - install packages
remove - remove packages
upgrade - upgrade the system by installing/upgrading packages
full-upgrade - upgrade the system by removing/installing/upgrading packages
# apt search docker
Sorting... Done
Full Text Search... Done
docker/stable 1.5-1 amd64
System tray for KDE3/GNOME2 docklet applications docker-ce/jessie,now 17.03.1~ce-0~debian-jessie amd64 [installed]
Docker: the open-source application container engine karbon/stable 1:2.8.5+dfsg-1+b2 amd64
vector graphics application for the Calligra Suite kdocker/stable 4.6-2 amd64
lets you dock any application into the system tray python-docker/stable 0.5.3-1 all
Python wrapper to access docker.io's control socket python3-docker/stable 0.5.3-1 all
Python 3 wrapper to access docker.io's control socket ruby-docker-api/stable 1.10.10-1 all
Ruby gem to interact with docker.io remote API vim-syntax-docker/now 1.6.2~dfsg1-1~bpo8+1 all [installed,local]
Docker container engine - Vim highlighting syntax files
# apt list docker
Listing... Done
docker/stable 1.5-1 amd64
# apt list docker-ce -a
Listing... Done
docker-ce/jessie,now 17.03.1~ce-0~debian-jessie amd64 [installed]
docker-ce/jessie 17.03.0~ce-0~debian-jessie amd64

2、apt-get

# apt-get --help

apt-get is a simple command line interface for downloading and installing packages.
The most frequently used commands are update and install. update - Retrieve new lists of packages
upgrade - Perform an upgrade
install - Install new packages (pkg is libc6 not libc6.deb)
remove - Remove packages
autoremove - Remove automatically all unused packages
purge - Remove packages and config files
source - Download source archives
build-dep - Configure build-dependencies for source packages
dist-upgrade - Distribution upgrade, see apt-get(8)
dselect-upgrade - Follow dselect selections
clean - Erase downloaded archive files
autoclean - Erase old downloaded archive files
check - Verify that there are no broken dependencies
changelog - Download and display the changelog for the given package
download - Download the binary package into the current directory -d Download only - do NOT install or unpack archives
-s No-act. Perform ordering simulation
-y Assume Yes to all queries and do not prompt
-f Attempt to correct a system with broken dependencies in place

3、apt-cache

# apt-cache --help

apt-cache is a low-level tool used to query information from APT's binary cache files

search - Search the package list for a regex pattern
show - Show a readable record for the package
# apt-cache search docker
karbon - vector graphics application for the Calligra Suite
docker - System tray for KDE3/GNOME2 docklet applications
kdocker - lets you dock any application into the system tray
python-docker - Python wrapper to access docker.io's control socket
python3-docker - Python 3 wrapper to access docker.io's control socket
ruby-docker-api - Ruby gem to interact with docker.io remote API
docker-ce - Docker: the open-source application container engine
vim-syntax-docker - Docker container engine - Vim highlighting syntax files

4、apt-file

# apt-file --help

update                              Fetch Contents files from apt-sources.
search|find <pattern> Search files in packages
list|show <pattern> List files in packages
purge Remove cache files --ignore-case -i Ignore case distinctions
--package-only -l Only display packages name
--sources-list -s <file> sources.list location

查找命令或文件来自哪个package(包括已安装的和未安装的),dpkg -S 只会搜索已安装的package。

这里跟yum provides相比体验还是差了不少,这里匹配正则pattern,会列出所有包含关键字的文件,列出众多文件之后还需要过滤,而yum provides会直接列出包含文件的package。

# aptitude install apt-file     安装apt-file,默认没有安装
# apt-file update 更新索引 # apt-file find docker | grep docker$
ansible: /usr/share/ansible/cloud/docker
docker: /usr/bin/wmdocker
docker: /usr/share/menu/docker
docker-ce: /etc/bash_completion.d/docker
docker-ce: /etc/default/docker
docker-ce: /etc/init.d/docker
docker-ce: /usr/bin/docker
docker-ce: /usr/share/zsh/vendor-completions/_docker
kdocker: /etc/bash_completion.d/kdocker
kdocker: /usr/bin/kdocker
kdocker: /usr/share/menu/kdocker
zsh-common: /usr/share/zsh/functions/Completion/Linux/_docker # apt-file find docker | grep dockerd$
docker-ce: /usr/bin/dockerd

5、aptitude

# aptitude --help

install      - Install/upgrade packages.
remove - Remove packages.
purge - Remove packages and their configuration files.
forbid-version - Forbid aptitude from upgrading to a specific package version.
update - Download lists of new/upgradable packages.
safe-upgrade - Perform a safe upgrade.
full-upgrade - Perform an upgrade, possibly installing and removing packages.
search - Search for a package by name and/or expression.
show - Display detailed information about a package.
versions - Displays the versions of specified packages.
clean - Erase downloaded package files.
autoclean - Erase old downloaded package files.
changelog - View a package's changelog.
download - Download the .deb file for a package.
reinstall - Download and (possibly) reinstall a currently installed package. -s Simulate actions, but do not actually perform them.
-d Only download packages, do not install or remove anything.
-P Always prompt for confirmation of actions.
-y Assume that the answer to simple yes/no questions is 'yes'.
-V Show which versions of packages are to be installed.
-v Display extra information. (may be supplied multiple times).
# aptitude search docker
p docker - System tray for KDE3/GNOME2 docklet applications
i docker-ce - Docker: the open-source application container engine
p kdocker - lets you dock any application into the system tray
p python-docker - Python wrapper to access docker.io's control socket
p python3-docker - Python 3 wrapper to access docker.io's control socket
p ruby-docker-api - Ruby gem to interact with docker.io remote API
i vim-syntax-docker - Docker container engine - Vim highlighting syntax files
# aptitude show docker-ce
Package: docker-ce
New: yes
State: installed
Automatically installed: no
Version: 17.03.1~ce-0~debian-jessie
Priority: optional
Section: admin
Maintainer: Docker <support@docker.com>
Architecture: amd64
Uncompressed Size: 87.8 M
Depends: iptables, init-system-helpers (>= 1.18~), libapparmor1 (>= 2.6~devel), libc6 (>= 2.17), libdevmapper1.02.1 (>= 2:1.02.90), libltdl7 (>= 2.4.2), libsystemd0
Recommends: aufs-tools, ca-certificates, cgroupfs-mount | cgroup-lite, git, xz-utils
Conflicts: docker (< 1.5~), docker-ee, docker-engine, docker-engine-cs, docker.io, lxc-docker, lxc-docker-virtual-package
Replaces: docker-engine
Description: Docker: the open-source application container engine
Docker is an open source project to build, ship and run any application as a lightweight container Docker containers are both hardware-agnostic and platform-agnostic. This means they can run anywhere, from your laptop to the largest EC2 compute instance and everything in
between - and they don't require you to use a particular language, framework or packaging system. That makes them great building blocks for deploying and scaling web apps,
databases, and backend services without depending on a particular stack or provider.
Homepage: https://dockerproject.org

6、dpkg

# dpkg --help

-i|--install       <.deb file name>
--unpack <.deb file name>
--configure <package>
--get-selections [<pattern> ...] Get list of selections to stdout.
-r|--remove <package> ...
-P|--purge <package> ...
-s|--status <package> ... Display package status details.
-p|--print-avail <package> ... Display available version details.
-L|--listfiles <package> ... List files `owned' by package(s).
-l|--list [<pattern> ...] List packages concisely. 列出所有已安装的软件包。
-S|--search <pattern> ... Find package(s) owning file(s).
--print-architecture Print dpkg architecture.

查看package包含的文件:

# dpkg -L tree
/.
/usr
/usr/bin
/usr/bin/tree
/usr/share
/usr/share/doc
/usr/share/doc/tree
/usr/share/doc/tree/copyright
/usr/share/doc/tree/TODO
/usr/share/doc/tree/changelog.Debian.gz
/usr/share/doc/tree/changelog.gz
/usr/share/doc/tree/README.gz
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/tree.1.gz

查看package的详细信息,类似aptitude show和apt-cahce show。

# dpkg -s docker-ce
Package: docker-ce
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 85769
Maintainer: Docker <support@docker.com>
Architecture: amd64
Version: 17.03.1~ce-0~debian-jessie
Replaces: docker-engine
Depends: iptables, init-system-helpers (>= 1.18~), libapparmor1 (>= 2.6~devel), libc6 (>= 2.17), libdevmapper1.02.1 (>= 2:1.02.90), libltdl7 (>= 2.4.2), libsystemd0
Recommends: aufs-tools, ca-certificates, cgroupfs-mount | cgroup-lite, git, xz-utils
Conflicts: docker (<< 1.5~), docker-ee, docker-engine, docker-engine-cs, docker.io, lxc-docker, lxc-docker-virtual-package
Conffiles:
/etc/bash_completion.d/docker d005b0a5ba32208960d3baced35931d5
/etc/default/docker 82d6a44e99db1a3b74f7835e4f5e1b01
/etc/init.d/docker 4622ff202fe959c98f4fd993822424ab
/etc/init/docker.conf 123f7e2b4078fa11b4eecc4c4f9bdc25
Description: Docker: the open-source application container engine
Docker is an open source project to build, ship and run any application as a
lightweight container
.
Docker containers are both hardware-agnostic and platform-agnostic. This means
they can run anywhere, from your laptop to the largest EC2 compute instance and
everything in between - and they don't require you to use a particular
language, framework or packaging system. That makes them great building blocks
for deploying and scaling web apps, databases, and backend services without
depending on a particular stack or provider.
Homepage: https://dockerproject.org

7、dpkg-reconfigure 更改指定包的配置

更改时区:

# dpkg-reconfigure tzdata        #这里会跳出图形框,选择相应的时区即可

Current default time zone: 'Asia/Shanghai'
Local time is now: Sun Jun 18 11:29:19 CST 2017.
Universal Time is now: Sun Jun 18 03:29:19 UTC 2017.

8、debconf-show 查看指定包的当前配置

# debconf-show tzdata
* tzdata/Zones/Asia: Shanghai
tzdata/Zones/Australia:
tzdata/Zones/Pacific:
tzdata/Zones/Arctic:
tzdata/Zones/Europe:
tzdata/Zones/SystemV:
tzdata/Zones/Indian:
tzdata/Zones/Africa:
tzdata/Zones/US:
tzdata/Zones/Antarctica:
tzdata/Zones/Atlantic:
* tzdata/Zones/Etc: UTC
tzdata/Zones/America:
* tzdata/Areas: Asia

9、apt的配置文件

# apt-config --help

apt-config is a simple tool to read the APT config file.

用法:
apt-config [options] command shell - Shell mode
dump - Show the configuration

查看当前配置

# apt-config dump
APT "";
APT::Architecture "amd64";
APT::Build-Essential "";
APT::Build-Essential:: "build-essential";
......

可以在 /etc/apt/apt.conf 中设置新的默认选项。

debian包管理的更多相关文章

  1. debian、ubuntu:使用apt包管理器可能存在的问题! 让新手望而却步!

    apt包管理器说好真好,说不好真不好. 最近在debian9.ubuntu18.04上安装oracle 10g 玩. 怎么都准备不好安装环境.原因就是i386构架体系的deb包总安装不正确! baid ...

  2. debian系统包管理工具aptitude

    注意:aptitude与 apt-get 一样,是 Debian 及其衍生系统中功能极其强大的包管理工具.与 apt-get 不同的是,aptitude在处理依赖问题上更佳一些.举例来说,aptitu ...

  3. debian系统的另一个包管理器aptitude

    最近在玩OPI的时候遇到了一个包因为各种依赖问题死活装不上.苦搜很久找到这个aptitude包管理器. 基于debain衍生的各种操作系统比较常用包管理器是apt,不过apt在遇到依赖问题的时候处理得 ...

  4. Node.js包管理器Yarn的入门介绍与安装

    FAST, RELIABLE, AND SECURE DEPENDENCY MANAGEMENT. 就在昨天, Facebook 发布了新的 node.js 包管理器 Yarn 用以替代 npm .咱 ...

  5. Cygwin的包管理器:apt-cyg

    参考<Cygwin的包管理器:apt-cyg> cygwin下安装每次需要启动set_up,比较蛋疼,还是debian的apt方便,在网上看到应该cygwin 下的apt,觉得不错. 从h ...

  6. [转]Ubuntu上的包管理:dpkg,apt和aptitude

    一直以来对于ubuntu的包管理的概念就是apt-get,偶尔手动装个包就是dpkg -i,现在觉得是要系统地了解一下这几个包管理的命令. 原文转自: http://zhouliang.pro/201 ...

  7. linux 各种发行版及包管理器的关系

    linux 各种发行版及包管理器的关系 Linux发行版列表 基于Kpkg(Debian 系) Debian GNU / Linux 及其派生发行版使用deb软件包格式,并使用dpkg及其前端作为包管 ...

  8. Ubuntu包管理命令 dpkg、apt和aptitude

    起初GNU/Linux系统中仅仅有.tar.gz.用户 必须自己编译他们想使用的每个程序.在Debian出现之後,人们觉得有必要在系统 中加入一种机 制用来管理 安装在计算机上的软件包.人们将这套系统 ...

  9. 怎样安装pip--python的包管理工具

    pip是python的包管理工具,使用它来安装python的模块很方便. pip支持的操作系统:Unix/Linux, OS X, and Windows. 支持的python版本号:2.6, 2.7 ...

随机推荐

  1. [C++]值传递和引用传递

    概念 在定义函数时函数括号中的变量名成为形式参数,简称形参或虚拟参数: 在主调函数中调用一个函数时,该函数括号中的参数名称为实际参数,简称实参,实参可以是常量.变量或表达式. 注意: C语言中实参和形 ...

  2. Memcached服务器上实现多个实例(约约问题排查)

    约约测试服上出行一个问题,司机收车失败. (1)经查看代码是null指针异常. 针对,之前,同套代码发布到华威测试服,未出现该问题,遂认定不是代码问题. (2)打印异常信息,获取null值异常的收车司 ...

  3. Netty源码分析第6章(解码器)---->第4节: 分隔符解码器

    Netty源码分析第六章: 解码器 第四节: 分隔符解码器 基于分隔符解码器DelimiterBasedFrameDecoder, 是按照指定分隔符进行解码的解码器, 通过分隔符, 可以将二进制流拆分 ...

  4. 工具 | Sublime

    Sublime 前言 妈耶..\(Sublime\)的界面真的是太好看啦哭哭.. 我永远喜欢Sublime! 强推Sublime... 正文 自从暑假用上的Ubontu 一开始用的是\(gedit\) ...

  5. linux 其他知识目录

    博客目录总纲首页 为博客园添加目录的方法总结 linux 命令自动补全包 手动配置网卡 nginx日志统计 Linux 深入理解inode/block/superblock /proc/sys目录下各 ...

  6. Python发送邮件(最全)

    简单邮件传输协议(SMTP)是一种协议,用于在邮件服务器之间发送电子邮件和路由电子邮件. Python提供smtplib模块,该模块定义了一个SMTP客户端会话对象,可用于使用SMTP或ESMTP侦听 ...

  7. c# 程序重启设定

    问题情境: 程序随着时间运行,越来越大.暂时想到的两种方法,一是反攻代码,查看占内存大的函数,是不是没有回收.再就是暴力设定程序定时重启. 解决原理: 定时重启:暂设定timer,时间匹配执行rest ...

  8. angularJS1笔记-(3)-购物车增删改查练习

    html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  9. Java通用oracle和mysql数据库连接

    Java中oracle数据库连接写一个通用类UBUtil(){} import java.io.InputStream; import java.sql.*; import java.util.Pro ...

  10. poi excel导入 数字自动加小数点

    问题:导入excel表,若表格中为整数数字,不管单元格设置成数字格式还是文本格式,导入时都会出现小数点和0. 我遇到的问题是:一个名称,做测试数据的时候做了纯整形数字,发现了这个问题. 解决办法:在代 ...