「APT」- 杂记

  CREATED BY JENKINSBOT

锁定版本,防止升级

How to prevent updating of a specific package?

#!/bin/sh

apt-mark hold <package-name> # 锁定
apt-mark unhold <package-name> # 解锁
apt-mark showhold # 查看所有锁定的包

查看可升级的软件包

List available updates but do not install them

#!/bin/sh

apt list --upgradable
apt-get -u upgrade --assume-no
apt-get upgrade --show-upgraded --assume-no

获取某个包的下载地址

Get installed packages url using apt

当从仓库中下载特别慢时,我们可以自己下载 deb 包,然后放入/var/cache/apt/archives/中:

#!/bin/sh

apt-get download --print-uris "<package-name>" # 打印下载链接
axel -n 5 "http://<package-url>" # 加速下载工具
mv "<package-name>" /var/cache/apt/archives/ # 移动到本地的缓存库