嵌入式 debian/ubuntu下使用dpkg来安装/卸载deb包

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

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


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

  

   -i is toinstall a package.

 

   下例为使用dpkg来安装tcl
   dpkg -itcl8.4_8.4.19-2_amd64.deb
  Selecting previously deselected package tcl8.4.
   (Reading database ... 94692files and directories currently installed.)
   Unpacking tcl8.4 (fromtcl8.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 -rtcl8.4
  (Reading database ... 94812 files and directories currentlyinstalled.)
   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 okconfig-files’. 卸载命令并没有清除配置文件. 每个已安装包的状态可在/var/lib/dpkg/status查看.  tcl8.4包状态如下所示,
   Package: tcl8.4
   Status: deinstall okconfig-files
   Priority: optional
   Section: interpreters
   Installed-Size: 3308

 

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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值