歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Debian based Linux system(Ubuntu)包管理工具

Debian based Linux system(Ubuntu)包管理工具

日期:2017/2/28 16:08:04   编辑:Linux教程

apt-* 查看,安裝,刪除,更新包。

1. apt-cache search: Search Repository Using Package Name

apt-cache search ^包名$

在Repo中查找包名,以查找Apache 2為例

  1. $ apt-cache search ^apache2$
  2. apache2 - Apache HTTP Server metapackage

2. apt-cache search: Search Repository Using Package Description
apt-cache search + 包描述, 有時不知道包的准備名字,可以通過包的描述信息查找。

  1. $ apt-cache search "Apache HTTP Server"
  2. apache2 - Apache HTTP Server metapackage
  3. apache2-doc - Apache HTTP Server documentation
  4. apache2-mpm-event - Apache HTTP Server - event driven model
  5. apache2-mpm-prefork - Apache HTTP Server - traditional non-threaded model
  6. apache2-mpm-worker - Apache HTTP Server - high speed threaded model
  7. apache2.2-common - Apache HTTP Server common files

3. apt-file search: Search Repository Using a Filename from the Package

apt-file search + 包中的任意文件名, 有時只知道包裡的配置文件或可能執行文件,也可以通過這些信息查找包。

  1. $ apt-file search apache2.conf
  2. apache2.2-common: /etc/apache2/apache2.conf
  3. apache2.2-common: /usr/share/doc/apache2.2-common/examples/apache2/apache2.conf.gz

4. apt-cache show: Basic Information About a Package

apt-cache show + 包, 顯示包的基本信息。

  1. $ apt-cache show apache2
  2. Package: apache2
  3. Priority: optional
  4. Maintainer: Ubuntu Core Developers
  5. Original-Maintainer: Debian Apache Maintainers
  6. Version: 2.2.11-2ubuntu2.3
  7. Depends: apache2-mpm-worker (>= 2.2.11-2ubuntu2.3)
  8. | apache2-mpm-prefork (>= 2.2.11-2ubuntu2.3)
  9. | apache2-mpm-event (>= 2.2.11-2ubuntu2.3)
  10. Filename: pool/main/a/apache2/apache2_2.2.11-2ubuntu2.3_all.deb
  11. Size: 46350
  12. Description: Apache HTTP Server metapackage
  13. The Apache Software Foundation's goal is to build a secure, efficient and
  14. extensible HTTP server as standards-compliant open source software.
  15. Homepage: http://httpd.apache.org/

5. apt-cache showpkg: Detailed Information About a Package

apt-cache showdpkg + 包,顯示包更加祥細的信息。

  1. $ apt-cache showpkg apache2
  2. Package: apache2
  3. Versions:
  4. 2.2.11-2ubuntu2.3 (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_jaunty-updates_main_binary-i386_Packages) (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_jaunty-security_main_binary-i386_Packages)
  5. Description Language:
  6. File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_jaunty-updates_main_binary-i386_Packages
  7. MD5: d24f049cd70ccfc178dd8974e4b1ed01
  8. Reverse Depends:
  9. squirrelmail,apache2
  10. squid3-cgi,apache2
  11. phpmyadmin,apache2
  12. mahara-apache2,apache2
  13. ipplan,apache2
  14. Dependencies:
  15. 2.2.11-2ubuntu2.3 - apache2-mpm-worker (18 2.2.11-2ubuntu2.3) apache2-mpm-prefork (18 2.2.11-2ubuntu2.3) apache2-mpm-event (2 2.2.11-2ubuntu2.3)
  16. 2.2.11-2ubuntu2 - apache2-mpm-worker (18 2.2.11-2ubuntu2) apache2-mpm-prefork (18 2.2.11-2ubuntu2) apache2-mpm-event (2 2.2.11-2ubuntu2)
  17. Provides:
  18. 2.2.11-2ubuntu2.3 -
  19. 2.2.11-2ubuntu2 -
  20. Reverse Provides:
  21. apache2-mpm-itk 2.2.6-02-1build4.3
  22. apache2-mpm-worker 2.2.11-2ubuntu2.3
  23. apache2-mpm-prefork 2.2.11-2ubuntu2.3
  24. apache2-mpm-prefork 2.2.11-2ubuntu2
  25. apache2-mpm-event 2.2.11-2ubuntu2

6. apt-file list: List all the Files Located Inside a Package
apt-file list + 包, 顯示包內所有文件。

  1. $ apt-file list apache2 | more
  2. apache2: /usr/share/bug/apache2/control
  3. apache2: /usr/share/bug/apache2/script
  4. apache2: /usr/share/doc/apache2/NEWS.Debian.gz
  5. apache2: /usr/share/doc/apache2/README.Debian.gz
  6. apache2: /usr/share/doc/apache2/changelog.Debian.gz
  7. ...

7.apt-cache depends: List all Dependent Packages

apt-cache depends + 包, 顯示包的所有依賴。在安裝包前需要檢查安裝包所有的依賴

  1. $ apt-cache depends apache2
  2. apache2
  3. |Depends: apache2-mpm-worker
  4. |Depends: apache2-mpm-prefork
  5. Depends: apache2-mpm-event

8. dpkg -l: Is the Package Already Installed?

dpkg -l , 顯示系統中所有的安裝包

9. apt-get install: Install a Package

apt-get install + 包,安裝包。

10. apt-get remove: Delete a Package

apt-get remove/purge , 刪除包

apt-get remove will not delete the configuration files of the package

apt-get purge will delete the configuration files of the package

11. apt-get -u install: Upgrade a Specific Package

apt-get -u install + 包,更新安裝包。

12. apt-get -u upgrade: Upgrade all Packages

更新所有安裝包。

Copyright © Linux教程網 All Rights Reserved