Linux dpkg

introduction

dpkg is the abbreviation of Debian Packager. A package management system specially developed for Debian to facilitate software installation, update and removal. All Linux distributions derived from Debian use dpkg, such as Ubuntu, Knoppix, etc. dpkg is used to: manage software packages that have been downloaded to the local and installed, and can also provide software information after installation, manage deb packages in the local system, and can install, uninstall, deb package, deb decompress and other operations. It can be simply understood as installing software offline. The related apt tool can be downloaded and installed as a deb package online.

deb package name rules:

The format is: Package_Version-Build_Architecture.deb
such as: nano_1.3.10-2_i386.deb
– Package Name: nano
– Version Number: 1.3.10
– Build Number: 2
– Platform (Architecture) ):i386

The following are some commonly used commands of dpkg, for reference only:

# -i:安装软件包 
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb

# -r:删除软件包不删除其配置文件
sudo dpkg -r wkhtmltox
sudo apt-get remove package  # 同上

# -P:删除软件包的同时删除其配置文件
sudo dpkg -P wkhtmltox
sudo apt-get remove package --purge  # 同上

# -L:显示于软件包关联的文件,安装完包后,可以用此命令查看软件安装到什么地方,
sudo dpkg -L wkhtmltox 

# -l:显示已安装软件包列表
sudo dpkg -l
sudo dpkg -l zabbix-release  # 显示包的版本
sudo dpkg -l *xx* 	# 模糊搜索找到包含XX的软件

# --unpack:解开软件包但是不进行配置,如果和-R一起使用,参数可以是一个目录
sudo dpkg –-unpack avg71flm_r28-1_i386.deb

# -c:显示软件包内文件列表
sudo dpkg -c wkhtmltox_0.12.5-1.bionic_amd64.deb

# --confiugre:重新配置和释放软件包
sudo dpkg –configure avg71flm_r28-1_i386.deb

# -R:安装一个目录下面所有的软件包
sudo dpkg -R /usr/local/src

Relevant file locations after using dpkg to install the software:

# 下载的软件包存放位置
/var/cache/apt/archives

# 安装后软件默认位置
/usr/share

# 可执行文件位置
/usr/bin

# 配置文件位置
/etc

# lib文件位置
/usr/lib

shortcoming:

Although we have solved a lot of problems in the software installation process when using dpkg, when dependencies are not satisfied, dependency problems still need to be solved manually. Therefore, the related apt tool appeared.

The difference between dpkg and apt:

The difference between apt and dpkg is that dpkg bypasses the apt package management database to operate the software package, so the software package you have installed with dpkg can be installed again with apt. The system does not know that it has been installed before, and it will overwrite the previous dpkg installation.

1. dpkg is used to install local software packages (deb packages). deb files, but it will not resolve module dependencies, and will not care about the software in the ubuntu software warehouse. It can be used to install local deb files.

2. apt will solve and install module dependency issues, install software packages from the network server, and consult the software warehouse, but it will not install local deb files. apt is a software management tool built on dpkg. After sudo apt-get install ***, the temporary storage path of the package is /var/cache/apt/archives.

Guess you like

Origin blog.csdn.net/qq_34125713/article/details/128032340