AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 930429
Accepted
Ravexina
Ravexina
Asked: 2017-06-30 12:26:32 +0800 CST2017-06-30 12:26:32 +0800 CST 2017-06-30 12:26:32 +0800 CST

使用 apt 获取已安装的软件包 url

  • 772

您可能知道我们可以使用apt-get install --print-uris -y package-name它,它会向我们显示 URL、hashsum 等列表。

但是,如果我们将它用于已经安装在系统上的软件包,它就不起作用:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
package is already the newest version (x.x-x).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

那么如何使用apt或其他 CLI 工具(例如)获取必要的 URL 列表aptitude?

PS: 我不想使用packages.ubuntu.com。

apt
  • 2 2 个回答
  • 15470 Views

2 个回答

  • Voted
  1. Best Answer
    muru
    2017-06-30T14:22:52+08:002017-06-30T14:22:52+08:00

    当然,并非所有已安装的软件包都有与之关联的 URL。但是,您可以使用apt-get dowload:

    $ apt-get download --print-uris wget
    'http://archive.ubuntu.com/ubuntu/pool/main/w/wget/wget_1.15-1ubuntu1.14.04.2_amd64.deb' wget_1.15-1ubuntu1.14.04.2_amd64.deb 270522 SHA256:a3f3b049ea373402236a804a5a0952c6ef9b356ba8cc19fbc1f257db6e8f3052
    

    这是候选版本,如 所示apt-cache policy,不一定是安装版本。

    • 11
  2. steeldriver
    2017-07-01T10:58:27+08:002017-07-01T10:58:27+08:00

    添加标志似乎就足够了--reinstall(至少在我的 16.04 系统上),例如

    $ sudo apt-get install --print-uris wget
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    wget is already the newest version (1.17.1-1ubuntu1.2).
    wget set to manually installed.
    0 upgraded, 0 newly installed, 0 to remove and 73 not upgraded.
    

    但

    $ sudo apt-get install --reinstall --print-uris wget
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 73 not upgraded.
    Need to get 298 kB of archives.
    After this operation, 0 B of additional disk space will be used.
    'http://ca.archive.ubuntu.com/ubuntu/pool/main/w/wget/wget_1.17.1-1ubuntu1.2_amd64.deb' wget_1.17.1-1ubuntu1.2_amd64.deb 298270 MD5Sum:09a54f8d74c78598f91c4b376f3d2f0e
    

    注意:如果包当前被缓存,这不起作用:

    $ sudo apt-get install --reinstall --download-only wget
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 73 not upgraded.
    Need to get 298 kB of archives.
    After this operation, 0 B of additional disk space will be used.
    Get:1 http://ca.archive.ubuntu.com/ubuntu xenial-updates/main amd64 wget amd64 1.17.1-1ubuntu1.2 [298 kB]
    Fetched 298 kB in 0s (382 kB/s)
    Download complete and in download only mode
    
    $ sudo apt-get install --reinstall --print-uris wget
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 73 not upgraded.
    Need to get 0 B/298 kB of archives.
    After this operation, 0 B of additional disk space will be used.
    

    但是在清除缓存之后

    $ sudo apt-get clean
    $ sudo apt-get install --reinstall --print-uris wget
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 73 not upgraded.
    Need to get 298 kB of archives.
    After this operation, 0 B of additional disk space will be used.
    'http://ca.archive.ubuntu.com/ubuntu/pool/main/w/wget/wget_1.17.1-1ubuntu1.2_amd64.deb' wget_1.17.1-1ubuntu1.2_amd64.deb 298270 MD5Sum:09a54f8d74c78598f91c4b376f3d2f0e
    
    • 4

相关问题

  • 如何编写 shell 脚本来安装应用程序列表?

  • 如何查看存档中可用的软件包的所有版本?

  • 是否可以说出我安装的哪些软件包不在原版安装中?

  • 如何删除 PPA?

  • 使用 apt-get upgrade 时如何强制安装内核更新?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve