• ubuntu安装debian包的命令dpkg和apt的详解


    dpkg是Debian Packager的缩写
    官方文档https://manpages.ubuntu.com/manpages/jammy/en/man1/dpkg.1.html
    ubuntu的dpkg命令类似centos的rpm命令,dpkg主要用于对已下载到本地和已安装的.deb软件包进行管理比如安装、构建、删除。dpkg不能自动下载和安装.deb软件包也无法检查软件包的依赖关系,因此在对一个软件的依赖关系不清楚的情况下,使用dpkg对用户的开发工作不太友好。为了帮助用户获取软件包(获取存在依赖关系的软件包),则出现了更高级的APT软件包管理工具。

    apt是Advanced Packaging Tool的缩写
    官方文档https://manpages.ubuntu.com/manpages/jammy/en/man8/apt.8.html
    ubuntu的apt类似centos的yum,从Ubuntu 16.04和Debian 9开始,开始推荐使用apt而不是apt-get,也就是使用apt来替代掉apt-get,尽管apt-get仍然可用且功能齐全。apt它提供了新软件包的安装、现有软件包的升级、软件包列表索引的更新,它提供在线软件包的管理也提供下载到本地的.deb软件包的管理,apt不同于dpkg,其解决了一个重要的问题,就是软件卸载过程中的软件包的依赖性问题,并且从指定的源(/etc/apt/sources.list文件中的内容)中检索和安装软件包。

    apt-get官方文档https://manpages.ubuntu.com/manpages/jammy/en/man8/apt-get.8.html关于install的解释
    install is followed by one or more packages desired for installation or upgrading.
    Each package is a package name, not a fully qualified filename (for instance, in a Debian system, apt-utils would be the argument provided, not apt-utils_2.4.5_amd64.deb).

    例子
    dpkg才可以安装下载到本地的.deb软件包,而apt也能安装,下例apt安装下载到本地的.deb软件包报错E: Unable to locate package,只要解决了这个报错,apt一样可以安装下载到本地的.deb软件包

    root@DAILACHDBUD001:~# ll |grep deb
    -rw-r--r--  1 root root 23585760 Oct 18 06:21 clickhouse-backup_2.4.2_amd64.deb
    root@DAILACHDBUD001:~# apt install clickhouse-backup_2.4.2_amd64.deb
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    E: Unable to locate package clickhouse-backup_2.4.2_amd64.deb
    root@DAILACHDBUD001:~# dpkg -i clickhouse-backup_2.4.2_amd64.deb
    Selecting previously unselected package clickhouse-backup.
    (Reading database ... 127136 files and directories currently installed.)
    Preparing to unpack clickhouse-backup_2.4.2_amd64.deb ...
    Unpacking clickhouse-backup (2.4.2) ...
    Setting up clickhouse-backup (2.4.2) ...
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    apt install本地包,必须写死本地包的路径,比如apt install /root/software/DDBoostFS_7.6.0.7_685537_amd64.deb

    root@DBUP001:~# cd /root/software/
    root@DBUP001:~/software# pwd
    /root/software
    root@DBUP001:~/software# apt install DDBoostFS_7.6.0.7_685537_amd64.deb
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    E: Unable to locate package DDBoostFS_7.6.0.7_685537_amd64.deb
    root@DBUP001:~/software# apt install /root/software/DDBoostFS_7.6.0.7_685537_amd64.deb
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    Note, selecting 'ddboostfs' instead of '/root/software/DDBoostFS_7.6.0.7_685537_amd64.deb'
    The following packages were automatically installed and are no longer required:
      libflashrom1 libftdi1-2
    Use 'apt autoremove' to remove them.
    The following additional packages will be installed:
      libfuse2
    The following NEW packages will be installed:
      ddboostfs libfuse2
    0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
    Need to get 90.3 kB/2,788 kB of archives.
    After this operation, 6,847 MB of additional disk space will be used.
    Do you want to continue? [Y/n] yes
    Get:1 /root/software/DDBoostFS_7.6.0.7_685537_amd64.deb ddboostfs amd64 7.6.0.7 [2,697 kB]
    Get:2 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libfuse2 amd64 2.9.9-5ubuntu3 [90.3 kB]
    Fetched 90.3 kB in 0s (225 kB/s)
    Selecting previously unselected package libfuse2:amd64.
    (Reading database ... 128191 files and directories currently installed.)
    Preparing to unpack .../libfuse2_2.9.9-5ubuntu3_amd64.deb ...
    Unpacking libfuse2:amd64 (2.9.9-5ubuntu3) ...
    Selecting previously unselected package ddboostfs.
    Preparing to unpack .../DDBoostFS_7.6.0.7_685537_amd64.deb ...
    Unpacking ddboostfs (7.6.0.7) ...
    Setting up libfuse2:amd64 (2.9.9-5ubuntu3) ...
    Setting up ddboostfs (7.6.0.7) ...
    Processing triggers for libc-bin (2.35-0ubuntu3.4) ...
    needrestart is being skipped since dpkg has failed
    N: Download is performed unsandboxed as root as file '/root/software/DDBoostFS_7.6.0.7_685537_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
  • 相关阅读:
    「杰伦熊」暴跌96.6% 明星带货NFT为何遇冷?
    基于日期、时间、经纬度下载MODIS数据并批处理
    深入理解 python 虚拟机:字节码教程(1)——原来装饰器是这样实现的
    Lustre和MARTE等建模语言的区别
    java 企业工程管理系统软件源码+Spring Cloud + Spring Boot +二次开发+ MybatisPlus + Redis
    好心情:6种会加重抑郁症的食物,你却每天都在吃
    【数据结构(二)】稀疏 sparsearray 数组(1)
    计算机网络【CN】介质访问控制
    3D激光SLAM:LeGO-LOAM论文解读---点云分割部分
    慢跑是早上跑好,还是晚上跑好?对的时间跑,效果可能还翻倍
  • 原文地址:https://blog.csdn.net/lusklusklusk/article/details/133911941