• 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
  • 相关阅读:
    HCIA-R&S(15)OSPF基础、OSPF核心工作流程
    【算法3.7】spfa(完结)
    ChatGPT支持下的PyTorch机器学习与深度学习技术应用
    Python使用turtle绘制简单图形-绘制“圆“turtle.circle()
    本地环境搭建
    【mysql】MySQL 主从同步延迟排查
    趣学python编程 (三、计算机基础知识)
    300.最长递增子序列 | 354.俄罗斯套娃信封问题
    【无标题】
    “Node.js 包已不值得信任”
  • 原文地址:https://blog.csdn.net/lusklusklusk/article/details/133911941