debian下使用dpkg来安装/卸载deb包…

在debian下,你可以使用dpkg(Debian package system)来安装和卸载软件包,安装/卸载软件的最简单办法就是使用dpkg。

现在,debian还支持一个名为apt(for “A Package Tool”)和aptitude的工具,来帮助管理员更加简单的来管理软件。详细内容可以参考另一篇文章:如何使用apt-get和aptitude来管理软件。


1.使用dpkg -i安装deb包
   语法:
   dpkg -i package-file-name

  

   -i is to install a package.

 

   下例为使用dpkg来安装tcl
   $ dpkg -i tcl8.4_8.4.19-2_amd64.deb
   Selecting previously deselected package tcl8.4.
   (Reading database ... 94692 files and directories currently installed.)
   Unpacking tcl8.4 (from tcl8.4_8.4.19-2_amd64.deb) ...
   Setting up tcl8.4 (8.4.19-2) ...
   Processing triggers for menu ...
   Processing triggers for man-db ...

  

   如下所示,你可以使用dpkg -l +名称 来验证安装
   $ dpkg -l | grep 'tcl'
   ii  tcl8.4                               8.4.19-2                   Tcl (the Tool Command Language) v8.4 - run-t

   上面命令显示tcl包是否安装正确,其中“ii”表示“installed ok installed”

 
2.使用kpkg -r来删除deb包

   dpkg 加上 -r参数,用于卸载已安装好的软件包
   $ dpkg -r tcl8.4
   (Reading database ... 94812 files and directories currently installed.)
   Removing tcl8.4 ...
   Processing triggers for man-db ...
   Processing triggers for menu ...

  

   现在检查软件包的状态.
   # dpkg -l | grep 'tcl'
   rc  tcl8.4                                8.4.19-2                   Tcl (the Tool Command Language) v8.4 - run-t

   rc 代表 ‘removed ok config-files’. 卸载命令并没有清除配置文件. 每个已安装包的状态可在 /var/lib/dpkg/status查看.  tcl8.4包状态如下所示,
   Package: tcl8.4
   Status: deinstall ok config-files
   Priority: optional
   Section: interpreters
   Installed-Size: 3308

 

   以下命令表示彻底卸载软件包(包括配置文件).
   $ dpkg -P tcl8.4
   (Reading database ... 94691 files and directories currently installed.)
   Removing tcl8.4 ...
   Purging configuration files for tcl8.4 ...
   Processing triggers for menu ...
   $ dpkg -l | grep 'tcl'
   $

   现在软件已完全删除, 在 /var/lib/dpkg/status 中查看状态如下.
   Package: tcl8.4
   Status: purge ok not-installed
   Priority: optional
   Section: interpreters

 

本文由阿泉译自http://www.thegeekstuff.com/2010/06/install-remove-deb-package/,转载时请保留译者信息。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值