dpkg是Debian和基于Debian的系统中的主要软件包管理程序,用于安装,构建,删除和管理软件包。
安装软件包
要安装“ .deb ”软件包,请使用带有“ -i ”选项的命令。例如,要安装名为“ htop_2.2.0-1+b1_amd64.deb ”的“ .deb ”软件包,请使用以下命令。
root@LimeLinux:~# lshtop_2.2.0-1+b1_amd64.debroot@LimeLinux:~# dpkg -i htop_2.2.0-1+b1_amd64.deb Selecting previously unselected package htop.(Reading database ... 27602 files and directories currently installed.)Preparing to unpack htop_2.2.0-1+b1_amd64.deb ...Unpacking htop (2.2.0-1+b1) ...Setting up htop (2.2.0-1+b1) ...Processing triggers for mime-support (3.62) ...Processing triggers for man-db (2.8.5-2) ...root@LimeLinux:~#
列出所有已安装的软件包
要查看和列出所有已安装的软件包,请在命令中使用“ -l ”选项。
root@LimeLinux:~# dpkg -l
要查看已安装或未安装的特定软件包,请使用选项“ -l ”以及软件包名称。例如,检查是否安装了 htop 软件包。
root@LimeLinux:~# dpkg -l htopDesired=Unknown/Install/Remove/Purge/Hold| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)||/ Name Version Architecture Description+++-==============-============-============-=================================ii htop 2.2.0-1+b1 amd64 interactive processes viewerroot@LimeLinux:~#
删除安装的软件包
要删除“ .deb ”软件包,必须指定软件包名称“ htop ”,而不是原始名称“ htop_2.2.0-1+b1_amd64.deb ”,“ -r ”选项用于删除/卸载软件包。
root@LimeLinux:~# dpkg -r htop(Reading database ... 27613 files and directories currently installed.)Removing htop (2.2.0-1+b1) ...Processing triggers for man-db (2.8.5-2) ...Processing triggers for mime-support (3.62) ...root@LimeLinux:~#
使用' p '选项代替' r',将删除软件包以及配置文件。' r '选项将仅删除软件包,而不会删除配置文件。
root@Lim