优缺点:
优点:安装与卸载方便
缺点:不能管理依赖,不能控制安装位置
包文件中的信息的识别:
~# dpkg -A jdk-11.0.2_linux-x64_bin.deb
结果:
Recorded info about jdk-11.0.2 from jdk-11.0.2_linux-x64_bin.deb.
其中的“ jdk-11.0.2”,即是“包名称”
包的安装位置查看(未安装前):
~# dpkg -c jdk-11.0.2_linux-x64_bin.deb
结果:
drwxr-xr-x mach5-one/mach5grp 0 2019-01-18 13:36 ./
drwxr-xr-x mach5-one/mach5grp 0 2019-01-18 13:36 ./usr/
drwxr-xr-x mach5-one/mach5grp 0 2019-01-18 13:36 ./usr/lib/
drwxr-xr-x mach5-one/mach5grp 0 2019-01-18 13:36 ./usr/lib/jvm/
drwxr-xr-x mach5-one/mach5grp 0 2019-01-18 13:36 ./usr/lib/jvm/jdk-11.0.2/
drwxr-xr-x mach5-one/mach5grp 0 2019-01-18 13:36 ./usr/lib/jvm/jdk-11.0.2/bin/
...
安装:
~# dpkg -i jdk-11.0.2_linux-x64_bin.deb
有可能因依赖没有安装,导致错误,此时可以执行:
~# apt-get -f -y install
再进行安装,即可
查看安装了哪些包
~# dpkg -l |grep jdk
结果:
ii jdk-11.0.2 11.0.2-1 amd64 Java Platform Standard Edition Development Kit
查看已安装包的情况
~# dpkg -L jdk-11.0.2
结果:
/.
/usr
/usr/lib
/usr/lib/jvm
/usr/lib/jvm/jdk-11.0.2
/usr/lib/jvm/jdk-11.0.2/bin
/usr/lib/jvm/jdk-11.0.2/bin/jhsdb
...
删除包(一并删除配置文件),并不删除所依赖的包。
~# dpkg -P jdk-11.0.2
结果:
(Reading database ... 101813 files and directories currently installed.)
Removing jdk-11.0.2 (11.0.2-1) ...
显示包的信息:
~# dpkg -s jdk-11.0.2
结果:
Package: jdk-11.0.2
Status: install ok installed
Priority: optional
Section: java
Maintainer: foo@oracle.com
Architecture: amd64
Version: 11.0.2-1
Depends: libasound2
...