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

来源:互联网 发布:树达学院教务网络系统 编辑:程序博客网 时间:2024/06/03 16:29

apt-* 查看,安装,删除,更新包。

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

     apt-cache search ^包名$

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

$ apt-cache search ^apache2$apache2 - Apache HTTP Server metapackage

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

$ apt-cache search "Apache HTTP Server"apache2 - Apache HTTP Server metapackageapache2-doc - Apache HTTP Server documentationapache2-mpm-event - Apache HTTP Server - event driven modelapache2-mpm-prefork - Apache HTTP Server - traditional non-threaded modelapache2-mpm-worker - Apache HTTP Server - high speed threaded modelapache2.2-common - Apache HTTP Server common files

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

     apt-file search + 包中的任意文件名, 有时只知道包里的配置文件或可能执行文件,也可以通过这些信息查找包。

$ apt-file search apache2.confapache2.2-common: /etc/apache2/apache2.confapache2.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 + 包, 显示包的基本信息。

$ apt-cache show apache2Package: apache2Priority: optionalMaintainer: Ubuntu Core DevelopersOriginal-Maintainer: Debian Apache MaintainersVersion: 2.2.11-2ubuntu2.3Depends: apache2-mpm-worker (>= 2.2.11-2ubuntu2.3) | apache2-mpm-prefork (>= 2.2.11-2ubuntu2.3) | apache2-mpm-event (>= 2.2.11-2ubuntu2.3)Filename: pool/main/a/apache2/apache2_2.2.11-2ubuntu2.3_all.debSize: 46350Description: Apache HTTP Server metapackage The Apache Software Foundation's goal is to build a secure, efficient and extensible HTTP server as standards-compliant open source software.Homepage: http://httpd.apache.org/

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

  apt-cache showdpkg + 包,显示包更加祥细的信息。

$ apt-cache showpkg apache2Package: apache2Versions: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) Description Language:                 File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_jaunty-updates_main_binary-i386_Packages                  MD5: d24f049cd70ccfc178dd8974e4b1ed01Reverse Depends:  squirrelmail,apache2  squid3-cgi,apache2  phpmyadmin,apache2  mahara-apache2,apache2  ipplan,apache2Dependencies:  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)  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)Provides:  2.2.11-2ubuntu2.3 -  2.2.11-2ubuntu2 -Reverse Provides:  apache2-mpm-itk 2.2.6-02-1build4.3  apache2-mpm-worker 2.2.11-2ubuntu2.3  apache2-mpm-prefork 2.2.11-2ubuntu2.3  apache2-mpm-prefork 2.2.11-2ubuntu2  apache2-mpm-event 2.2.11-2ubuntu2

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

$ apt-file list apache2 | moreapache2: /usr/share/bug/apache2/controlapache2: /usr/share/bug/apache2/scriptapache2: /usr/share/doc/apache2/NEWS.Debian.gzapache2: /usr/share/doc/apache2/README.Debian.gzapache2: /usr/share/doc/apache2/changelog.Debian.gz...

7.apt-cache depends: List all Dependent Packages

  apt-cache depends + 包, 显示包的所有依赖。在安装包前需要检查安装包所有的依赖

$ apt-cache depends apache2apache2 |Depends: apache2-mpm-worker |Depends: apache2-mpm-prefork  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

    更新所有安装包。