debian包管理
常用的包管理工具有: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包管理的更多相关文章
- debian、ubuntu:使用apt包管理器可能存在的问题!  让新手望而却步!
		apt包管理器说好真好,说不好真不好. 最近在debian9.ubuntu18.04上安装oracle 10g 玩. 怎么都准备不好安装环境.原因就是i386构架体系的deb包总安装不正确! baid ... 
- debian系统包管理工具aptitude
		注意:aptitude与 apt-get 一样,是 Debian 及其衍生系统中功能极其强大的包管理工具.与 apt-get 不同的是,aptitude在处理依赖问题上更佳一些.举例来说,aptitu ... 
- debian系统的另一个包管理器aptitude
		最近在玩OPI的时候遇到了一个包因为各种依赖问题死活装不上.苦搜很久找到这个aptitude包管理器. 基于debain衍生的各种操作系统比较常用包管理器是apt,不过apt在遇到依赖问题的时候处理得 ... 
- Node.js包管理器Yarn的入门介绍与安装
		FAST, RELIABLE, AND SECURE DEPENDENCY MANAGEMENT. 就在昨天, Facebook 发布了新的 node.js 包管理器 Yarn 用以替代 npm .咱 ... 
- Cygwin的包管理器:apt-cyg
		参考<Cygwin的包管理器:apt-cyg> cygwin下安装每次需要启动set_up,比较蛋疼,还是debian的apt方便,在网上看到应该cygwin 下的apt,觉得不错. 从h ... 
- [转]Ubuntu上的包管理:dpkg,apt和aptitude
		一直以来对于ubuntu的包管理的概念就是apt-get,偶尔手动装个包就是dpkg -i,现在觉得是要系统地了解一下这几个包管理的命令. 原文转自: http://zhouliang.pro/201 ... 
- linux 各种发行版及包管理器的关系
		linux 各种发行版及包管理器的关系 Linux发行版列表 基于Kpkg(Debian 系) Debian GNU / Linux 及其派生发行版使用deb软件包格式,并使用dpkg及其前端作为包管 ... 
- Ubuntu包管理命令  dpkg、apt和aptitude
		起初GNU/Linux系统中仅仅有.tar.gz.用户 必须自己编译他们想使用的每个程序.在Debian出现之後,人们觉得有必要在系统 中加入一种机 制用来管理 安装在计算机上的软件包.人们将这套系统 ... 
- 怎样安装pip--python的包管理工具
		pip是python的包管理工具,使用它来安装python的模块很方便. pip支持的操作系统:Unix/Linux, OS X, and Windows. 支持的python版本号:2.6, 2.7 ... 
随机推荐
- 使用 PropTypes 进行类型检查
			注意: 从 React v15.5 开始 ,React.PropTypes 助手函数已被弃用,建议使用 prop-types 库 来定义contextTypes. 1 2 3 4 5 6 7 8 9 ... 
- SpringCloud学习:Eureka、Ribbon和Feign
			Talk is cheap,show me the code , 书上得来终觉浅,绝知此事要躬行.在自己真正实现的过程中,会遇到很多莫名其妙的问题,而正是在解决这些问题的过程中,你会发现自己之前思维的 ... 
- C++ 类的定义与实现
			摘自这篇博客https://blog.csdn.net/xulingxin/article/details/81335030 一."类" 的介绍 在C++中, 用 &q ... 
- bing词典vs有道词典对比测试报告——功能篇之细节与用户体验
			之所以将细节与用户体验放在一起讨论,是因为两者是那么的密不可分.所谓“细节决定成败”,在细节上让用户感受方便.舒适.不费心而且温馨,多一些人文理念,多一些情怀,做出来的产品自然比其他呆板的产品更受欢迎 ... 
- WebGL学习笔记四点一
			上一章是对图形的变换,这一章的第一节主要介绍了光栅化的过程,在创建多个颜色的三角形的过程中顶点着点器的过程如下 ,1.首先通过attribute的变量从javascript中获取数据,根据drawAr ... 
- git 提交本地文件,删除文件夹,修改文件等
			1. 下载git工具包 链接: https://git-scm.com/download/win 2. 右键打开git bash 登陆到自己的github账户 $ git config --globa ... 
- 实验二 四则运算 完成版   ver.1
			package size; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JMenuBar; im ... 
- 【Coursera】支持向量机
			一.最大间隔分类器 1. 函数间隔:\(γ^{i} = y^{i}(w^{T} x + b)\), 改变w和b的量级,对分类结果不会产生任何影响,但是会改变函数间隔的大小.因此,直接对函数间隔求最大值 ... 
- 基于MongoDB2.6版本配置MongoDB主从复制集群架构
			1:集群环境说明:mongodb1:192.168.43.10.mongodb2:192.168.43.11.mongodb3:192.168.43.12.且基于主机名相互通信/etc/hosts文件 ... 
- Java通用oracle和mysql数据库连接
			Java中oracle数据库连接写一个通用类UBUtil(){} import java.io.InputStream; import java.sql.*; import java.util.Pro ... 
