下载离线包

RPM

yum-plugin-downloadonly
yum install --downloadonly --downloaddir=/data/mirrors/ 包名

##依赖 需要安装yum-utils
yumdownloader -–resolve(可选,意为下依赖包)  -–destdir=软件存放位置 (可选)  软件包名
  • –downloadonly表示仅下载,–downloaddir指定下载到哪个目录
  • 不指定默认/var/cache/yum/

rpm包离线无依赖强制安装

rpm -Uvh --replacefiles --force --nodeps *.rpm

DEB

下载离心包

sudo apt-get install --download-only <package_name>

离线包存储位置/var/cache/apt/archives

依赖项

apt download $(apt-rdepends vim | grep -v "^ ")
#E: Can't select candidate version from package debconf-2.0 as it has no candidate



apt-get download $(apt-rdepends vim | grep -v "^ " | sed 's/debconf-2.0/debconf/g')

安装

sudo dpkg -i *